Hello all I am working in javascript and html5.I want to ask that how can we add an array as a data member of a class in javascript
I have written a code
var bm = new Bitmap(img); //It is a built in class of some library
/*Here what I want is to associate an array with object of bitmap*/
/* what i did is */
var lpr = new Array();
bm.lpr[0]= "xyz" ;
bm.lpr[1]= "pqr" ;
but when I displayed the array.
alert(bm.lpr[0]);
I got the error
Uncaught TypeError: Cannot set property ‘0’ of undefined
can any one please tell me the correct way of doing it.Also my array will be update at run time
Thanks
You only have to change one line: