zoukankan      html  css  js  c++  java
  • JS_Boolean Logic

    • Comparisons
      • >
      • <
      • >=
      • <=
      • ==
      • !=
      • ===
      • !== 
    • == double equals
      • check for equality of value, but not equality of type
      • it coerces both values to the same type and then compares them
      • this can lead to some unexpected results.
        • 0 == ' ';                  //true
        • 0 == false;            //true
        • null == undefined; //true
    • === triple equals.   checks for equality of value and type
      • 2 === '2';        //false
      • false === 0;   //false
      • 10 !== '10' ;   //ture
      • 10 != '10';     //false
    • console.log().  prints arguments to the console
    • Running code from a file
      • write code in a .js file and inculde the script in a .html file(abover the closing body tag)
      • "hi".toUpperCase(); //won't show up in the console
        
        console.log("hi".toUpperCase());   //will show up in the console.
    • conditions
      • if
      • else if
      • else
      • nesting(多种条件语句嵌套)
    • TRUTHY AND FALSY VALUES
      • all js values have an inherent truthyness or falseness about them
      • false values:
        • false
        • 0
        • ''''(empty string)
        • null
        • undefined
        • NaN
      • everything else is truthy!
    • Logical Operations
      • &&.   AND
      • ||.    OR
      • !    NOT
        • ! null            //true
        • ! (0 === 0) //false
        • ! (3 <= 4).  //false
    • How to check a string includes space or not?
    if(string.indexOf(" ") === -1){
    
             console.log("no space");
    
    }
    • 控制台基本操作
    • alert("hello, welcome to my world!!!")   //在网页面出现弹框
      
      prompt("please introduce yourself~")   //在网页出现输入框,用户可以输入
      "Peiyu Li"
      
      let userInput = prompt("name")
      
      userInput
      "Peiyu"
      
      parseInt("78")     //字符转换成数字
      78
      
      parseInt("78dhkshdk")。 //字符转换成数字,自动滤去非数字部分
      78
      
      console.log("Good morning!!!")。  //输出,相当于print
      Good morning!!!
  • 相关阅读:
    spring框架里面处理中文匹配
    日常问题记录--使用fiddler自动响应jsonp结构的响应
    linux命令--pamp
    每天一个linux命令--nice命令
    阿里RAP+fiddler实现app原生应用的cgi数据mock----- (二)添加mock规则,随机返回4中类型(不同长度)的数据
    父子组件之间传递数据
    redux-API(二)
    redux数据流
    Redux 的基础概念-API
    react-redux要点梳理
  • 原文地址:https://www.cnblogs.com/LilyLiya/p/14249686.html
Copyright © 2011-2022 走看看