Pergunta de entrevista da empresa NeoSOFT

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

Resposta da entrevista

Sigiloso

23 de mai. de 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)