1const plantNeedsWater = function(day){
2 if (day === 'Wednesday'){
3 return true;
4 } else{
5 return false;
6 }
7}
8
9console.log(plantNeedsWater('Tuesday'))
1const getRectArea = function(width, height) {
2 return width * height;
3};
4
5console.log(getRectArea(3, 4));
6// expected output: 12
7
1const mul = function(x, y){
2 return x * y;
3}; //semicolon needs to be there as it is expression
4
5console.log(mul(10, 20));
10 // 0
2
31 + 1 // 2
4
5'Hello' + ' ' + 'World' // 'Hello World'
6
7{ answer: 42 } // { answer: 42 }
8
9Object.assign({}, { answer: 42 }) // { answer: 42 }
10
11answer !== 42 ? 42 : answer // 42
12
13answer = 42 // 42
1// EXPRESSION: Code that produces a value
2// example(s):
33 + 4
41991
5true && false && false
6
7// STATEMENT: Code that performs actions (generally something that ends in ";"
8// example:
9const str = `String assigned to str`;