【发布时间】:2020-02-17 14:13:21
【问题描述】:
在MDN doc for String.prototype.repeat polyfill 中有这行代码:
if (!String.prototype.repeat) {
String.prototype.repeat = function(count) {
'use strict';
if (this == null)
throw new TypeError('can\'t convert ' + this + ' to object');
这怎么可能是空的?
【问题讨论】:
-
请注意,
undefined == null在使用==而不是===进行检查时也是true
标签: javascript polyfills