-4

enter image description here

How can I delete event(object) from my events(object). It seems to be pretty simple but I'm kinda stuck trying to figure it out for like an hour

  • what is the expected output? – Rahul Sharma Jul 01 '22 at 12:19
  • Let's say I want this events list but without the 3rd object – Filip Antoniak Jul 01 '22 at 12:21
  • `yourArray.splice(3, 1)` – Deniz Jul 01 '22 at 12:22
  • It's not clear how this image relates to the question. Are you asking how to remove a property from an object? How to remove an element from an array? Something else? Please provide a runnable [mcve] which demonstrates what you're trying and what isn't working as expected. – David Jul 01 '22 at 12:22
  • 1
    Does this answer your question? [How can I remove a specific item from an array?](https://stackoverflow.com/questions/5767325/how-can-i-remove-a-specific-item-from-an-array) – evolutionxbox Jul 01 '22 at 12:24

1 Answers1

1
const events = events.filter(ev => ev.title !== 'TEST ZDJEC');

This will remove 3rd one, since in filter you are specifying that you want to keep only elements with title different than 'TEST ZDJEC';

Milos Pavlovic
  • 1,355
  • 1
  • 2
  • 7