My formula for Drop It works in Brackets but is not working when I run the test in FCC

Thank you so much, in advance!

-Kristopher


This is my code:
function dropElements(arr, func) {
  // Drop them elements.
    var works = [];
    var n = arr.filter(func);
    if (n){works.push(n)}
    var indx = arr.indexOf(works[0][0]);
   arr.slice(indx);
    
    return works;
}

dropElements([1, 2, 3], function(n) {return n < 4;});

```js

function dropElements(arr, func) {
  // Drop them elements.
    var works = [];
    var n = arr.filter(func);
    if (n){works.push(n)}
    var indx = arr.indexOf(works[0][0]);
   arr.slice(indx);
    
    return works;
}

dropElements([1, 2, 3], function(n) {return n < 4;});

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.100 Safari/537.36.

Link to the challenge:
https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/drop-it/

You are returning multi-dimensional arrays.

this doesn’t do anything. slice doesn’t change the array on which it is applied and you are not doing anything with the returned value

and you are returning works which contains all the elements that pass the test, instead you need to remove from the array the elements before the first passing value, and return the array from the first passing value to the end

Thank You so much for your help! I recognized my error when you pointed out what I was returning was NOT what I intended. sheesh. That was silly.
This final formula worked:

function dropElements(arr, func) {
  // Drop them elements.
    var works = [];
    var n = arr.filter(func);
    if (n){works.push(n)}
    var indx = arr.indexOf(works[0][0])
   if (works[0] === undefined || works[0].length == 0) {
    return[]
    } else{
        return arr.slice(indx)};}

Thank you so much for your help. I WAS returning a multi-dimensional array! HA.
I fixed it and end runs in FFC!
-Kristopher
here is final:

 function dropElements(arr, func) {
  // Drop them elements.
    var works = [];
    var n = arr.filter(func);
    if (n){works.push(n)}
    var indx = arr.indexOf(works[0][0])
   if (works[0] === undefined || works[0].length == 0) {
    return[]
    } else{
        return arr.slice(indx)};}

Good job fixing it. Happy coding!