Question d’entretien chez NeoSOFT

Coding Round:- They asked to delete all the keys from a given object whose values are either null or undefined.

Réponse à la question d'entretien

Utilisateur anonyme

23 mai 2023

const obj = { one: null, two: 2, three: null, four: undefined, }; Object.keys(obj).forEach((key) => { if (!obj[key]) { delete obj[key] } }) console.log('obj:-', obj)