I'm trying to get a stored number in the device's memory and parse it to integer using the method Integer.parseInt.
win:function(){
this.reset();
if(Integer.parseInt(window.localStorage.getItem("curLevel"))<this.levelNo)
{
window.localStorage.setItem("curLevel", this.levelNo+1);
renderAllLevels();
}
$.mobile.pageContainer.pagecontainer("change", "#winlevel");
}
But when the function win is called I recieve the error Uncaught ReferenceError: Integer is not defined.
I used Integer.parseInt in other lines in my project and it worked without any error.
What is the potential error in using it here?
parseIntis a global function. There's no global object calledInteger. If it wasn't causing errors before, it was probably in a different language.<comparison you don't really have to parse it, if one side is a number, the other is treated as a number