How to check if method parameter is passed in javascript
31 July 2022
So, if parameter is not passed we can protect our code from failing with this simple single liner.
function doSomeStuff(isItPost) {
isItPost = typeof isItPost !== 'undefined'? isItPost : false;
console.log(isItPost);
}