Tutorial by Examples

var myVariable = "This is a variable!"; This is an example of defining variables. This variable is called a "string" because it has ASCII characters (A-Z, 0-9, !@#$, etc.)
var number1 = 5; number1 = 3; Here, we defined a number called "number1" which was equal to 5. However, on the second line, we changed the value to 3. To show the value of a variable, we log it to the console or use window.alert(): console.log(number1); // 3 window.alert(number1); //...
var myInteger = 12; // 32-bit number (from -2,147,483,648 to 2,147,483,647) var myLong = 9310141419482; // 64-bit number (from -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807) var myFloat = 5.5; // 32-bit floating-point number (decimal) var myDouble = 9310141419482.22; // 64-bit floating-...
var myArray = []; // empty array An array is a set of variables. For example: var favoriteFruits = ["apple", "orange", "strawberry"]; var carsInParkingLot = ["Toyota", "Ferrari", "Lexus"]; var employees = ["Billy", "Bob...

Page 1 of 1