Working with Numbers, Characters and Strings Flashcards

1
Q

The most common types of Variables are…

A

Numbers

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q
Write the alert prompt for the variable "a" after 
a = 5;
a = 100000;
a = 23456.456
a = -23
A

alert(a);

The prompt would show -23

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

What is the difference between these two variables?
a = 456;
and
a = “456”;

A

The first assigns “a” the integer value 456 and the second one just shows the string 456, and is not a number value.

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

In terms of a string, what is the portion inside the parenthesis called?

A

It is called the LITERAL.

(“Hello, world”) is the example.

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

Does using “ and ‘ together make a difference?

A

Yes, you must open and close the string with the same quotations you started it with.

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

Where would you escape the quotations in this string?

“I said “I’ve had enough” and then left”;

A

“I said "I've had enough" and then left”

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

Define the variable and write the String Priority for the length of characters in this variable: “I am hungry”

A
var phrase = "I am hungry";
alert(phrase.length);

output will be 11

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