I have this function:
getKeyboardStartingPoint() {
    let currentCellNumberElement;
    window.setTimeout(function() {
        $cells.each(function() {
            currentCellNumberElement = $(this).find('[data-number]');
            if (currentCellNumberElement.text().trim().length === 0) {
                currentCellNumberElement.css('background-color', 'orange');
                return false;
            }
        });
    }, 100);
    return currentCellNumberElement;
}
The variable currentCellNumberElement is declared locally within the function at the top, processed in the each loop and after that I try to alert it. However, the variable returns undefined. The css changes on the element works, so the variable does have a value, but for some reason it becomes undefined when the each loop ends. What's the issue here?
 
     
    