Say I have an object:
elmo = { color: \'red\', annoying: true, height: \'unknown\', meta: { one: \'1\', two: \'2\'} };
I want to m
convert arguments to array
use Array.forEach() to pick the property
Array.forEach()
Object.prototype.pick = function(...args) { var obj = {}; args.forEach(k => obj[k] = this[k]) return obj } var a = {0:"a",1:"b",2:"c"} var b = a.pick('1','2') //output will be {1: "b", 2: "c"}