スクリプト:配列の不具合

Issue #1186 closed
Ito Mitsuhiro repo owner created an issue

スクリプトで奇妙な挙動に遭遇したので報告します。
おそらくスクリプトエンジン(JINT)側の不具合かと思われますが、念のためお伝えしておきます。

・要素数が10240以上の配列に対して slice() メソッドを使うと、先頭要素以外の値が null になる
(マジックナンバーの 10240 は 1024 * 10 に由来??)

例:

Array(10239).fill('a').slice(0,5); // OK ["a", "a", "a", "a", "a"]

Array(10240).fill('a').slice(0,5); // FAIL ["a", null, null, null, null]

const test = Array(10240).fill('a');
test.length = 5;
test; // OK ["a", "a", "a", "a", "a"]
test.slice(0); // FAIL ["a", null, null, null, null]

Comments (3)

  1. Ito Mitsuhiro reporter

    最新版 (3.0.0-beta-2037) での正常動作を確認

    バージョンの更新を検討

  2. Log in to comment