• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

Chapter 3. Language Essentials > Using For/In Loops

Using For/In Loops

(Netscape and Internet Explorer/Mac)

The previous example shows how to use JavaScript to write with a loop, but the way it's written demands that you know in advance the names of the objects you'll be displaying. Unfortunately, that's not always the case. In Script 3.4, we use the for/in loop construction to display whatever the object's properties happen to be. The for/in loop checks for all the properties in a specified object.

Script 3.4. This type of loop allows you to display objects when you don't even know what they are.



PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint