

- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Is there a & logical operator in JavaScript?
No, the single & is a bitwise AND operator in JavaScript. The AND gives the result 1 when both inputs are 1 otherwise 0.
Example
var firstValue=5; var secondValue=4; var result=firstValue & secondValue; console.log(result);
To run the above program, you need to use the following command −
node fileName.js.
Here, my file name is demo172.js.
Output
This will produce the following output −
PS C:\Users\Amit\javascript-code> node demo172.js 4
The value 5 has the binary 101 and 4 has 100.
5= 1 0 1 4= & 1 0 0 -------------------- 1 0 0 which is again 4. ---------------------
- Related Questions & Answers
- What is Logical AND Operator (&&) in JavaScript?
- What is Logical NOT Operator (!) in JavaScript?
- What is Logical OR Operator (||) in JavaScript?
- Is there a “null coalescing” operator in JavaScript?
- UPDATE with logical AND operator in MySQL
- Logical Operator in Dart Programming
- Is there a “not equal” operator in Python?
- Explain about logical not(!) operator in detail with example in javascript?
- Explain the concept of logical and assignment operator in C language
- Is there a Boolean Typed Array in JavaScript?
- What is JavaScript Bitwise AND (&) Operator?
- What is Bitwise AND Operator (&) in JavaScript?
- What is a ternary operator (?:) in JavaScript?
- What is increment (++) operator in JavaScript?
- What is decrement (--) operator in JavaScript?
Advertisements