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 113 views
2 answers 191 views
1 answer 136 views
1 answer 103 views
1 answer 166 views
1 answer 135 views
1 answer 131 views
...