2015-08-17 66 views
-1

爲什麼:完成,隨後測試教程後陣營中繼教程未定義的錯誤

Uncaught TypeError: undefined is not a function 

說明了什麼?

+0

爲了更容易地診斷您的問題,複製你已經寫進繼電器遊樂場什麼,在這裏發表一個鏈接。 https://facebook.github.io/relay/prototyping/playground.html – steveluscher

+0

只是想在這裏添加它爲其他誰遇到同樣的問題.. – obimod

回答

0

您的瀏覽器可能不具備它所需要的填充工具:

添加重複填充工具到您的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; 
    } 
} 
相關問題