Nope, the title is not an enigma.
I have :
obj = {
NaNException:function(message=''){
this.message=message;
},
input:{
integer:function(a){
var b = prompt(a);
if (isNaN(parseInt(b, 10)))
throw new this.NaNException();
else
return b;
}
}
}
so, in NaNException:function(){ }
, this
is expected to be NaNException
, but in integer
, it is expected to be obj
... which interpretation is the good one? And what can I do with the wrong one to have the expected result ?
Thanks in advance.