How to declare array of specific type in javascript -


is possible in java script explicitly declare array array of int(or other type)?

something var arr: array(int) nice...

var stronglytypedarray=function(){       this.values=[];       this.push=function(value){       if(value===0||parseint(value)>0) this.values.push(value);       else return;//throw exception      };      this.get=function(index){         return this.values[index]      }    } 

edits: use follows

     var numbers=new stronglytypedarray();      numbers.push(0);      numbers.push(2);      numbers.push(4);      numbers.push(6);      numbers.push(8);      alert(numbers.get(3)); //alerts 6 

Comments

Popular posts from this blog

javascript - How to name a jQuery function to make a browser's back button work? -

python - Django-easy-pdf: xhtml2pdf reporting reportlab 2.2+ is required, but 3.0 installed -

collision detection - C++ library for mesh to mesh intersection: what is available? -