<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>运算符-算数运算符</title>
</head>
<body>
<script type="text/javascript">
var x = 10;
var y = 4;
// 取余数
var op = x % y;
</script>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>递增和递减以及赋值运算符</title>
</head>
<body>
<script type="text/javascript">
// <!-- ++递增 --递减 -->
var x = 3;
// 等价x = x+1
x++;
alert(x);
// b赋值给a a的值为6
var a = 5;
var b = 6;
a = b;
var c = 10;
c += 5;
c -= 2;
c *= 4;
c /= 3;
alert(c)
</script>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
<title>字符串</title>
</head>
<body>
<script type="text/javascript">
// <!-- 通过进行转义,从而"walter"也可以显示 -->
var str = "I 'm "walter""
// 字符拼接
var one = 'hello';
var name = 'walter';
var joined = one + ''+name;
alert(joined)
</script>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
<title>数字和字符串</title>
</head>
<body>
<script type="text/javascript">
// <!-- 浏览器自动将数值转化为字符串 -->
var a = 'walter' + 521;
alert(a)
// 隐式转换 数值转字符串
var num = 234;
var myStr = num + "";
alert(typeof myStr)
// 字符串转数值
var myNum = Number(myStr);
alert(typeof myNum)
var myStr2 = num.toString()
alert(myStr2);
var n = '13324fhfh';
var a = Number(n);
// alert(a) 报错 NaN Not a number
// alert(typeof a); 类型为Number
</script>
</body>
</html>