Ad
Arrays
Data Types
Code
Diff
  • function remove(arr, n) {
      const indexOutOfRange = n < 0 || n >= arr.length;
      if (indexOutOfRange) return arr;
      arr.splice(n, 1);
      return arr;
    }
    • function remove (arr, n) {
    • if (n < 0 || n >= arr.length) return arr;
    • function remove(arr, n) {
    • const indexOutOfRange = n < 0 || n >= arr.length;
    • if (indexOutOfRange) return arr;
    • arr.splice(n, 1);
    • return arr;
    • }