Welcome To Snipplr


Everyone's Recent JavaScript Snippets Tagged math



« Prev 1 Next »
Brendan Eich is working on officially adding Math.TAU to JavaScript. Until JavaScript has full support for the Math.TAU constant, you can add the following at the start of your programs to add support for the TAU constant.
0 785 posted 10 years ago by pmw57
This function will return the sum of the characters making up a number. For example, summate(321) will return 6. summate(123) will also return 6, because both 123 and 321 are made out of the same characters. Supports integers of any length, but only...
0 1041 posted 11 years ago by Salamandern
Clever usage of apply allows you to use built-ins functions for some tasks that otherwise probably would have been written by looping over the array values. As an example here we are going to use Math.max/Math.min to find out the maximum/minimum valu...
0 1322 posted 12 years ago by hellowouter
Don't forget to include jQuery validation plugin before this snippet. You can find it here: http://bassistance.de/jquery-plugins/jquery-plugin-validation/
0 1279 posted 13 years ago by racl101
Returns an array of all the prime numbers up to (n) using an implementation of the Sieve of Eratosthenes.
0 650 posted 14 years ago by pmigueld
0 945 posted 14 years ago by magicrebirth
see website for all information about that. some more theory: [color-scaling-function](http://stackoverflow.com/questions/168838/color-scaling-function) [generate-color-for-a-power-meter-red-to-green](http://stackoverflow.com/questions/340209/gene...
0 1079 posted 15 years ago by localhorst
0 887 posted 16 years ago by arcturus
« Prev 1 Next »