理解javascript运算符

let res = 3 % -10
console.log(res)  // 3

取余数运算中,如果右侧数值小于左侧,则结果为左测数值


let res = 2 * 2 * undefined
console.log(res) // NaN

undefined在转化为数值类型时是NaN


let a = 5, b, c;
b = a = c
console.log(a, b, c) //undefined undefined undefined

赋值运算符遵行右结合性,从右向左开始赋值

posted @ 2020-11-17 11:24  砂糖一椰子  阅读(84)  评论(0编辑  收藏  举报