Skip to content

Instantly share code, notes, and snippets.

@niyazpk
Created December 11, 2011 17:32
Show Gist options
  • Save niyazpk/1461698 to your computer and use it in GitHub Desktop.
Save niyazpk/1461698 to your computer and use it in GitHub Desktop.
if( !Number.prototype.trunc ) {
Number.prototype.trunc = function trunc(number){
return Math[ number >=0 ? 'floor' : 'ceil' ](number);
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment