Javascript: Forloop Разница между i ++ и (i + 1)

Я строил JavaScript для цикла, и я хочу сравнить значение массива со следующим значением в массиве.

Если оба значения не равны, я хочу вернуть true, иначе я хочу вернуть false.

В приведенном ниже коде я передаю строку «aba», разделяю ее и сортирую в

sortedLetters = ["a", "a", "b"]

Тем не менее, когда я сравниваю sortedLetters [0] ("a") с sortedLetters [1]

function isIsogram (str) {

    // split each letter into an array and sort
    sortedLetters = str.split("").sort();

    console.log(sortedLetters[0]); // is "a"
    console.log(sortedLetters[1]); // should be "a"

    // iterate through the array and see if the next array is equal to the current
    // if unequal, return true
    for( i = 0; i < sortedLetters.length; i++ ) {
        if(sortedLetters[i] !== sortedLetters[(i+1)]) return true;
    }
    // for "a" and "a", it should return false

    return false;

};

document.write(isIsogram("aba"));

Тем не менее, почему следующий оператор if работает, а вышеприведенный код - нет?

if(sortedLetters[i] !== sortedLetters[i++]) return true;

Ответы на вопрос(2)

Ваш ответ на вопрос