06 Feb
by: Matt in Development, JavaScript
tags: JavaScript, prototype, round, rounding
This very simple function does exactly what the title suggests, it allows you to round to any specified accuracy.
function roundTo(number, to) {
return Math.round(number * to) / to;
}
alert(roundTo(1532, 100)); // 1500
alert(roundTo(26, 10)); // 30
If you want to get fancy, you could also modify the Number prototype for a more “integrated” solution.
Number.prototype.roundTo = function(to) {
return Math.round(this * [...]
16 Nov
by: Matt in Development, JavaScript
tags: framework, JavaScript, jquery, prototype
Let me start off by saying I absolutely love Prototype. When a friend showed me how much it helped with writing cross-browser compatible code, I was an instant fan.
Over the years of being a Prototype user I paid close attention to the many posts about why X is a better framework than Y. [...]
WP Cumulus Flash tag cloud by Roy Tanck and Luke Morton requires Flash Player 9 or better.