Open evantianx opened 6 years ago
const global = (function() { return this })()
hasOwnProperty()
// 缓存 hasOwnProperty 方法 const hasOwn = object.prototype.hasOwnProperty; for (let i in man) { if (hasOwn.call(man, i)) { // do something } }
if (typeof object.prototype.myMethod !== 'function') { object.prototype.myMethod = function() { // do something } }
function getRandomIntInclusive(min, max) { return Math.floor(Math.random() * (max- min + 1) + min) }
获取全局对象
hasOwnProperty()
为对象原型添加方法
获取介于两个整数之间的整数,包括边界