webveuje/js/demo/day1.html
2021-01-28 09:06:45 +08:00

46 lines
1.2 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<script>
var lanzi="苹果"
// var lanzi ---第一步 变量声明 问系统要个篮子 用来放东西
// lanzi="苹果" --第二步 赋值 把苹果放到篮子里
document.write('明世隐')
var a=1,b=2,c=3,d=4,e; // 声明多个变量
document.write(a,b,c,d,e)
var no=1;
var num=no
num=3;
console.log(no,num)
var obj={name:'蔡文姬',age:20}
var obj1=obj
obj1.name='明世隐'
console.log(obj)
console.log(obj1)
//检测数据类型
console.log(typeof "king")
console.log(typeof obj) //object
console.log(typeof [1,2,3]) //array--> object
console.log(typeof function(){}) //object
console.log(Number('2AAAAA')) //NAN
console.log(Number('2')) //2
console.log('2aaaaa'+4) //2aaaaa4
console.log("4"+4) //44
console.log("4"-4) //0
console.log(true+5) //6
</script>
</head>
<body>
</body>
</html>