javascript - Defined array value shows as undefined -
i getting following error on console.
uncaught typeerror: cannot read property '1' of undefined
age= 55; array = new array(); array[55] = [8.7, 7.5]; array[56] = [8.9, 7.6]; array[57] = [9, 7.7]; array[58] = [9.2, 7.8]; array[59] = [9.4, 7.9]; array[60] = [9.6, 8]; data = array[age]; console.log( data[0] + " | " + data[1] );
i test code,but doesn't have mistake , output "8.7 | 7.5" correctly.however,when test in strict mode,it has mistake because lack of "var" when define variable.
Comments
Post a Comment