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

Chapter 8. Working with Objects > Using with() to Shorten Object Expressions

Using with() to Shorten Object Expressions

One of the problems with using objects is that they tend to require quite a bit of typing, much of which is repetitive drudgery. A good example is the document.write() method, which is often used on many lines, as in this example:

document.write("Line 1<br>")
document.write("Line 2<br>")
document.write("Line 3<br>")
document.write("Line 4<br>")
document.write("Line 5<br>")


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


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