tmp
Thursday, July 14, 2016
arguments in arrow function
アロー関数内だと `arguments` で引数が取得できないので以下で対応する ```javascript function foo() { console.log(arguments) // {"0":"a","1":"b","2":"c"} } const bar = (...args) => { console.log(arguments) // {"0":{}} console.log(args) // ["a","b","c"] } foo('a', 'b', 'c') bar('a', 'b', 'c') ``` * https://developer.mozilla.org/ja/docs/Web/JavaScript/Reference/arrow_functions#Lexical_arguments
No comments:
Post a Comment
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment