Nodejs 0.10.20의 맵이 깨져있는 것 같습니다. 그것은 --harmony (--harmony_collections 플래그 포함)로 시작합니다.
참조 용으로 http://dailyjs.com/2012/10/15/preparing-for-esnext/을 확인하십시오.
예제는 Firefox 20.0에서 실행됩니다. 나는Nodejs의지도 컬렉션 Harmony/ES6 broken?
> var map = new Map([ ["name", "Nicholas"], ["title", "Author"]]);
undefined
> map
{}
다음 않는 Nodejs 콘솔에서
그래서 제대로 작동 나던 contsructor 초기화. 다음 나는 파이어 폭스 예제를 따라 그들은 대부분 일을 해달라고 :> console.log(map.has("name")); // true
false
undefined
> console.log(map.get("name")); // "Nicholas"
undefined
undefined
> console.log(map.has("title")); // true
false
undefined
> console.log(map.get("title")); // "Author"
undefined
undefined
> console.log(map.size()); // 2
TypeError: Object # has no method 'size'
at repl:1:17
at REPLServer.self.eval (repl.js:110:21)
at repl.js:249:20
at REPLServer.self.eval (repl.js:122:7)
at Interface. (repl.js:239:12)
at Interface.EventEmitter.emit (events.js:95:17)
at Interface._onLine (readline.js:202:10)
at Interface._line (readline.js:531:8)
at Interface._ttyWrite (readline.js:760:14)
at ReadStream.onkeypress (readline.js:99:10)
임 혼란이 기본지도 방법을 해달라고 작업을. Nodejs 버전 0.10.20
나는 당신의 문제가 무엇인지 확실하지 않습니다. 그것은 개발 기능입니다. 또한, REPL에서'console.log()'를 사용하지 마십시오. 결과는 이미 검사되고 동일한 방식으로 버려집니다. –
당신은 모든 배열을 그 코드의 키로서, 단지 임의의 배열 요소가 아니라 사용할 필요가 있습니다 ... – dandavis