let player1 = "bbbb"
let player2 = "aaaa"
let value1 = 10
let value2 = 20
if (player1 > player2) {
[player1, player2] = [player2, player1]
[value1, value2] = [value2, value1]
}
console.log(player1, player2, value1, value2)
//real output: 20 10 10 20
//expected output: aaaa bbbb 20 10
我正在尝试反转变量值以按字母顺序对它们进行排序,但我得到了意外的输出\
我想反转变量的值
只需在每个语句末尾添加
;