javascript的暂时性死区
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
</head>
<body>
<script>
var PI=3.1415926
if(true){
console.log(PI) //无影响
var PI;
}
let PI1=3.1415926
if(true){
console.log(PI1) //报错,会形成暂时性死区
let PI1;
}
</script>
</body>
</html>