Periksa baik definisi atau tidak terdefinisi dalam javascript
if (typeof variable !== 'undefined' || typeof variable ==='undefined') {
//the variable is either defined or not defined
//in both conditions the code will be executed
}
Jaimin Patel