计算这一年还剩多少天:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<script>
function leftDays(){
var today=new Date();
var endYear=new Date(today.getFullYear(),11,31,23,59,59,999);
var msPerDay=24*60*60*1000;
console.log(Math.floor((endYear-today)/msPerDay));
}
leftDays();
</script>
</body>
</html>