Javascript » Data » Remove items from an Array

LearnJS » CodePen.io

👉 User Story:

As a user
Given an Array that renders into an HTML list
When I click on a particular item
  That item should be removed from the array

The architecture of the "render" function from the previous step should change into something like this:

  1. clear existing DOM items
  2. for each item in the array
    1. create the new item
    2. associate the event to handle the delete
    3. add the item to the list

You can try things out directly on this pen:
https://codepen.io/marcopeg/pen/ExxROxe


✅ Proposed Solution:

Don't run this unless you gave a very good effort to solve it yourself!

An alternative solution:

And another:


🤓 Resources:


💬 Comments & New Ideas:

results matching ""

    No results matching ""