++ –
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="keywords" content="">
<meta name="description" content="">
<title></title>
</head>
<body>
<script>
/*
* ++ -- => 自带类型转换
* ++ => 在自身的基础上加1,然后赋值给自己
* -- => 在自身的基础上减1,然后赋值给自己
* */
/************************************************/
//基础的 ++ --
let a = 3;
a ++;
console.log( a );//4
let b = "3";
b ++;
console.log( b );//4
let c = 5;
c --;
console.log( c );//4
let d = "5";
d --;
console.log( d );//4
/************************************************/
//后置 ++ => 先赋值再+1
let e = 5;
e ++;
console.log( e );//6
let f = 5;
let g = f ++;
//计算逻辑 => let g = f; f = f + 1;
console.log( "f的值:",f );//6
console.log( "g的值:",g );//5
/************************************************/
//前置 ++ => 先+1再赋值
let h = 5;
++ h;
console.log( h );//6
let i = 5;
let j = ++ i;
//计算逻辑 => i = i + 1; let j = i;
console.log( "i的值:",i );//6
console.log( "j的值:",j );//6
</script>
</body>
</html>