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

windows - Single EXE to Install Python Standalone Executable for Easy Distribution -

c# - Access objects in UserControl from MainWindow in WPF -

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