Repository navigation
add homework for week1 js #205
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| // console.log('I'm awesome'); | ||
| // changes single queto to double queto | ||
| console.log("I'm awesome"); | ||
|
|
||
| // or | ||
| console.log('I\'m awesome'); | ||
| console.log('I`m awesome'); | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| var myString="hello"+ " "+ "world"; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do you think it's better to use Also, don't forget to add some spacing between your variable and the value. So like this:
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hello, I have made some changes yesterday, but it is in commits section. whould you plz take a look? |
||
| console.log('greetings'); | ||
| console.log(myString); | ||
|
|
||
| var myString="love you"; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think this will give a |
||
| console.log('love'); | ||
| console.log(myString); | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| let z=7.25; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. here again, good that you use
|
||
| console.log(z); | ||
|
|
||
| let a = (Math.round(z)); | ||
| console.log(a); | ||
|
|
||
|
|
||
| let highestValue=(Math.max(a,z)); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. wow very nice! Do you think it's better to use |
||
| console.log(highestValue); | ||
|
|
||
|
|
||
|
|
||
| // let a=7; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think you can remove these, right? Because it's commented out |
||
| // let z=7.25; | ||
| // console.log(a===z); | ||
|
|
||
|
|
||
|
|
||
| // let result = a>z; | ||
| // alert (result); | ||
|
|
||
|
|
||
| // // alert(a>z); | ||
| // // alert(a<z); | ||
| // // alert(a=z); | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| var animals=[]; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would use |
||
| console.log('names of animals'); | ||
| console.log(animals); | ||
| var newLength = animals.push('wolf');//it does not work here. | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What do you mean with |
||
| var myPets = ["cat", "horse", "sheep"]; | ||
| console.log(myPets); | ||
| // var newLength = myPets.push('wolf');//it works here. | ||
| console.log(myPets); | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| var names=['Nur','gul','tur','yuri']; | ||
| var numbers=[1,2,3,4,5,6,7]; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do you think it's better to use |
||
|
|
||
| console.log('The length of the array is ' + names.length); | ||
| // console.log(names.length); | ||
| console.log('The length of the array is ' + numbers.length); | ||
| // console.log(numbers.length); | ||
|
|
||
| let compare = 'names.length === numbers.length'; | ||
| compare=false; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think you made a mistake here, can you take a look at this and see if you can fix it. |
||
|
|
||
|
|
||
| if (compare) { | ||
| console.log('They are the same!'); | ||
| } else { | ||
| console.log('Two different sizes'); | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| <!DOCTYPE html> | ||
| <html lang="en"> | ||
| <head> | ||
| <meta charset="UTF-8"> | ||
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
| <meta http-equiv="X-UA-Compatible" content="ie=edge"> | ||
| <title>js-exersize</title> | ||
| </head> | ||
| <body> | ||
| <h1>salam</h1> | ||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
| </body> | ||
|
|
||
|
|
||
|
|
||
|
|
||
| <script src="compareArray.js"></script> | ||
| </html> |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| 'use strict' | ||
| var mySentence ="Programming is so interesting!"; | ||
| var length=mySentence.length; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same question here, is it better to use |
||
| console.log(length); | ||
|
|
||
| // console.log(mySentence.length); | ||
|
|
||
| // document.write(mySentence.length); | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| 'use strict' | ||
| var a = 'Hello'+ " " +'world!';//english | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would remove the
And also for all the others:) |
||
| console.log(a); | ||
| var a = 'Selam ' + " " +'Dünya';//turkish | ||
| console.log(a); | ||
| var a = 'salve ' + " " +'mundi!';// | ||
| console.log(a); | ||
| var a = 'こんにちは' + " " +'世界!';//japanese | ||
| console.log(a); | ||
| var a = '안녕 ' + " " +'세상!';//korean | ||
| console.log(a); | ||
| var a = 'Hallo'+ " " +'wereld!';//dutch | ||
| console.log(a); | ||
| var a = 'مرحبا'+ " " +'عالم!';//arabic | ||
| console.log(a); | ||
| var a = 'سلام' + " " +'دنیا!';//iran | ||
| console.log(a); | ||
| var a = 'سالام'+ " " +'دۇنيا!';//uyghur | ||
| console.log(a); | ||
| var a = 'ciao'+ " " +'mondo!'; | ||
| console.log(a); | ||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| 'use strict'; | ||
| let numberX; | ||
| console.log('number'); | ||
| console.log(12); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is the value here |
||
|
|
||
| // | ||
| var numberX = 12; | ||
| console.log('month'); | ||
| console.log(12); | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| 'use strict' | ||
| let x = 7; | ||
| x = x % 3; | ||
| x %= 3;// 7-3-3=1 | ||
| console.log(x); | ||
|
|
||
|
|
||
| let y=21; | ||
| y=y%4; | ||
| y %= 4;// 21-4-4-4-4-4=1; | ||
| console.log(y); | ||
|
|
||
|
|
||
| let z=13; | ||
| z=z%2; | ||
| z %= 2;// 13-2-2-2-2-2-2=1 | ||
| console.log(z); | ||
|
|
||
|
|
||
|
|
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
|
|
||
| var fruit='apple'; | ||
| var fruit='pear'; | ||
| var car = { type: "Fiat", model: "500", color: "white" }; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think you didn't finish this assignment, can you take a look at it again? |
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This last one is not really correct, because the output would not be the same. the ` is a different character then the '. You already solved the exercise with the first two answers!