function myFunction() {...}
function addTwoNumbers(num1, num2) {num1 + num2;}
var myString = 'Stringing of characters.';var myNumber = 77;var myBoolean = true;
var firstName = 'Barack';var lastName = 'Obama';var age = 51;var isPresident = true;
if (condition) {...} else if (some other condition) {...} else {...}
if (age >= 18 && isMale == true) {// Male adult.} else if (age < 18 && isMale == true) {// Male minor.} else {// None of the above were true.}
if (isLoggedIn == true && isIdle == false) {// User is logged in and not idle.}
var fruits = ['Apple', 'Orange', 'Peach'];var balances = [3010, 5010, 22000];var firstFruit = fruits[0];var secondFruit = fruits[1];var thirdFruit = fruits[2];var secondBalance = balances[1];var lastBalance = balances[2];
var fruits = ['Apple', 'Orange', 'Peach'];fruits[0] = 'Banana';fruits[2] = 'Zucchini';// What fruits are available now?console.log(fruits);
var president = {first: 'Barack',last: 'Obama',age: 51,currentlyPresident: true,children: ['Sasha', 'Malia'],address: {street: 'Pennsylvania',number: 1600,location: 'Washington DC'}};
var firstName = president.first;var lastName = president.last;var children = president.children;var firstChild = children[0];var streetName = president.address.street;
president.first = 'Bill';president.last = 'Clinton';president.currentlyPresident = false;president.children = ['Chelsea']
for(initialize; condition; update) {...}var fruits = ['Apple', 'Orange', 'Peach'];for (var i = 0; i < 3; i++) {console.log(fruits[i]);}
var myImage = document.createElement('img');myImage.src = 'catz.jpg';var myDiv = document.createElement('div');
document.body.appendChild(myImage);myDiv.appendChild(myImage);