how to set default value in javascript code example
Example 1: default in javascript
const greet = (message = 'Hello World!') => console.log(message);
greet(); // prints 'Hello World!'
greet('Hello! Does this answer your question?') // prints 'Hello! Does this answer your question?'
Example 2: javascript default function parameter value
function multiply(a, b) {
b = (typeof b !== 'undefined') ? b : 1
return a * b
}