???
var phone = {
brand: "meizu",
model: "m2",
ram: 2,
color: "black"
};
function filter(object,search,val){
var result = {};
for(var key in object){
if(search == key || object[key] == val) result[key] = object[key];
}
return result;
}
console.log(filter(phone, "color",2));
var phone = {
brand: "meizu",
model: "m2",
ram: 2,
color: "black"
};
function filter(object,search,val){
for(var key in object){
if(search != key && object[key] != val) delete object[key];
}
}
filter(phone, "color",2);
console.log(phone);