Ad
Code
Diff
  • const addArr = arr => arr.reduce((a, b) => a + b, 0) || null
    • const addArr = (arr) => {
    • let sum = 0;
    • for (let i = 0; i < arr.length; i++) {
    • sum += arr[i];
    • }
    • return sum || null;
    • };
    • const addArr = arr => arr.reduce((a, b) => a + b, 0) || null
Code
Diff
  • const reverse = str => [...str].reverse().join('');
    • const reverse = str => [...str].reverse();
    • const reverse = str => [...str].reverse().join('');