Roll20 uses cookies to improve your experience on our site. Cookies enable you to enjoy certain features, social sharing functionality, and tailor message and display ads to your interests on our site and others. They also help us understand how our site is being used. By continuing to use our site, you consent to our use of cookies. Update your cookie preferences .
×
Create a free account

arguments of parseFloat?

1445769049

Edited 1445769158
WurmD
KS Backer
parseFloat(o.get('bar1_value'),10) in totals = _.reduce(findObjs({ pageid: page, type: 'graphic', isdrawing: false, layer: 'objects' }),function(m,o){ m.bar1+=parseFloat(o.get('bar1_value'),10) || 0; m.bar2+=parseFloat(o.get('bar2_value'),10) || 0; m.bar3+=parseFloat(o.get('bar3_value'),10) || 0; return m; },{ bar1: 0, bar2: 0, bar3: 0 }); what's that second argument for parseFloat? The maximum number of characters in the string that are parsed?
1445773995

Edited 1445774028
It's an error, which happens to work out because of the way Javascript handles function arguments (specifically, because it ignores extra arguments).  Presumably, the author either converted from parseInt to parseFloat at some point without fixing up the arguments or thought that parseFloat takes the same arguments as parseInt (which accepts a radix as an optional second argument).
Cool thanks :D
1445776590
The Aaron
Pro
API Scripter
A bit of both. :). Strange that it doesn't take a radix, you'd think it would mirror parseInt().