Working with Numbers, Characters and Strings Flashcards
The most common types of Variables are…
Numbers
Write the alert prompt for the variable "a" after a = 5; a = 100000; a = 23456.456 a = -23
alert(a);
The prompt would show -23
What is the difference between these two variables?
a = 456;
and
a = “456”;
The first assigns “a” the integer value 456 and the second one just shows the string 456, and is not a number value.
In terms of a string, what is the portion inside the parenthesis called?
It is called the LITERAL.
(“Hello, world”) is the example.
Does using “ and ‘ together make a difference?
Yes, you must open and close the string with the same quotations you started it with.
Where would you escape the quotations in this string?
“I said “I’ve had enough” and then left”;
“I said "I've had enough" and then left”
Define the variable and write the String Priority for the length of characters in this variable: “I am hungry”
var phrase = "I am hungry"; alert(phrase.length);
output will be 11