I came across this example in a book that teaches JS. In the lesson he says:
In Internet Explorer, if the popup is blocked, the handle will be undefined instead of null. So to cover all bases, you need to code the function this way.
1 function checkForPopBlocker() {
2 var testPop = window.open("", "","width=100,height=100");
3 if (testPop === null || typeof(testPop === "undefined") {
4 alert("Please disable your popup blocker.");
5 }
6 testPop.close();
7 }
My questions are:
1- Why has he added typeof in line 3?
2- Why adding the quotations marks "" around undefinied?
Why not just coding: if (testPop === null || testPop === undefined)
3- What is the meaning of handle ( I know he means testPop) so what is the general definition of handle?
I will appreciate in-depth explanations with external links.