JavaScript Javascript comparison logic - let a = 1 . a === (3 || 1 ) false, why?

I've tried to use this comparison statement and was almost sure that's gonna work, but it's not. Could you explain why ?

let a = 1 
a === ( 1 || 3 ) // true 
a === ( 3 || 1 ) // false 

Thanks for responses :)

Answer:1

I think the comparison you're looking for is actually:

let a = 1 
a === 1 || a === 3  // true
Answer:2

I have the following html setup and cannot solve this issue. When a button in the html document gets clicked, an element <div id='wrapper'> <input id='fileUpload' name='fileUpload' ...

I have the following html setup and cannot solve this issue. When a button in the html document gets clicked, an element <div id='wrapper'> <input id='fileUpload' name='fileUpload' ...

  1. javascript call function later
  2. javascript run function later
  3. javascript execute function later
  4. javascript call function defined later

So I have a css grid layout with "boxes" inside, that I filter with a text input and javascript. How can I hide the filtered out elements so that they don't even take up space within the grid (so the ...

So I have a css grid layout with "boxes" inside, that I filter with a text input and javascript. How can I hide the filtered out elements so that they don't even take up space within the grid (so the ...

I want to generate HTML-code at the beginning of an existing element. This is the existing HTML-element: <div id="container"> <p>end of the element</p> </div> With my ...

I want to generate HTML-code at the beginning of an existing element. This is the existing HTML-element: <div id="container"> <p>end of the element</p> </div> With my ...

I need to discover the function 'foo' on class Something and it doesn't work. Is this because I am missing a subtlety of using class syntax or because of babel or something else? I would prefer to use ...

I need to discover the function 'foo' on class Something and it doesn't work. Is this because I am missing a subtlety of using class syntax or because of babel or something else? I would prefer to use ...

  1. javascript functions class
  2. private functions javascript class
  3. static functions javascript class
  4. functions inside javascript class
  5. anonymous functions javascript classes
  6. javascript functions first class objects
  7. javascript functions first class
  8. object function class javascript
  9. prototype function class javascript
  10. nested functions class javascript
  11. javascript functions as first class citizens
  12. arrow functions in javascript class
  13. import function into javascript class