JSFiddle - React, Tailwind, and code Playground

by ysuper

HTML

<h3>
箭頭函式(Arrow Functions)是ES6標準中,最受歡迎的一種新語法。
</h3>
<a href="https://eyesofkids.gitbooks.io/javascript-start-from-es6/content/part4/arrow_function.html" target="_blank">箭頭函式</a>

<pre>
一個簡單的範例是:
const func = (x) => x + 1

相當於
const func = function (x) { return x + 1 }
</pre>

JavaScript

const funcA = x => x + 1
const funcB = x => { x + 1 }
const funcC = x => { return x + 1 }

console.log(funcA(1)) // 2
console.log(funcB(1)) // undefined
console.log(funcC(1)) // 2