Using Variables Flashcards

1
Q

What is the line of code that will prompt “Hello, world” and

A

alert(“Hello, world”);

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What line in the HTML webpage points to the JS you wrote that triggers the “Hello, world” promote?

A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What line of code would assign the variable ‘name’ and value? How would you use that in the “hello” prompt?

A

1) var name = prompt(“What is your name”);

2) alert(“Hello “ + name);

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

After what input does the code continue on to display the “Hello” + name prompt?

A

When the user provides an input. Essentially the code stops until the user puts ANYTHING.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Variables are just ______ that hold information that you can ___ ___ in later lines of ode

A

Containers / Call Back

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Create a variable for the year, month and day.

A
var year = 2014;
var month = December;
var day = 10;
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What is the shortest way to write define variables for year, month and day?

A

var year = 2014, month = December, day = 10;

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What is the assignment operator for variables?

A

” = “

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What is wrong with the following variable? var name = 26Darius;

A

You can not start a variable with a number.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What the only 4 elements you can use when defining a variable?

A

Letters
Numbers
+
_ (underscore)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly