object
Object
var grades = {'egoing': 10, 'k8805': 6, 'sorialgi': 80};object ํ์ฅ
Object.prototype.contain = function(neddle) {
for(var name in this){
if(this[name] === neddle){
return true;
}
}
return false;
}
var o = {'name':'egoing', 'city':'seoul'}
console.log(o.contain('egoing')); //true
// ๋ง์ฝ์ graphottie ๋ผ๊ณ ํ๋ฉด false๊ฐ ๋์ฌ๊ฒ์ด๋ค ์กด์ฌํ์ง ์๊ธฐ๋๋ฌธ์
var a = ['egoing','leezche','grapittie'];
console.log(a.contain('leezche')); //trueobject ํ์ฅ์ํ
Last updated