var obj = [
{ "name": "swara", age: 8 ,"marks":60},
{ "name": "sangram", age: 7 ,"marks":50},
{ "name": "sachin", age: 60 ,"marks":50},
]
function deleteProperty(objArray, propName) {
objArray.forEach(element => {
delete element[propName]
});
return objArray
}
var res = deleteProperty(obj,"name")
console.log(res)
No comments:
Post a Comment