console.log('[] == []是:'+([] == [])); //falseconsole.log('[] === []是:'+([] === [])); //falseconsole.log('{} == {}是:'+({} == {})); //falseconsole.log('{} === {}是:'+({} === {})); //false //trueconsole.log( '[] == !{}是:'+([] == !{} )); /*!{}是个布尔值,为false,因此我们比较的是 [] == 0*/var n0 = 123;var n1 = new Number(123);var n2 = new Number(123);var n3 = Number(123);var n4 = Number(123); console.log('n0 == n1是:'+(n0 == n1)); //trueconsole.log('n0 == n3是:'+(n0 == n3)); //trueconsole.log('n0 === n1是:'+(n0 === n1)); //falseconsole.log('n0 === n3是:'+(n0 === n3)); //true console.log('n1 == n2是:'+(n1 == n2)); //falseconsole.log('n1 === n2是:'+(n1 === n2)); //falseconsole.log('n1 == n3是:'+(n1 == n3)); //trueconsole.log('n1 === n3是:'+(n1 === n3)); //false console.log('n3 == n4是:'+(n3 == n4)); //trueconsole.log('n3 === n4是:'+(n3 === n4)); //true
输出截图:
以上是小编为您精心准备的的内容,在的博客、问答、公众号、人物、课程等栏目也有的相关内容,欢迎继续使用右上角搜索按钮进行搜索javascript
new
javascript 时间对比、javascript字符串对比、js和javascript的区别、jsp javascript的区别、javascript与js的区别,以便于您获取更多的相关知识。
时间: 2024-10-31 17:18:29