XOR and XNOR Implementation Using JavaScript

Avatar of Nitin Pratap
XOR gate and Truth Table
XOR gate and Truth Table

XOR Implementation:

Conceptual representation of XOR using Truth Table:
A XOR B = O/P
T XOR T = F
F XOR T = T
T XOR F = T
F XOR F = F

JavaScript Implementation:

Solution: Boolean(A ^ B)
Alternate: (A || B) && (!A || !B)


XNOR Implementation:

Conceptual representation of XNOR using Truth Table:
A XNOR B = O/P
T XNOR T = T
F XNOR T = F
T XNOR F = F
F XNOR F = T

JavaScript Implementation:

Solution: Boolean(!(A ^ B))
Alternate: (A && B) || (!A && !B)

Total
0
Shares
1 comment

Comments are closed.

Previous Post
Ramanand Sagar

Ramanand Sagar

Next Post
Breast Cancer: Protect Yourself from This Serious Disease with These Food Items.

Breast Cancer: Protect Yourself from This Serious Disease with These Food Items.

Related Posts
Outfit Ideas for Girls Best Street Foods in Chennai Apart from Idli Dosa Laddu Gopal Winter Dresses Kalibadis to Visit in Delhi this Durga Puja Sawan Mehndi Design