Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/396.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 反应继电器教程未定义错误_Javascript_Relayjs - Fatal编程技术网

Javascript 反应继电器教程未定义错误

Javascript 反应继电器教程未定义错误,javascript,relayjs,Javascript,Relayjs,为什么: Uncaught TypeError: undefined is not a function 完成并随后测试教程后显示?您的浏览器可能没有所需的polyfill: 在渲染调用之前,将repeat polyfill添加到app.js中。 来自MDN: if (!String.prototype.repeat) { String.prototype.repeat = function(count) { 'use strict'; if (this == null)

为什么:

 Uncaught TypeError: undefined is not a function

完成并随后测试教程后显示?

您的浏览器可能没有所需的polyfill:

在渲染调用之前,将repeat polyfill添加到app.js中。 来自MDN:

if (!String.prototype.repeat) {
  String.prototype.repeat = function(count) {
    'use strict';
    if (this == null) {
      throw new TypeError('can\'t convert ' + this + ' to object');
    }
    var str = '' + this;
    count = +count;
    if (count != count) {
      count = 0;
    }
    if (count < 0) {
      throw new RangeError('repeat count must be non-negative');
    }
    if (count == Infinity) {
      throw new RangeError('repeat count must be less than infinity');
    }
    count = Math.floor(count);
    if (str.length == 0 || count == 0) {
      return '';
    }
    // Ensuring count is a 31-bit integer allows us to heavily optimize the
    // main part. But anyway, most current (August 2014) browsers can't handle
    // strings 1 << 28 chars or longer, so:
    if (str.length * count >= 1 << 28) {
      throw new RangeError('repeat count must not overflow maximum string size');
    }
    var rpt = '';
    for (;;) {
      if ((count & 1) == 1) {
        rpt += str;
      }
      count >>>= 1;
      if (count == 0) {
        break;
      }
      str += str;
    }
    return rpt;
  }
}
if(!String.prototype.repeat){
String.prototype.repeat=函数(计数){
"严格使用",;
if(this==null){
抛出新的TypeError('无法将'+this+'转换为object');
}
var str=''+这个;
计数=+计数;
如果(计数!=计数){
计数=0;
}
如果(计数<0){
抛出新的RangeError('重复计数必须为非负');
}
如果(计数==无穷大){
抛出新的RangeError('重复计数必须小于无穷大');
}
计数=数学地板(计数);
如果(str.length==0 | | count==0){
返回“”;
}
//确保count为31位整数允许我们对
//但无论如何,大多数当前(2014年8月)的浏览器无法处理
//字符串1=1>>=1;
如果(计数=0){
打破
}
str+=str;
}
返回rpt;
}
}

为了更容易诊断您的问题,请将您写的内容复制到中继游乐场,并在此处发布链接。我只是想把它加在这里给其他遇到同样问题的人。。