javascript エラー「RangeError: Arguments contain a value that is out of range of code points」の解決方法
- 2022.04.30
- javascript
- javascript

javascriptで、エラー「RangeError: Arguments contain a value that is out of range of code points」が発生した場合の原因と解決方法を記述してます。
環境
- OS macOS Big Sur
- ブラウザ safari 15.0
エラー内容
以下のコードで発生。
String.fromCodePoint(-1)
エラーメッセージ
RangeError: Arguments contain a value that is out of range of code points
画像

原因
「fromCodePoint」に使用できる「Unicodeコードポイント」ではないため
解決方法
使用できる「Unicodeコードポイント」にする
console.log(
String.fromCodePoint(97) // a
)
-
前の記事
jquery マウスオーバーにより画像を切り替える 2022.04.29
-
次の記事
jquery 画像を幅と高さを取得して変更する 2022.04.30
コメントを書く