You are viewing a single comment's thread. Return to all comments →
Instead of to declare abs function, you can use Math.abs, and also the .toList is not necessary because the map function returns in this case a List
Here is my solution
arr.map(Math.abs(_))
Seems like cookies are disabled on this browser, please enable them to open this website
Update List
You are viewing a single comment's thread. Return to all comments →
Instead of to declare abs function, you can use Math.abs, and also the .toList is not necessary because the map function returns in this case a List
Here is my solution
arr.map(Math.abs(_))