This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// http://ejohn.org/apps/learn/#20 | |
// caching results from a js function | |
function isPrime( num ) { | |
var prime = num != 1; // Everything but 1 can be prime | |
if (isPrime.cache[num]) { | |
result = isPrime.cache[num]; | |
} else { | |
for ( var i = 2; i < num; i++ ) { |
NewerOlder