js if not undefined

JavaScript
if (typeof myVar !== "undefined") {
    console.log("myVar is DEFINED");
}if(typeof comment === 'undefined') {

  alert('Variable "comment" is undefined.');

} else if(comment === null){

  alert('Variable "comment" is null.');

}if(undefinedElement === null) {
	console.log("Element is undefined");
}
Source

Also in JavaScript: