Basic Commands

// console.log() - takes message and prints to console
console.log("Hello there!");
console.log({
    name: "Aliya Tang",
    age: 15,
  });
  console.log(["Red", "Orange", "Yellow"]);
Hello there!
{ name: 'Aliya Tang', age: 15 }
[ 'Red', 'Orange', 'Yellow' ]
// var - create and assign variables
var favcolor = "blue"
console.log("Aliya's favorite color is " + favcolor + ".")
Aliya's favorite color is blue.
// function - creates a function
function greet(name) {
    return("Hello " + name + ", how are you?")
}
greet("Aliya")
'Hello Aliya, how are you?'

Math in JavaScript!

// + addition
var x = 5, y = 7;
var sum; 
sum = x + y; //12
12
// - subtraction
var x = 5, y = 7;
var diff1, diff2;
diff1 = x - y; //-2
diff2 = y - x; //2
2
// * multiplicatoin
var x = 8, y = 4;
var product; 
product = x * y; //32
32
// / division
var x = 36, y = 9, z = 5; 
var div1, div2; 
div1 = x / y; //4
div2 = x / z; //7.2
7.2
// % modulus (remainder)
var x = 24, y = 5, z = 6;
var mod1, mod2;
mod1 = x % y; //4
mod2 = x % z //0
0