JavaScript

  1. Home
  2. Computing & Technology
  3. JavaScript

With

By Stephen Chapman, About.com

Definition: The with statement allows you to leave the object name off of the front of all of the property and method references within a block of code. All of the references within the block will be assumed to be properties or methods of the object specified in the with statement. This will make all of the code shorter than it would be if you had to add the object name to all of the references. With is a reserved word and cannot be used for anything other than creating a with block.
Examples: with myobject {...}

Explore JavaScript

About.com Special Features

Build Your Own Website

Step-by-step advice on how to do everything from choosing a Web host to promoting your content. More >

Connect Your Home Computers

Easy ways to connect two computers for networking purposes. More >

JavaScript

  1. Home
  2. Computing & Technology
  3. JavaScript
  4. Reference
  5. Javascript Glossary - With

©2009 About.com, a part of The New York Times Company.

All rights reserved.