Recently, I’ve published an article here about the modular operator, and its defect. I’m not quite sure if the content is  hundred pro cents right, though. The previous post was about an encryption in Java Script, where I’ve used a certain function to get the modulo.

Number.prototype.mod = function(n) {
return ((this%n)+n)%n;
}

The prototype above is solving the entire problem. By writing a number, ex, “5.mod(3)” you will perform an modular operation 5 mod 3. The code itself is from http://javascript.about.com/od/problemsolving/a/modulobug.htm where you also might read more about that particular issue.

To see the code in work, please view this example: http://editor.clizware.net/?id=7