Created
November 28, 2014 11:13
-
-
Save kkoziarski/c71cc9d0ef73f06b2948 to your computer and use it in GitHub Desktop.
Number.integer - The Good Parts
This file contains hidden or 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
//returns only integer parts | |
Number.method('integer', function ( ) { | |
return Math[this < 0 ? 'ceiling' : 'floor'](this); | |
}); | |
document.writeln((-10 / 3).integer( )); // -3 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment