读书人

JS-二

发布时间: 2013-11-08 17:52:01 作者: rapoo

JS-2

JS还是有些奇怪的东西的 也不知道怎么去看源码 才能知道这奇怪的来源

?

var obj = {};var otherObj = {    name: "other"};var map = {};map[obj] = 'first';map[otherObj] = 'second';map[obj]; // This is 'second'.// Recall that object keys are strings. The string// generated by an object is '[object Object]' by default.// So, obj and otherObj have the same key; // map[obj] and map[otherObj] are therefore equivalent.console.log(obj.toString);console.log(otherObj.toString);
?

读书人网 >JavaScript

热点推荐