Nilai parameter default dalam javascript
// Default Parameter Values in javascript
// Longhand:
function volume(l, w, h) {
if (w === undefined)
w = 3;
if (h === undefined)
h = 4;
return l * w * h;
}
console.log(volume(2)); //output: 24
// Shorthand:
volume_ = (l, w = 3, h = 4 ) => (l * w * h);
console.log(volume_(2)) //output: 24
Chetan Nada