JSFiddle - React, Tailwind, and code Playground
by NickU
JavaScript
let $d = true;
function hasNullOrUndefined() {
const args = arguments;
const argNames = hasNullOrUndefined.caller.toString().match(/function\s.*?\(([^)]*)\)/)[1].split(/\s*,\s*/);
for (let i = 0; i < argNames.length; i++) {
if (i >= args.length || args[i] === undefined || args[i] === null) {
console.log(`Parameter '${argNames[i]}' is ${args[i] === null ? 'null' : 'undefined'}`);
return true;
}
}
return false;
}
function setAbsLeftTop(dstId, left, top) {
if (hasNullOrUndefined.apply( this, arguments )) return false;
return true;
}
console.log( setAbsLeftTop(0,0));