Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

use length to resize an array

let array = [11, 12, 13, 14, 15];  
console.log(array.length); // 5  

array.length = 3;  
console.log(array.length); // 3  
console.log(array); // [11,12,13]

array.length = 0;  
console.log(array.length); // 0  
console.log(array); // []
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #length #resize #array
ADD COMMENT
Topic
Name
1+8 =