Answers for "javascript add field to array"

0

javascript add field to array

//you can add custom properties to the JS arrays
  //length won't change
  
  const arr = [ 1, 2, 3, 4 ];
  arr.greeting = 'Hello, world!';

  console.log(arr.length); // 4
  console.log(arr.greeting); // Hello, world!
Posted by: Guest on February-10-2021

Code answers related to "javascript add field to array"

Code answers related to "Javascript"

Browse Popular Code Answers by Language