JSFiddle - React, Tailwind, and code Playground
by joplomacedo
JavaScript
const obj1 = {
quantity: 1,
limitPrice: 2,
stopPrice: 3,
auxPrice: 4,
tif: 5,
quantit2y: 1,
limitP2rice: 2,
sto43pPrice: 3,
aux6Price: 4,
tif5: 5,
};
const obj2 = Object.fromEntries(
Object.entries(obj1).filter( ([key, val]) => {
return ['quantity', 'limitPrice', 'stopPrice', 'auxPrice', 'tif'].includes(key);
})
)
console.log(obj2)