<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>DEMO - Lik</title>
</head>
<body>
<script>
var total = 10;
console.log(total++); // 10
var total2 = 10;
console.log(++total2); // 11
</script>
</body>
</html>
++ 在后,先赋值再 ++
++ 在前,先++再赋值
本文详细解析了JavaScript中自增运算符的使用方法及特点,包括前置自增(++变量)与后置自增(变量++)的区别,并通过具体示例展示了这两种不同自增方式在实际代码中的行为表现。
4558

被折叠的 条评论
为什么被折叠?



