| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657 |
- <!DOCTYPE html>
- <html lang="zh-CN">
- <head>
- <meta charset="UTF-8">
- <title>Title</title>
- </head>
- <body>
- <script>
- /*创建Object对象,调用Object函数*/
- var obj = new Object();
- obj.a=15;
- obj.b=66;
- console.log(obj.a);
- console.log(obj.b);
- /*正常的方式创建对象*/
- var obj1={
- name:"张三",
- age:25,
- sex:"男",
- eat:function (){
- return this.name+"在吃饭";
- }
- }
- console.log(obj1.name);
- console.log(obj1.age);
- console.log(obj1.sex);
- console.log(obj1.eat());
- var person={
- name:"张三",
- age:25,
- sex:"男",
- eat:function (){
- return this.name+"在吃饭";
- }
- }
- /*Math对象的常用方法*/
- var n1 = Math.max(15,8);
- console.log(n1);
- var str="张三";
- str.substring(0,3);
- var date=new Date();
- console.log(date)
- </script>
- </body>
- </html>
|