パスワードを忘れた? アカウント作成
15689820 journal
日記

yuuka_maniaの日記: ... three dot in Javascript 2

日記 by yuuka_mania

関数宣言での、 ... は、 rest parameters というらしい。

% node
Welcome to Node.js v16.13.0.
Type ".help" for more information.
> function x(args) {
... console.dir(args);
... }
undefined
> function xx(...args) {
... console.dir(args);
... }
undefined
> x(1, 2, 3);
1
undefined
> xx(1, 2, 3);
[ 1, 2, 3 ]
undefined
>

この議論は賞味期限が切れたので、アーカイブ化されています。 新たにコメントを付けることはできません。
  • by Anonymous Coward on 2022年06月06日 18時37分 (#4263453)

    それ以外の場所に現れる...はスプレッド構文という。これとかPerlの記号の意味とか、名前知らないと検索で詰むやつ勘弁してほしい

    • by Anonymous Coward

      パイソンの可変長引数とか可変長名前付き引数もそんな感じですね。

typodupeerror

犯人はmoriwaka -- Anonymous Coward

読み込み中...