Javascript | Check If Variable Is Set

Hello You ...
Hope you were able to deal with that car trouble from last week. Aaannyywhoo ... Let's nerd up!
A developer will frequently have to check if a variable is set. This little write up dives a bit into that.
Some server side scripting languages like PHP already have methods to do this for us. But Javascipt does not ...
So we have to find a way to check if a variable is set.
This is how:
<script>
if (typeof var === undefined || var === null) {
// var is not set
}
</script>
"We have to ensure that a variable is both undefined and null"
The Village Geek
We have to ensure that a variable is both undefined
and null
Cape Town, South Africa