Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Logging just length in console returns 1

I logged (length) in console and it returned 1. Generally javascript compiler would throw an error like "length is not defined" but here it returned 1, is there any relevance of this default value of length ?

> console.log(length)

  Output: 1

>Solution :

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

window.length returns the number of frames

Read more about Window.length on MDN

Returns the number of frames (either <frame> or <iframe> elements) in the window.

On a (blank) page without such elements it’s expected to return 0, here on this exact StackOverflow page you might expect something like 2

To get more info you might want to use window.frames

Also from the MDN Docs Window.frames:

Window.frames
Returns the window itself, which is an array-like object, listing the direct sub-frames of the current window.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading