2017년 3월 17일 금요일

[javascript]Map 작동안함.

아래글을 보면 알겟지만 map 으로 개발 을 했더니 익스플로어에서 동작을 하지 않았다..

그래서

아래 코드를 작성 한후


HashMap = function() {
this.map = new Object();
};
HashMap.prototype = {
put : function(key, value) {
this.map[key] = value;
},
get : function(key) {
return this.map[key];
},
containsKey : function(key) {
return key in this.map;
},
containsValue : function(value) {
for ( var prop in this.map) {
if (this.map[prop] == value)
return true;
}
return false;
},
isEmpty : function(key) {
return (this.size() == 0);
},
clear : function() {
for ( var prop in this.map) {
delete this.map[prop];
}
},
remove : function(key) {
delete this.map[key];
},
keys : function() {
var keys = new Array();
for ( var prop in this.map) {
keys.push(prop);
}
return keys;
},
values : function() {
var values = new Array();
for ( var prop in this.map) {
values.push(this.map[prop]);
}
return values;
},
size : function() {
var count = 0;
for ( var prop in this.map) {
count++;
}
return count;
}
};

HashMap.js 이름으로 저장한담에

문서에 스크립트 경로 추가 해준담에..

new HashMap();

으로 변경 해서 처리함.ㅋㅋㅋㅋ

퍼가실때 댓글좀~~




댓글 없음:

댓글 쓰기

[lunux]리눅스 폴더별 용량 확인

리눅스 폴더별 용량 확인 조회 하고자 하는 디렉토리 리스트가있는 경로로 이동후 du -h --max-depth=1