# DAY18 - JavaScript 11. number 賦值運算子,加減法。 ### 如何使用 JavaScript 來實現加(+)減(-)法? - 假設宣告一個變數: ``` let a = 10; ``` ### 加法 += - 我想幫這筆變數 `+5` ``` // 加法 += a += 5; // 在用 console.log 查詢: - 15 ``` ### 減髮 -= - 我想幫這筆數值在 `-10` ``` // 減法 -= a -= 10; // 在用 console.log 查詢: - 5 ``` ### 歷程: ``` 宣告變數 a = 10 +5 = 15 再 -10 = 5 最終數值為:5 ``` ###### tags: `Re:0 前端工程師之路 - JavaScript 初級 篇章`
×
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