Snippets Collections
const points=games=>games.reduce((output,current)=>{
    return output += current[0]>current[2] ? 3 : current[0]===current[2] ? 1 : 0;
  },0)

//DIFERENTE ESCRITO:
 function points(games) {
   return games.reduce((output,current)=>{
     let x = parseInt(current[0]);
     let y = parseInt(current[2]);
     let value= x>y ? 3 : x===y ? 1 : 0;
     return output+value;
   },0)
 }
star

Sat May 20 2023 15:06:17 GMT+0000 (Coordinated Universal Time) https://www.codewars.com/kata/5bb904724c47249b10000131/solutions/javascript

#javascript #operaciónmate #array #.reduce() #parseint()

Save snippets that work with our extensions

Available in the Chrome Web Store Get Firefox Add-on Get VS Code extension