showing results for - "javascript add field to array"
Amine
12 Jan 2017
1  //you can add custom properties to the JS arrays
2  //length won't change
3  
4  const arr = [ 1, 2, 3, 4 ];
5  arr.greeting = 'Hello, world!';
6
7  console.log(arr.length); // 4
8  console.log(arr.greeting); // Hello, world!
similar questions
queries leading to this page
javascript add field to array