ractivejs/v0.x

error in the tutorial

dylan-shao opened this issue · 1 comments

There is a function error in the tutorial : http://learn.ractivejs.org/expressions/1 , which the 'format' function for the third 'case num>1000' is wrong, suppose the 'population = 2000', it will output '2,0'.

Code:
error code: 'if ( num > 1000 ) return ( Math.floor( num / 1000 ) ) + ',' + ( num % 1000 );'
It may work in this way: 'if ( num >= 1000 ) return ( Math.floor( num / 1000 ) ) + ',' + ( String.prototype.slice.call(num,-3) );'

Learn site no longer used. Current documentation now has a Get Started section with updated examples https://ractive.js.org/