When the value of variable or property is not defined, it gets the type undefined.
It's handy to see if a variable is passed as an argument of a function.
Are undefined:
let sec;
if (sec === undefined) console.log("The variable sec is not defined");
let sec;
// == and not ===
if (sec == null) console.log("The variable sec is not defined");
if (typeof sec === 'undefined') console.log("The variable sec is not defined");
The question mark means optional and permits declaring that a variable may be undefined.
For instance, if location may be undefined, you can write:
country = location?.getCountry()