|
|||
Just some questions about Javascript
More question about javascript syntax:
1. Should I put else or not? if (tmpWeight <= 0.5) { tmpTotalPrice = '6'; } { tmpTotalPrice = 6 + (parseInt((tmpWeight * 10) - 5)); } if (tmpWeight <= 0.5) { tmpTotalPrice = '6'; } else { tmpTotalPrice = 6 + (parseInt((tmpWeight * 10) - 5)); } 2. Why I see most javascript indention not too readable? the open curly bracket is at the end of the condition like if (tmpWeight <= 0.5) { ... } instead of if (tmpWeight <= 0.5) { ... } 3. Should we put semicolon at the end of the statement? I think put or not put also no difference. 4. if a > 1 and if (a > 1) got difference? I think bracket is being used when we want to prioritise certain condition only or that is a syntax. Just hope to get Javascript more clearer. Thanks. |
|
||||
1. Use else. Without else, the computer will do the unnecessary processing everytime.
2. This is individual preference. I always put the open bracket on the same line to have less lines, shorter page length. 3. I always put semicolon. 4. I always put brackets for if-else condition. Will it always work if we obmit the brackets? No idea, never test before.
__________________
webmaster @ http://kongtechnology.com |
![]() |
«
Previous Thread
|
Next Thread
»
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| May I ask some questions related AdSense? | AngelLee | Revenue and Monetization | 4 | 24-08-2006 06:50 PM |
| Questions on PayPal | stephen | E-Commerce | 4 | 06-09-2005 11:25 PM |
| A few questions regarding mambo & hosting | mfarid | Paid Hosting Discussion Forum | 7 | 09-03-2005 06:19 PM |
| How To Answer TOUGH Interview Questions | Gundam | Mamak Stall | 0 | 20-02-2005 11:58 AM |
| questions on Sound Object in Flash | denian | Website Design | 3 | 31-01-2003 02:47 PM |
All times are GMT +8. The time now is 03:09 PM.
Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO 3.1.0 vBulletin skin by ForumMonkeys.com.
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO 3.1.0 vBulletin skin by ForumMonkeys.com.










Linear Mode

