Q:

Write a JavaScript program to get the first non-null / undefined argument

0

Write a JavaScript program to get the first non-null / undefined argument.

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

const coalesce = (...args) => args.find(_ => ![undefined, null].includes(_));
console.log(coalesce(null, undefined, '', NaN, 'abcd'));

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Similar questions


need a help?


find thousands of online teachers now