Using Variables Flashcards
What is the line of code that will prompt “Hello, world” and
alert(“Hello, world”);
What line in the HTML webpage points to the JS you wrote that triggers the “Hello, world” promote?
What line of code would assign the variable ‘name’ and value? How would you use that in the “hello” prompt?
1) var name = prompt(“What is your name”);
2) alert(“Hello “ + name);
After what input does the code continue on to display the “Hello” + name prompt?
When the user provides an input. Essentially the code stops until the user puts ANYTHING.
Variables are just ______ that hold information that you can ___ ___ in later lines of ode
Containers / Call Back
Create a variable for the year, month and day.
var year = 2014; var month = December; var day = 10;
What is the shortest way to write define variables for year, month and day?
var year = 2014, month = December, day = 10;
What is the assignment operator for variables?
” = “
What is wrong with the following variable? var name = 26Darius;
You can not start a variable with a number.
What the only 4 elements you can use when defining a variable?
Letters
Numbers
+
_ (underscore)