What Should I Change The Formula In Javascript?
I am developing a speed reading simulation using HTML5 and JS. But, i could not understand client expectation. I have used the below for the app. OR http://jsfiddle.net/Darious/d
Solution 1:
The only thing i can figure out is this :
boldWords = boldWords < 1 ? 1 : Math.floor(boldWords);
returns 1 in the case described (where boldWords
begins as ~1.67
) , but geussing from your client's wishes, he expects an outcome of 2.
Simply change it to
boldWords = boldWords < 1 ? 1 : Math.round(boldWords);
(or use Math.ceil
, don't know about any further requirements, and if that would fit them)
Post a Comment for "What Should I Change The Formula In Javascript?"