Click here to Skip to main content
15,914,373 members
Home / Discussions / JavaScript
   

JavaScript

 
GeneralHere's a bit of old code I dug up... Pin
NeverHeardOfMe3-Oct-10 5:59
NeverHeardOfMe3-Oct-10 5:59 
GeneralRe: Here's a bit of old code I dug up... Pin
Paul Hayman3-Oct-10 8:01
Paul Hayman3-Oct-10 8:01 
GeneralRe: Here's a bit of old code I dug up... Pin
NeverHeardOfMe3-Oct-10 10:34
NeverHeardOfMe3-Oct-10 10:34 
Questionfind the mistake Pin
yumss1-Oct-10 1:22
yumss1-Oct-10 1:22 
AnswerRe: find the mistake Pin
Pete O'Hanlon1-Oct-10 1:46
mvePete O'Hanlon1-Oct-10 1:46 
GeneralRe: find the mistake Pin
NeverHeardOfMe1-Oct-10 3:20
NeverHeardOfMe1-Oct-10 3:20 
AnswerRe: find the mistake Pin
Stryder_11-Oct-10 3:25
Stryder_11-Oct-10 3:25 
AnswerRe: find the mistake Pin
W Balboos, GHB6-Oct-10 10:02
W Balboos, GHB6-Oct-10 10:02 
Since you've already gotten some answers, I'll just point out a few items that may improve your coding. These are general solutions - the can be language and implementation specific.

For conversion to %, you'd (potentially) improve your accuracy by multiplying by 100 before dividing by 500. This is true if the math is done as integer math. The first division, by 500, will truncate values, which, when you multiply them, will be lost data. Although this is negligible in the this exact case, it can cause problems when the calculations aren't quite so clean. It is often the case (for floating point calcs) that multiplication by 0.1 is faster than division by 10.0.

Your many write() statements could be, perhaps, changed to assignments to a string, with only a single print statement. You could take it a step further and even simply assign a single letter to the string and use a formatted write() statement. Assignments are usually easier to understand (and have less internal overhead) than function calls. Again, you code is simple, but this could become a consideration as you create more complex apps. This also might be a matter of taste.
"The difference between genius and stupidity is that genius has its limits." - Albert Einstein
"As far as we know, our computer has never had an undetected error." - Weisert
"If you are searching for perfection in others, then you seek dissappointment. If you are searching for perfection in yourself, then you seek failure." - Balboos HaGadol Mar 2010

Questionbrowser display problem Pin
annie_bel29-Sep-10 23:32
annie_bel29-Sep-10 23:32 
AnswerRe: browser display problem Pin
Gerben Jongerius30-Sep-10 2:24
Gerben Jongerius30-Sep-10 2:24 
Questionadd new cell by pressing tab button Pin
annie_bel29-Sep-10 0:20
annie_bel29-Sep-10 0:20 
AnswerRe: add new cell by pressing tab button Pin
Pete O'Hanlon29-Sep-10 1:10
mvePete O'Hanlon29-Sep-10 1:10 
GeneralRe: add new cell by pressing tab button Pin
annie_bel29-Sep-10 1:30
annie_bel29-Sep-10 1:30 
Questionwindow.status Pin
hotthoughtguy28-Sep-10 6:31
hotthoughtguy28-Sep-10 6:31 
AnswerRe: window.status Pin
hotthoughtguy28-Sep-10 6:32
hotthoughtguy28-Sep-10 6:32 
AnswerRe: window.status Pin
Dr.Walt Fair, PE28-Sep-10 9:36
professionalDr.Walt Fair, PE28-Sep-10 9:36 
GeneralRe: window.status Pin
jimbo809830-Sep-10 3:34
jimbo809830-Sep-10 3:34 
AnswerRe: window.status Pin
Sunasara Imdadhusen21-Oct-10 2:34
professionalSunasara Imdadhusen21-Oct-10 2:34 
Questionis there any mistake in code Pin
hotthoughtguy28-Sep-10 4:02
hotthoughtguy28-Sep-10 4:02 
AnswerRe: is there any mistake in code Pin
NeverHeardOfMe28-Sep-10 4:44
NeverHeardOfMe28-Sep-10 4:44 
AnswerRe: is there any mistake in code Pin
Richard MacCutchan28-Sep-10 4:46
mveRichard MacCutchan28-Sep-10 4:46 
GeneralRe: is there any mistake in code Pin
hotthoughtguy28-Sep-10 4:53
hotthoughtguy28-Sep-10 4:53 
QuestionCapturing a function Pin
Vodstok24-Sep-10 4:08
Vodstok24-Sep-10 4:08 
AnswerRe: Capturing a function Pin
Not Active24-Sep-10 4:34
mentorNot Active24-Sep-10 4:34 
GeneralRe: Capturing a function Pin
Vodstok24-Sep-10 4:40
Vodstok24-Sep-10 4:40 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.