Hello everyone, I just have a quick Javascript question I haven't found an answer to on the net. What is the difference between arrayName[0]
and arrayName.item(0)
I've run across instances of both, but nowhere have I seen the difference between the two.
Thank you,
Jmasta
jmasta
0
Light Poster
Recommended Answers
Jump to PostCurrent best-practice eschews the "new" keyword on Javascript primitives. If you want to create a new Array simply use brackets [] like this...
var myArray = [];
You don't need to tell Javascript how many items to size the Array for. Javascript will automatically increase the size of the …
Jump to PostUsually when you see something like this:
arrayName.item(0)it is referring to something in the DOM, for example:
http://jacksleight.com/blog/2008/01/14/getelementsby/
All 6 Replies
essential
84
Posting Shark
Featured Poster
R0bb0b
344
Posting Shark
jmasta
0
Light Poster
langsor
langsor
jmasta
0
Light Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.