1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071 |
- // 生成新的空数组
- var arr = new Array();
- var arr = [];
- // 生成新的空对象
- var obj2 = new Object();
- var aa = {}
- // var data = new Date();
- // console.log(data,'data')
- obj2.name = '我的';
- console.log(obj2,'obj2');
- // 创建一个对象 对象的声明
- var obj1 = {};
- var obj = {
- name: '小郑',
- sex: '女',
- age: '我不告诉你'
- }
- // 对象的使用
- // 对象名.属性名 = 属性值
- console.log(obj.name);
- console.log(arr);
- function fn1() {
- console.log("这是一个函数")
- }
- console.log(typeof fn1(),'打印函数')
- console.log(typeof arr,'打印数组');//Object
- console.log(typeof obj,"打印对象");//Object
- var x = new String(); // 把 x 声明为 String 对象
- var y = new Number(); // 把 y 声明为 Number 对象
- var z = new Boolean(); // 把 z 声明为 Boolean 对象
- // 请避免字符串、数值或逻辑对象。他们会增加代码的复杂性并降低执行速度。
- var aa = 1;
- console.log(typeof aa);
- console.log(typeof x,'x');
- console.log(typeof y,'y');
- console.log(typeof z,'z')
- console.log( x,'x1');
- console.log( y,'y1');
- console.log( z,'z1')
- var arr=new Array();
- var a;
- var b;
- var obj={
- name:'cheny',
- age:13,
- active:function fn1(a1,b1){
- a = a1+b1;
- return console.log(a)
- }
-
- }
- obj["active"](1,2)
- // continue
- // for
- var c1 = 11;
- while(c1 <= 15){
- c1++;
- if( c1 == 13 ) {
- continue;
- }
- document.write(c1);
- }
|