LoginSignup
2
0

More than 5 years have passed since last update.

【CoffeeScript】mapの小さなサンプルメモ

Posted at

メモ

JavaScriptの基本↓

Array.prototype.map() - JavaScript | MDN https://developer.mozilla.org/ja/docs/Web/JavaScript/Reference/Global_Objects/Array/map

サンプル

test.coffee
arr = [1,2,3]
console.log arr.map (element) ->
  element * 2
実行結果
[ 2, 4, 6 ]

JavaScript変換後↓

test.js
  arr = [1,2,3]
  console.log(arr.map(function(element) {
    return element * 2;
  }));
2
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
0