变量命名规则

  1. A var a%=20;
  2. B var 1a=20;
  3. C var _a=40;
  4. D var $a=30;

算数运算

  1. var a = "21" + 4 - true + "3";
  2. console.log(a);
  3. var x = "2" + 3 + 4 + false;
  4. console.log(x);
  5. console.log(10 + '1' + true);
  6. console.log(Number(10) + Number('1') + Number(true))

逻辑判断

  1. var a = 10 && 20;
  2. console.log(a);
  3. var num = 20 || 30;
  4. console.log(num);
  5. var t = 0 || 20;
  6. console.log(t);
  7. var s = 0 && 30;
  8. console.log(s);
  9. var b = 0 ||"abc";
  10. var c = "abc" || 1;
  11. var d = 0 || NaN;
  12. console.log(a, b ,c);
  13. console.log(""||"abc");
  14. console.log(0 == '');
  15. console.log(10 > "")
  16. console.log(10 > Number(""))
  17. console.log(10 < true)
  18. console.log(10 < Number(true))
  19. console.log(10 && 20)
  20. console.log(10 || 20)
  21. console.log(0 || 2)
  22. console.log(2 || 3)
  23. console.log(0 && 3)
  24. console.log(2 && 0)
  25. console.log(0 == '');
  26. console.log(0 == undefined);
  27. console.log(null == 0);
  28. console.log(null == '');
  29. console.log(null == undefined);
  30. console.log(null == NaN);

++a a++

  1. var a = 10;
  2. a++;
  3. var b = ++a + 2;
  4. var c = ++b + a++ + 4;
  5. console.log(a);
  6. console.log(b);
  7. console.log(c);