I need to create a function that accepts a string input, searches for its match in an array, and then returns the previous and next elements in the array.
const array = [
"11111",
"22222",
"343245",
"5455",
"34999",
"34555",
];
When a user enters a random number, the function will determine the previous and next elements based on that input.
For instance, if the user inputs: 3499 The function will output: The previous element is 5455 and the next element is 34555.