JavaScript Check Value is Undefined
Let's use the strict equality operator to check if the val
is equal to undefined
or not.
The strict equality (===)
operator checks whether its two operands are equal, returning a Boolean result.
let variable1 = undefined;
let variable2 = 'shouts.dev';
const isValUndefined = val => val === undefined;
let result1 = isValUndefined(variable1);
let result2 = isValUndefined(variable2);
console.log(result1); // true
console.log(result2); // false

Md Obydullah
https://shouts.dev/obydul