nearestMove = function (dominoes, index) {
    let ans = [-1, -1];

    for (let i = index - 1; i > -1; i--) {
        if (ans[0] === -1 && (dominoes[i] === 'L' || dominoes[i] === 'R')) {
            ans[0] = i;
            break;
        }
    }

    for (let i = index + 1; i < dominoes.length; i++) {
        if (ans[1] === -1 && (dominoes[i] === 'L' || dominoes[i] === 'R')) {
            ans[1] = i;
            break;
        }
    }

    return ans;
}
@param {string[]} dominoes
@param {number} index
@returns {number[]}