my problem Confined to missing a value of a variables
users can put values of this vars
var name = "name";
var age = "age";
var sex = "sex";
var weight = "weight";
if one variable is not defined ,it make all script stop what's the best ways to avoid this error have atrying with
switch (variable){
default:
//codes
breake;
}
or
switch (variable){
case undefined: //codes
breake;
}
or
if(typeof variable==='undefined'){
//do that
}
need to more Tips and Advice in this cases Especially if we have big code blocks ..please share your experience for intermediate learner
Aucun commentaire:
Enregistrer un commentaire