draw
Arrays
Data Types
Algorithms
Logic
Data
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)]]
- }
Mathematics
Algorithms
Logic
Numbers
Data Types
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;