Created
April 4, 2019 15:13
-
-
Save akinolu52/cdbe5c2c043e23bb477721dd0cb6a72c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let k = { | |
x: ['mi', 'ko'], | |
y: [] | |
} | |
function clean(obj) { | |
for (let propName in obj) { | |
if (obj.hasOwnProperty(propName)) { | |
if (!obj[propName].length) { | |
delete obj[propName]; | |
} | |
} | |
} | |
} | |
console.log(clean(k)) | |
console.log(k) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment