0

What's the difference between these two line of code?

number = window.number|5;

vs

number = window.number||5;

They both work as intended, but I am unsure the exact meaning of | vs || in these cases. Is there a chance that one would failed over the other?

The idea is to go like this when I am unsure if the page has loaded jQuery or not.

window.jQuery = window.jQuery|loadJquery();
Noobit
  • 386
  • 2
  • 8

0 Answers0