Generation

generate functionSat, 12 Nov 2022

Remove all odd number in an object

function removeOdd(obj: any): any { if (typeof obj === "object") { for (let key in obj) { if (obj[key] % 2 !== 0) { delete obj[key] } } return obj; } else { return obj } } let obj = { a: 2, b: 3, c: 4 } removeOdd(obj);

TypeScript
Generate More

Questions about programming?Chat with your personal AI assistant