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 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/
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/R0bb0b is correct ... item(0) accesses a node-collection
<script type="text/javascript"> arr = []; arr[0] = 'one'; arr['two'] = 3; alert( arr[0] …
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.