I have a function that takes an array and string as arguments. The task is to chceck if the string occurs within the function and if does move to the first place of the array.
function moveToFirstPlace(['pizza', 'Pasta', 'Burger', 'PiZZa', 'pizzA'],'pizza')
in this example all pizzas have to be moved to the beggining of the array regardless of upper or lower letters.
Map returns a new array with the elements returned in the callback- it is wasteful to use it in a way in which you are not creating a new array, and it is bad practice