0

Why the below code won't execute!??it was written in w3schools and working well!!!

var names = new array("jenifer", "alex", "susan"); document.write(names[0]);

22nd Feb 2017, 8:44 AM
Seyed Ebrahim Khadem
Seyed Ebrahim Khadem - avatar
7 Respuestas
+ 3
array and Array are not same in javascript. it is case sensitive. fix it..working fine.
22nd Feb 2017, 9:22 AM
Raj Kumar Chauhan
Raj Kumar Chauhan - avatar
+ 1
is it not working in code playground?
22nd Feb 2017, 9:08 AM
Raj Kumar Chauhan
Raj Kumar Chauhan - avatar
+ 1
write Array
22nd Feb 2017, 9:17 AM
Raj Kumar Chauhan
Raj Kumar Chauhan - avatar
22nd Feb 2017, 9:20 AM
Raj Kumar Chauhan
Raj Kumar Chauhan - avatar
+ 1
var names = new Array("jenifer", "alex", "susan"); document.write(names[0]); raj Kumar is right you need to change array to Array
22nd Feb 2017, 9:24 AM
elhuus
+ 1
First: js is case-sensitive so "new Array". Second: eval is evil here) document.write writes here after the page is "completed". This code (see the First) gonna work in browser in tags script, but u cannot execute it on loaded page as a function
22nd Feb 2017, 9:38 AM
Art Stesh
Art Stesh - avatar
0
raj kumar chauhan no it doesn't
22nd Feb 2017, 9:11 AM
Seyed Ebrahim Khadem
Seyed Ebrahim Khadem - avatar