++a 前置比较勤快,值直接+1
a++ 后置比较懒,先返回原本的值,在+1
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<script>
var a = 10
// console.log(++a,a++)
// document.write(--n)
document.write(a--)
var m = 10
var res = m++ + --m + m-- + ++m
// 10+10+10+10=40
console.log(m,res)
</script>
</body>
</html>