Javascript - Program the Web
This course covers the basics of programming in Javascript. Work your way through the videos/articles and I'll teach you everything you need to know to make your website more responsive!

Variables

Lesson 6
Author : 🦒
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

Copyvar 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);