How to add array to map in reverse order in JavaScript

1 Answer

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

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

console.log(mp);

  
  
  
  
/*
run:
  
["javascript", "c", "nodejs", "c++"]
  
*/

 



answered May 18, 2022 by avibootz

Related questions

1 answer 122 views
2 answers 206 views
1 answer 143 views
1 answer 112 views
1 answer 175 views
1 answer 150 views
1 answer 147 views
...