Files
30-seconds-of-code/test/nthElement/nthElement.js

1 line
94 B
JavaScript

module.exports = nthElement = (arr, n = 0) => (n > 0 ? arr.slice(n, n + 1) : arr.slice(n))[0];