Go Back   CP Web Hosting - reseller hosting > Browser Scripting, HTML, XML and Multimedia > JavaScript
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 07-11-2007, 08:36 AM
Senior Member
 
Join Date: May 2007
Posts: 908
Default Although Javascript does not force you to declare or initialize variables

Although Javascript does not force you to declare or initialize variables before you begin function statements, it is often very useful to do so. First, it allows you to document the purpose of each variable. This is not only good programming practice, it is also genuinely useful.
Reply With Quote
  #2 (permalink)  
Old 07-11-2007, 08:37 AM
Senior Member
 
Join Date: May 2007
Posts: 951
Default

When you return to a function six months after you wrote it you may not remember what the variable countme does, unless you explicitly document it as // array index variable. Second, if you explicitly declare each variable, then you have the opportunity to initialize them to some meaningful default value.
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT. The time now is 08:01 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.1.0