js function expression
const plantNeedsWater = function(day){
if (day === 'Wednesday'){
return true;
} else{
return false;
}
}
console.log(plantNeedsWater('Tuesday'))
js function expression
const plantNeedsWater = function(day){
if (day === 'Wednesday'){
return true;
} else{
return false;
}
}
console.log(plantNeedsWater('Tuesday'))
function expression
const getRectArea = function(width, height) {
return width * height;
};
console.log(getRectArea(3, 4));
// expected output: 12
javascript function expression
const mul = function(x, y){
return x * y;
}; //semicolon needs to be there as it is expression
console.log(mul(10, 20));
function expression and function declaration
// Function Declaration
function add(a, b) {
return a + b;
}
console.log(add(1,2)); //3
// Function Expression
const add = function (a, b) {
return a + b;
};
console.log(add(1,2)); //3
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us