var old_object = {
name: "Vasia",
age: 30,
weight: 80,
sex: "male",
hobby: "sport"
}
function getOnlyNumbers (obj) {
var new_obj = {};
for (prop in obj) {
if (typeof obj[prop] === "number") {
new_obj[prop] = obj[prop];
}
}
return new_obj;
}
var filtered_obj = getOnlyNumbers(old_object);
console.log(filtered_obj); // {age: 30, weight: 80}