JavaScript Cheet Sheet

Section 1 - JavaScript Language Fundamentals

1.1 Variables - Example Code

// Declare variable aNumber
var aNumber;

// Declare and initialize variable message of type string
let message = "Hello, my name is Dan.";

// Declare and initialize variable text of type string
const text = "years old";

// Initilize aNumber to 38
aNumber = 38;

// Display output to console concatenating variables and text
console.log(message +" I am " +aNumber +" " +text +".");

// Or you can display to the output to the browswer
document.writeln(message +" I am " +aNumber +" " +text +".");


Output: