Review after Mad Libs and Calculator
- Variable are names for values (like
x
in algebra),
can be used again and again, and can change
(vary).
- Assignment is different from equality.
var x = 13;
x = x + 1;
- Values in variables can be strings or numbers.
(We'll fine-tune this later!) "Float" is CS-speak for real numbers,
e.g., 3.5.)
- There is a difference between
"+"
and
+
.
- We can build up a long string out of shorter strings (and even
numbers) using
+
.
- Periods inside strings represent periods in text.
Periods outside of strings are for referencing object properties and
methods.
- Spaces can be added to strings, but only if the space is
enclosed in quotation marks.
- A function is a group of statements that collectively do one
thing.
- A function call requires parentheses after the function
name.
- The
alert
and prompt
functions expect
a single string in the parentheses.
- The
parseFloat
function converts a string
to a number (if the value of the string really does represent a
number).
- The order of statements in a JavaScript code block (or function)
matters!
- JavaScript statements end in semi-colon;