RSSAmplifier

Ajay Karwal · Dec 25, 2020

Empty a JavaScript Array

0
Sign in to vote or save

This site does not allow itself to be embedded. You can still read it on the original site — the toolbar below keeps your place in the directory.

Ahmed Awais shared this simple tip to empty a JavaScript Array. arr . length = 0 ; So simple right? But why would you want to do this? Perhaps your application uses an array to store a list of products, and when a user applies a filter facet, you could empty the array before populating it again with the new set of filtered products. Check out the original tweet below for more discussion on the…

Read on ajaykarwal.com

Comments

Nothing yet. Say the first thing.

    Sign in to join the conversation.