we are a community of more than 2 million smartest coders
registration for
employee referral programs
are now open
get referred to google, amazon, flipkart and more
register now
  
pinned-register now
showing results for - "use length to resize an array"
Syrine
10 Apr 2016
1let array = [11, 12, 13, 14, 15];  
2console.log(array.length); // 5  
3
4array.length = 3;  
5console.log(array.length); // 3  
6console.log(array); // [11,12,13]
7
8array.length = 0;  
9console.log(array.length); // 0  
10console.log(array); // []
similar questions
queries leading to this page
use length to resize an array