0

What's the difference between the & and && in Vue.js?

I test the:

<span
  v-if="1 > 0 & 2 > 1"
>
  span
</span>

and

<span
  v-if="1 > 0 && 2 > 1"
>
  span
</span>

both the text span will show.

So is there some difference between them in Vue.js?

sof-03
  • 2,255
  • 4
  • 15
  • 33

1 Answers1

-1

They have the same type of logic. 0101 & 1010 = 0000. However && will not valuate the second one if the first on is false, it will always consider the second one true..

try this

<span
  v-if="1 > 3 && 2 > 3"
>
  span
</span>
Mhmd Zawi
  • 167
  • 1
  • 11