Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7182579
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T17:47:59+00:00 2026-05-28T17:47:59+00:00

I am learning about DOM collections. The textbook I’m using had the following Javascript

  • 0

I am learning about DOM collections. The textbook I’m using had the following Javascript code for iterating through the elements of the links collection:

var linksList = document.links;
for (var i = 0; i < linksList.length; ++i)
{
    ...
    [code to print links to HTML paragraph]
    ...
}

Just for fun I changed the loop to a for ... in style loop:

for (var i in linksList)

and afterwards noticed that my script was now generating 3 more links than before, and each of them was “undefined.”

1) What are these undefined links, and why are they accounted for in a for ... in loop, but not the loop governed by document.links.length? (obviously length is 3 shorter than “true” length which includes the 3 mystery links)

2) How do I view collection using developer tools? If I could do this, perhaps I could answer the previous question myself.

Thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T17:48:00+00:00Added an answer on May 28, 2026 at 5:48 pm

    Actually, document.links returns an array-like object, that while providing length property and supporting indexing, has other properties, that show up in for in loop.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

learning about loops (still a beginner) in VB.net. I have got the below code
I'm just learning about JPA and session beans. I've worked through a simple database
I'm currently learning about concurrency in C++ and came across using a vector of
After learning about how to print out debug messages using Visual Studio's Tracepoint feature,
I'm interested in learning about the available choices of high-quality, stand-alone source code formatters
I am learning about asp.net security pattern and practices. I got a code to
I'm learning about the registration of a kernel module using register_chrdev_region(dev_t from, unsigned count,
Learning about OAuth, I came across a big question. How to call a JavaScript
I've been learning about encapsulation in AS3 and using get/set functions to make variables
After learning about the Action delegate in C# I've been looking for ways I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.