-
梦里花落0921
// First timevar a = [1, 2, 3];var b = [1, 2, 3];var c = "1,2,3";a == c; // trueb == c; // truea == b; // false//Second timeconsole.log(a == c);console.log(b == c);console.log(a == b);a = [1, 2, 3];b = [a, 2, 3];c = "1, 2, 3";console.log(a == c); //falseconsole.log(b == c); //falseconsole.log(a == b); //false第二组看起来像这样:a = [1, 2, 3];b = [[1,2,3],2,3]; -> Jagged Array;c = "1,2,3"
-
呼如林
b = [1, 2, 3]; // first
b = [a, 2, 3]; // second数组的第一个元素不同ps避免'=='并在生产中使用'==='。
-
慕田峪9158850
您第二次执行的所有值都是错误的,因为没有一个值是相等的。var c = "1,2,3" 与 c = "1, 2, 3" 不同,因为第二个字符串中有空格。var b = [1, 2, 3] 与 b = [a, 2, 3] 不同,因为第二个数组中的第一个元素不同。试试下面的代码// First timevar a = [1, 2, 3];var b = [1, 2, 3];var c = "1,2,3";a == c;b == c;a == b;//Second timeconsole.log(a == c);console.log(b == c);console.log(a == b);a = [1, 2, 3];b = [1, 2, 3];c = "1,2,3";console.log(a == c);console.log(b == c);console.log(a == b);