Skip to content

Instantly share code, notes, and snippets.

@think2011
Last active October 22, 2015 10:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save think2011/85f158bc560e2bdc9653 to your computer and use it in GitHub Desktop.
Save think2011/85f158bc560e2bdc9653 to your computer and use it in GitHub Desktop.
转换为整数
/**
* 转换为整数
* @returns {this}
*/
Number.prototype.toInt = function () {
return isNaN(this) ? 0 : parseInt(this);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment