To make functions more concise, refer to: https://teamtreehouse.com/library/concise-arrow-function-syntax-2
const name = "Andrew";
const sayName = () => {
const message = "My name is " + name;
console.log(message);
}
sayName();
const sayBye = () => {
console.log("Bye " + name);
}
sayBye();
const square = (x) => {
return x * x;
}
const cube = (x) => {
return square(x) * x;
}
const multiply = (x, y) => {
return x * y;
}
const add = (a, b) => {
return a + b;
}
const subtract = (a, b) => {
return a - b;
}
//Function Declaration
function divide1(a, b) {
return a / b;
}
//Function Expression
const divide2 = function(a, b) {
return a / b;
}
//Arrow Function Expression
const divide3 = (a, b) => {
return a / b;
}
//Arrow Function Expression - concise
const divide4 = (a, b) => a / b;