I have an array
var data = {email: 'email@gmail.com', phone: '3434344332', firstName: 'john', lastName: 'Doe'};
How do i remove one or more elements from the array?
I Tried _.without( data, data.email ) , this removes the email field but also changes the Object to array without keys.
result ["3434344332", "john", "Doe"]
What I want to achieve {phone: '3434344332', firstName: 'john', lastName: 'Doe'}
>Solution :
without only works with arrays. If you pass an object, it’ll get turned into an array in a similar manner to Object.values. You should be using omit instead:
_.omit(data, "email")