Is it possible to retrieve the previous value of a given input from an array? If so, how can we achieve this?
var theArray = [1, 2, 3, 4, 5, 6, 7, 8, 9, 14, 15];
const findValue = (arr, input) => {
// To do
}
findValue(theArray, 15)
If we provide the input as 15, the expected output is 14.