How to add array to map in reverse order in Node.js

1 Answer

0 votes
const array = ['c++', 'nodejs', 'c', 'java'];

const mp = array
  .slice(0)
  .reverse()
  .map(element => {
    	return element;
  });

console.log(mp);

  
  
  
  
/*
run:
  
[ 'java', 'c', 'nodejs', 'c++' ]
  
*/

 



answered May 18, 2022 by avibootz

Related questions

1 answer 108 views
2 answers 117 views
1 answer 127 views
1 answer 117 views
1 answer 136 views
1 answer 162 views
1 answer 144 views
...