Ad

draw

Code
Diff
  • invert=s=>[...s].reverse``.join``
    • invert=s=>[...s].reverse().join``
    • invert=s=>[...s].reverse``.join``
Code
Diff
  • const invert=str=>[...str].reverse().join('');
    
    • const invert = str => [...str].reverse().join('');
    • const invert=str=>[...str].reverse().join('');
Arrays
Data Types
Algorithms
Logic
Data
Code
Diff
  • function pairs(arr) {
      const r = arr.join(' ').match(/-\d/g).filter(i => arr.includes(i[1] / 1)) /1
      return [r,...[Math.abs(r)]]
    }
    • function pairs(arr){
    • let sorted = arr.sort();
    • let length = arr.length;
    • for (let i = 0; i < length; i++) {
    • if (sorted.includes(arr[i] * -1)) {
    • return [sorted[i], sorted[i] * -1];
    • }
    • }
    • function pairs(arr) {
    • const r = arr.join(' ').match(/-\d/g).filter(i => arr.includes(i[1] / 1)) /1
    • return [r,...[Math.abs(r)]]
    • }
Code
Diff
  • const invert = str => [...str].reverse().join('');
    
    • const invert = str => str.split('').reverse().join('');
    • const invert = str => [...str].reverse().join('');
Mathematics
Algorithms
Logic
Numbers
Data Types
Code
Diff
  • const average = arr => arr.length !== 0 ? arr.reduce((a, b) => a + b) / arr.length : undefined;
    
    • const average = grades => !grades.length ? undefined : grades.reduce((a, b) => a + b, 0) / grades.length;
    • const average = arr => arr.length !== 0 ? arr.reduce((a, b) => a + b) / arr.length : undefined;