function expression
const getRectArea = function(width, height) {
return width * height;
};
console.log(getRectArea(3, 4));
// expected output: 12
const mul = function(x, y){
return x * y;
}; //semicolon needs to be there as it is expression
console.log(mul(10, 20));const plantNeedsWater = function(day){
if (day === 'Wednesday'){
return true;
} else{
return false;
}
}
console.log(plantNeedsWater('Tuesday'))
Also in JavaScript:
- variable javascript
- shorthand function javascript multiple parameters
- jquery remove br from div
- drawer navigation set width react native
- cookie clicker hack
- change dxform label angular
- jquery fade out
- how to run p5js in a particular section of page
- use jsx html
- math.floor js
- are you sure you want to proceed click ok button javascript code
- angular one way property binding
- Javascript compare two arrays
- after changing the state clearing input feild
- react overflow scroll
- permission api js
- ckeditor get content html
- array unique values javascript
- js database connection
- getusermedia example
- prevent form submission using jquery
- post json in flutter
- javaScript disable submit button until form is fully validated
- close current tab javascript