JSFiddle - React, Tailwind, and code Playground

JavaScript

function wacky(p1, undefined)
{
    if (p1 === undefined)
        window.alert('undef');
    else
        window.alert('not undef');
}

function wacky2(p1)
{
    var spam;
    window.alert(undefined); // see what it is before you set it.
    undefined = spam;

    if (p1 === undefined)
        window.alert('undef');
    else
        window.alert('not undef');
}

var var1;
// var1 is undefined. It works.
wacky(var1); // undef

// Now you have a truthy value saying it's undefined.
// Wack.
wacky("spam", "spam");  // undef?

// Just to round out possibilities -- now
// truthy is not truthy.
wacky("spam", "not spam");  // not undef?

undefined = "spam";
window.alert(undefined);
wacky2(var1); // undef
wacky2("spam", "spam");  // not undef
wacky2("spam", "not spam");  // not undef
window.alert(undefined);