摘要: Function.prototype.myCall = function (context, ...args) { if (typeof this !== 'function') { throw new TypeError('error'); } context.fn = this; let res 阅读全文
posted @ 2021-09-28 16:49 龚小航 阅读(31) 评论(0) 推荐(0)
摘要: 有3个函数可以将非数值转换为数值: Number()、parseInt()和parseFloat()。Number()是转型函数,可用于任何数据类型。 后两个函数主要用于将字符串转换为数值。对于同样的参数,这3个函数执行的操作也不同。 Number()函数基于如下规则执行转换。 ❑ 布尔值,true 阅读全文
posted @ 2021-08-24 16:58 龚小航 阅读(231) 评论(0) 推荐(0)