Variables
Lesson 6Author : 🦒
Last Updated : October, 2017
document.write("There once was a man named " + characterName + "<br/>"); document.write("He was " + characterAge + " years old <br/>"); document.write("He really liked the name " + characterName + "<br/>"); document.write("But didn't like being " + characterAge + "<br/>");
document.write("There once was a man named " + characterName + "<br/>"); document.write("He was " + characterAge + " years old <br/>");
characterAge = 80;
document.write("He really liked the name " + characterName + "<br/>"); document.write("But didn't like being " + characterAge + "<br/>");
Names are case-sensitive and may begin with: letters, $, _ After, may include letters, numbers, $, _ Convention says Start with a lowercase word, then additional words are capitalized ex. myFirstVariable
Video Code
var name = "Mike"; // String w/ double quotes
var occupation = 'programmer'; // String w/ single quotes
var age = 20; // Integer
var gpa = 2.5; // Floating point number
var isTall; // boolean true/false
isTall = true;
name = "John";
document.write("Your name is " + name);