# [JavaScript] Function ###### tags: `JavaScript` - **表達敘述** ```javascript function name(num1, num2) { num1 + num2 } ; //此function可以先使用再宣告 var name = function (num1, num2) { num1 + num2 } ; //此function不可以先使用再宣告 ``` - **this** 存在於該區域的xxx - **箭頭函數** ```javascript //原始function寫法 const plus5 = function ( num ){ return num + 5 }; //單一參數可省略括號 const plus5 = num => { return num + 5 }; //兩個參數必須要括號 const plus5 = ( num1, num2 ) => { return num1 + num2 }; //兩個參數的另一種精簡寫法 const plus5 = ( num1, num2 ) => num1 + num2; ``` - **事件冒泡** Bubbling - event.target - currentTarget = this
×
Sign in
Email
Password
Forgot password
or
By clicking below, you agree to our
terms of service
.
Sign in via Facebook
Sign in via Twitter
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
New to HackMD?
Sign up