javascript to check if variable empty exists code example
Example 1: javascript check if variable exists
if (typeof myVar !== 'undefined') {
// myVar is defined
}
Example 2: php code to check if variable is null
if(empty($var1)){
echo 'This line is printed, because the $var1 is empty.';
}