6 useful JavaScript array tips you should to know
Dmitrii Liakin
Co-founder / Principal Software Engineer / CTO @ CuVi | Full-stack JavaScript | React | NodeJS
1. Remove duplicate values from array
We can remove duplicate values using Set object and Array.from() method or Spread syntax
2. Clear an array
We can use length propety of Array object to clear an array
3. Create an object from array
Use Spread syntax to create an object
4. Populate array with data
Use Array.fill() method to fill array with data
5. Merge two or more arrays
Use Spread syntax or Array.concat() method to merge arrays
6. Find intersection of two arrays
First use Set and Spread syntax to remome duplicates from the first array. After that use Array.filter() and Array.includes() methods to find intersection
Summary
If this article was useful for you fill free to endorse JavaScript skill on my profile page