Week6 Homework Submission#2
Conversation
epq
left a comment
There was a problem hiding this comment.
I left a few comments. Overall, good work 👍
|
|
||
| //3.Declare a variable age and initialize it with an integer, using these exact steps: | ||
| let x; | ||
| console.log('the value of age will be: 30'); |
There was a problem hiding this comment.
After you ran your program, do you understand why x isn't 30 when you first declared it on line 12?
| //4.Declare a variable name and assign a string to it. | ||
|
|
||
| let y ='butterfly'; | ||
| console.log('the value of my string will be:bird'); |
There was a problem hiding this comment.
Maybe you made a typo, but the value of y isn't bird here.
| let roundedNumber=Math.round(number); | ||
| console.log(number); // prints 7 | ||
|
|
||
| if(roundedNumber < number){ |
There was a problem hiding this comment.
Good work here, but make sure you declare your variable result with the let keyword, i.e. let result;. Otherwise, it'll automatically become a global variable (https://www.w3schools.com/js/js_scope.asp)
| console.log(myString.length); | ||
|
|
||
|
|
||
| //8.If x equals 7, and the only other statement is x = x % 3, what would be the new value of x? |
There was a problem hiding this comment.
Good job with the examples here!
| console.log(counter + 2); | ||
|
|
||
|
|
||
| counter=+2; |
There was a problem hiding this comment.
counter = +2 actually assigns the value of the counter to 2. The third method would be to write this out twice:
counter++;
counter++;
| //6.Arrays | ||
|
|
||
| let colors=[]; | ||
| console.log('the value of my array is: blue, yellow, green, black'); |
There was a problem hiding this comment.
Did you forget to add some colors to your array?
No description provided.