How to replace the first element of an array in Node.js

1 Answer

0 votes
const arr = ['javascript', 'python', 'typescript', 'node.js', 'c++', 'c'];
  
arr[0] = 'replaced';
  
console.log(arr); 
  
    
    
    
    
/*
run:
    
[ 'replaced', 'python', 'typescript', 'node.js', 'c++', 'c' ]
 
*/

 



answered Jun 12, 2022 by avibootz
...