1-1

  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. console.log(10 && 20)
  10. console.log(10 || 0)
  11. console.log(0 || 2)
  12. console.log(2 || 3)
  13. console.log(0 && 3)
  14. console.log(2 && 0)
  15. console.log(0 || NaN)
  1. var b = 0 ||"abc";
  2. var c = "abc" || 1;
  3. var d = 0 || NaN;
  1. var a = "21"+4-true+"3"
  1. var a = 10;
  2. a++;
  3. b = ++a + 2;
  4. c = ++b + a++ + 4;
  5. console.log(a);
  6. console.log(b);
  7. console.log(c);

1-2

  1. //下面那些符合命名规则
  2. A var a%=20
  3. B var 1a=20
  4. C var _a=40;
  5. D var $a=30

1-3

  1. console.log(""||"abc");
  2. console.log(0 == '');
  3. function b(){
  4. }
  5. console.log(typeof b);

1-4

  1. var x = "2"+3+4;

1-5

  1. var value = 0;
  2. if(value){
  3. console.log("true")
  4. }else{
  5. console.log("fasle")
  6. }

1-6

  1. var x=!false;
  2. var y;
  3. if(x==true){
  4. y = true
  5. }else{
  6. y = false
  7. }
  8. alert(y);

1-7

  1. var b = 10,c=3;
  2. if((b%c)>=2){
  3. alert("a")
  4. }else{
  5. alert("b")
  6. }

1-8

  1. var x = 1;
  2. var y =x+x++;
  3. alert(y);

1-9

  1. 1.typeof能得到哪些类型
  2. 2.===和==的区别

1-10 JS中的内置对象

  1. Object,
  2. Array,
  3. Function,
  4. Number,
  5. String,
  6. Boolean,
  7. Date,
  8. RegExp,
  9. Error

1-11 Boolean值有哪些情况为false

1-12

  1. 100 == '100'
  2. 0 == ''
  3. null == undefined

资料2: 逻辑运算符练习2

  1. 6. var boo1 = true;
  2. !boo1; //false
  3. 7. var boo2 = false;
  4. !boo2; //true
  5. 8. var name;
  6. !name; //true
  7. 9. var cat = null;
  8. !cat; //true
  9. var obj;
  10. 27. 'abc' && obj.name; // 报错
  11. 28. undefined && obj.name; //undefined
  12. 29. obj && obj.name; // undefined
  13. 30. 0 || 100; //100
  14. 31. 0 || NaN; //NaN
  15. 32. 100 || 0; //100
  16. 33. 100 || NaN;//100
  17. 34. NaN || 0;// 0
  18. 35. NaN || 100;// 100
  19. 36. '' || 'abc'; //'abc'
  20. 37. 'abc' || ''; //'abc'
  21. 38. 'abc' || '456'; //'abc'
  22. 39. true || true; // true
  23. 40. true || false;// true
  24. 41. false || true;// true
  25. 42. false || false;// false
  26. 43. 0 || undefined; // undefined
  27. 44. NaN || null;// null
  28. 45. 100 || 'abc';// 100
  29. 46. 'abc' || undefined // 'abc'
  30. 47. var obj; 'abc' || obj.name; //'abc'
  31. 48. undefined || obj.name;// 报错

资料3: 编程题练习

  1. 编程题, 运算并打印结果
  2. 有一篮苹果,两个两个的拿剩一个,三个三个的拿剩一个,四个四个的拿剩一个,五个五个的拿剩一个,六个六个的拿剩一个,七个七个的拿,能拿完,请问这篮子里有多少个苹果?
  3. for (var i=0;i<=1000;i++){
  4. if(i%2==1&&i%3==1&&i%4==1&&i%5==1&&i%6==1&&i%7==0){
  5. console.log(i);
  6. }
  7. }