1 <!DOCTYPE html> 2 <html lang="en"> 3 <head> 4 <meta charset="UTF-8"> 5 <meta name="viewport" content="width=device-width, initial-scale=1.0"> 6 <meta http-equiv="X-UA-Compatible" content="ie=edge"> 7 <title>javascript逻辑或</title> 9<! -8 Logical OR (||) personal understanding: 10 Prerequisites: . 11 - Logical or decision sequence: from left to right; 12 is - as long as it is no longer true encountered down directly returns a true value of the first; 13 is - in before she encountered, would have been down the judgment, if the last one is false / null / undefined / NaN, it returns the last false / null / undefined / NaN values of 14 number 1) operations are boolean, 15 1 true / multi true / all true: returns to true 16 full false: returns to false . 17 number 2) is operated as a multi-mixed type (expression, and other Boolean type) 18 is 1 in real / real multiple / all true: returns a true value of 19 full false / null / undefined / NaN: returns the last value 20 is -> 21 is </ head > 22 is < body > 23 is < Script> 24 var A = . 1 , B = " 2 " , C = 0 , D = " ABC " , E = "" , F, G = A - D; 25 / * Logical OR: bool * / 26 is the console.log ((ab & ) || (A - ABC)); // -1, ab & true, the determination is no longer down 27 the console.log (A > 10 || A < 10 ); // true, A> 10 false, a <10 true true true returns 1 28 / * Logical OR: Mixed * / 29 the console.log (C || A || B || D); // . 1, a first return true. 1 = A 30 the console.log (C || E || null || undefined || G); // NaN3, false returns the last full prosthesis 31 is </ Script > 32 </ body > 33 is </ HTML >