expression javascript code example
Example 1: function expression javascript
const getRectArea = function(width, height) {
return width * height;
};
console.log(getRectArea(3, 4));
Example 2: javascript function expression
const mul = function(x, y){
return x * y;
};
console.log(mul(10, 20));
Example 3: js function expression
const plantNeedsWater = function(day){
if (day === 'Wednesday'){
return true;
} else{
return false;
}
}
console.log(plantNeedsWater('Tuesday'))
Example 4: javascript expression
3 + 4
1991
true && false && false
const str = `String assigned to str`;