More Variable Practice
We have seen how to create a variable. But how do we use it? It is useful to think that any time you type the variable's name, you are asking the computer to swap out the variable name and swap in the value of the variable.
var myName = "Steve Jobs";
Look at the second line above. You have asked the computer to swap out myName and swap in Steve Jobs, so
which evaluates to Steve.
var myAge = 120;
myAge % 12 ? See the hint to check your answer.
So the variable stores the value of the variable, whether that is a number or a string. As you will see soon, this makes writing long programs much easier!
Follow the instructions in the comments in the code to continue.
Note that "New York" and "new york" are seen by the computer to be different strings. (i.e. "New York" is not the same as "new york")
And the answer from above is that myAge % 12 evaluates to 0.
this is what I wrote, am not sure what I should be doing here , or write what on where??
// Declare a variable on line 3 called
// myCountry and give it a string value.
var mycountry= "New York"
// Use console.log to print out the length of the variable myCountry.
// Use console.log to print out the first three letters of myCountry.
console.log(substring (0,2 ));