# DAY20- JavaScript 21. 布林值是什麼? ### 布林 / boolean - 布林,是用來判斷正確與否的變數 簡單來說,不是 `true` 就是 `false` - 簡易範例如下: 宣告一個變數,假設小明肚子很餓,我們就設定 `true` ``` // 小明餓嗎? // :小明現在肚子很餓 let hungry = true; console.log(hungry); // true ``` - 使用 typeof 查詢型別,也可以得知該變數為 `boolean` ``` console.log(typeof hungry); // boolean ``` ###### 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