<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Title</title>
</head>
<body>
<script>
//1:原始类型:
//数值:1,3,60
//字符串:‘peter' 'php' '60'
//如果60不加定界符:60
//peter,php不加定界符:
//定界符:'',""
//布尔值:true,false
//undefined :没有被定义
// null 是一个值也是一个对象
// 对象类型:object
// array,
// Math,
// Date,
// Function,
//用字面量来声明一个对象
//对象成员:属性,方法,统一为属性
var person = {
id:1001,
name: 'peter shu',
sex:'male',
job: function () {
console.log(this.name)
}
}
// console.log(person.id);
// console.log(person.name);
// console.log(person.sex);
// console.log(person.job());
// var obj = new Object();// O一下定要大写
var obj = function () {};
obj.x = 40;
obj.y = 100;
obj.p = function () {
return '我是obj的p方法反回值';
}
//函数是javascript中的一等公民
// console.log(obj.x);
// console.log(obj.f());
// console.log(obj.p());
var num = 500;
var num = new Number(500);
console.log(num);
</script>
</body>
</html>
Statement of this Website
The copyright of this blog article belongs to the blogger. Please specify the address when reprinting! If there is any infringement or violation of the law, please contact admin@php.cn Report processing!