/ Published in: JavaScript
/* if (globalVariable) {
But this wouldn't work. That code is actually checking to see if the defined variable globalVariable has a null value. If the variable has not been defined, that code will cause an error.
Instead, here is the code that will check for the presence of a global variable:
*/
if (window.globalVariable) {
But this wouldn't work. That code is actually checking to see if the defined variable globalVariable has a null value. If the variable has not been defined, that code will cause an error.
Instead, here is the code that will check for the presence of a global variable:
*/
if (window.globalVariable) {
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
/* if (globalVariable) { But this wouldn't work. That code is actually checking to see if the defined variable globalVariable has a null value. If the variable has not been defined, that code will cause an error. Instead, here is the code that will check for the presence of a global variable: */ if (window.globalVariable) {
URL: http://www.breakingpar.com/bkp/home.nsf/0/87256B14007C5C6A87256B260052B40B