Basically, || operator stands for logical OR.
So, it will return as -1. Whereas, if it was something like this:
var test = 0 || false || undefined || "" || 2 || -1
Then, it will return 2.
I hope this will help.
Want to become a Java Expert? Join Java Certification now!!
Want to know more about Java? Watch this video on Java Tutorial for Beginners | Java Programming: