<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
<style>
body {
font-family: "Microsoft YaHei", serif;
}
body, dl, dd, p, h1, h2, h3, h4, h5, h6 {
margin: 0;
}
ol, ul, li {
margin: 0;
padding: 0;
list-style: none;
}
img {
border: none
}
</style>
</head>
<body>
<div id="wrap"></div>
<script>
// + - * / %
// 小数运算会出现精度问题
// +两边如果有一边是字符串则会拼接
// 拼接的时候会不是字符串的一遍会调用toString()进行隐式类型转换
console.log(1 + "1");
console.log("1" + 1);
console.log(1 + 2 + "1");
console.log(document + 1);
// [object HTMLDocument]1
console.log(1 + true);
// 2
console.log("1" + true);
// 1true 注意这两个不一样
console.log(undefined + undefined);
// NaN not a number
// 他是String类型
// -法运算会把字符串换成数字之后进行运算
console.log("2" - 3);
console.log("2" - "3");
// null相当于0 乘法和减法null都是0
console.log(null - 3);
// -3
console.log(null * 3);
// 0
// 特殊用法
var a = "123";
console.log(a*1);
console.log(a - 0);
console.log(a / 1);
// 再赋值给a,相当于字符串隐式类型转换为数字
// 相反的用+把数字隐式类型转换为字符串
console.log(53 / 0);
// Infinity 正无穷
// -Infinity 负无穷
</script>
</body>
</html>
Python3Turtle