terms Flashcards
string
In JavaScript, when we surround a word with quotes it’s called a string, and when we’re done with a line of code we finish it with a semicolon.
functions
In order to call a function, we simply write its name (this time without quotes) and end it with a set of parentheses.
String Function Parameter
many functions can take instructions, which we call parameters. By sending a string into the function, we can put text on the pop-up box.
Variables
Often when programming we want to store values in containers so we can use them later; these are called variables. Let’s store your name in a variable, or ‘var’ for short, by typing the following:
var firstName = “Dorota”;
Numbers
So far we have only worked with 1 value type (strings), but JavaScript has many! Another example of a value type is a number.
Combining Numbers
We can also do math in JavaScript! Combine any 2 numbers like so:
14 + 28;
Combining Strings
JavaScript not only can combine numbers — it can combine strings as well!
Create an alert that combines both your name and a string, like below:
alert(firstName + “ is awesome!”);