如果兩個(gè)位都是1,則使用位與(&)運(yùn)算符時(shí)返回1。
示例
您可以嘗試運(yùn)行以下代碼來學(xué)習(xí)如何使用JavaScript位與運(yùn)算符 ?
<!DOCTYPE html>
<html>
<body>
<script>
document.write("Bitwise AND Operator<br>");
// 7 = 00000000000000000000000000000111
// 1 = 00000000000000000000000000000001
document.write(7 & 1);
</script>
</body>
</html>
登錄后復(fù)制
以上就是JavaScript位與(&)運(yùn)算符是什么?的詳細(xì)內(nèi)容,更多請(qǐng)關(guān)注www.92cms.cn其它相關(guān)文章!






