Homeyscrip findLast() doesn't work

const array1 = [5, 12, 50, 130, 44];

const found = array1.findLast((element) => element > 45);


i want to find a number, from the last index on to the first index. Copied this from the internet but it doesn't work. 

The Node.js version that Homey runs is too old, but you can use this:

const found = [...array1].reverse().find(element => element > 45);
1 Like

thx Robert works perfect!!

Lodash is also available right?
So you can also use _.last(arr, element => element > 45)

1 Like

I will take a look. Lodash is unknown to me. But the first peek looks promising. Thx Arie.

1 Like