Some interview questions, continually updated .....

console.log(!!" " + !!"" - !!false || "未通过")

String spaces, it is true, the first two exclamation mark after the false true, the result is true true 1

Empty string, no value is false, the first two exclamation mark after the false true, false false result is 0
Two false front exclamation mark, after the false true, false false result is 0
1 + 0 - 0 || "fail" the middle or operator, so there is not a true go back so the result is a
window.a || (window.a = "1")
console.log(window.a)

 Or in front of the operator is false, window.a is undefined, is false, so go backwards assignment is wrong in this question in.

Is that correct, look at the brackets, that is, the first assignment, look at the front of the window.a, window.a is true, get a print. The highest priority parentheses, brackets walk or go operational
To be continued ....

Guess you like

Origin www.cnblogs.com/easth/p/about_interview.html