1
fruits = ["mango","apple","pine","berry"];

If I want to remove an element index wise, How to do that using JavaScript. Also you can use library as required.

Super Man
  • 1,627
  • 1
  • 14
  • 25
Hasanuzzaman
  • 83
  • 1
  • 1
  • 10
  • Was about to downvote that question but it's actually not trivial to find the answer on SO itself. This website's search engine is definitely subpart, compared to google who was able to find the right answer page 1... on SO domain itself... – mpm Sep 15 '18 at 19:38
  • why vue in tags? – marzelin Sep 15 '18 at 19:39

1 Answers1

11

You can use splice to do the same. Syntax = array.splice(start_index, no_of_elements) Following is the command:

fruits.splice(2, 1)

This will remove one element from index 2, i.e. after the operation fruits=["mango","apple","berry"];

Jahnavi Paliwal
  • 916
  • 3
  • 11