[ Web Proxy ]
URL:
Viewing: https://developer.mozilla.org/ja/docs/Web/JavaScript/Reference/Errors/Negative_repetition_count [Back]  [Original]

RangeError: repeat count must be non-negative - JavaScript | MDN

MDN Web Docs

View in English Always switch to English

RangeError: repeat count must be non-negative

JavaScript "repeat count must be non-negative" String.prototype.repeat() count

js
RangeError: argument out of range
RangeError: repeat count must be non-negative (Firefox)
RangeError: Invalid count value (Chrome)

RangeError

String.prototype.repeat() count 0 Infinity [0, +)

js
"abc".repeat(-1); // RangeError

js
"abc".repeat(0); // ''
"abc".repeat(1); // 'abc'
"abc".repeat(2); // 'abcabc'
"abc".repeat(3.5); // 'abcabcabc' (count )


Web Proxy Viewer  |  New URL  |  Original Page