zoukankan      html  css  js  c++  java
  • js之===与==

    <span style="font-size:14px;"><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>这是一个微小的页面</title>
    
    <script>
    		window.onload = function load()
    		{
    			/*
    				可以认为===代表类型和值都相等;
    				==只判断值是否相等;
    				js是动态语言,亦是弱类型语言
    			*/
     				var num = 0;
    				
    				console.log(""==num);
    				console.log(""!=num);
    				
    				console.log(""===num);
    				console.log(""!==num);
    				
    				console.log("//////////////////////////////////////");
    				var boolean = false;
    				
    				console.log(""==boolean);
    				console.log(""!=boolean);
    				
    				console.log(""===boolean);
    				console.log(""!==boolean);
    				
    				console.log("//////////////////////////////////////");
    				var  nullType = "";
    				
    				console.log(""==nullType);
    				console.log(""!=nullType);
    				
    				console.log(""===nullType);
    				console.log(""!==nullType);
    				
    				console.log("//////////////////////////////////////");
    				var  nullTest = null;
    				
    				console.log(""==nullTest);
    				console.log(""!=nullTest);
    				
    				console.log(""===nullTest);
    				console.log(""!==nullTest);
    				
    				console.log("///////////////////////////////////////");
    				/*
    				弱类型语言使用变量不需要互相转换。动态语言或是静态语言与他们的强弱类型无关;
    				例如:java是静态强类型语言,phython是动态强类型语言,javascript是动态弱类型语言,c语言是静态弱类型语言
    				*/
    				var  a = true;
    				var  b = "test";
    				var  c = "123";
    				var  d = 3;
    				
    				console.log(a+b);
    				console.log(c+d);
    				console.log(d+c);
    		}
    </script>
    </head>
    
    <body >
    </body>
    </html>
    </span>

  • 相关阅读:
    PHP数组(数组正则表达式、数组、预定义数组)
    面向对象。OOP三大特征:封装,继承,多态。 这个讲的是【封存】
    uvalive 3938 "Ray, Pass me the dishes!" 线段树 区间合并
    LA4329 Ping pong 树状数组
    HDU 1257 最少拦截系统
    HDU 1260 Tickets
    codeforce 621D
    codeforce 621C Wet Shark and Flowers
    codeforce 621B Wet Shark and Bishops
    codeforce 621A Wet Shark and Odd and Even
  • 原文地址:https://www.cnblogs.com/MedivhQ/p/3868769.html
Copyright © 2011-2022 走看看