5js

2021-01-15 17:12

阅读:639

标签:bsp   nbsp   class   object   rip   pre   console   UNC   log   

对象

var obj2 = new object();
        obj2.name = ‘拼多多‘
        obj2.sayHi = function {
            console.log(‘Hi~~‘)
        }
function Star(uname,age,sex) {
            this.name = uname;
            this.age = age;
            this.sex = sex;
            this.sing = function(song) {
                console.log(song)
            }
        }
        var ldh = new Star(‘刘德华‘,23,‘男‘)
        console.log(typeof(ldh))
        ldh.sing(‘是理想‘)
for (var k in ldh) {
            console.log(k);
            console.log(ldh[k])
        }

 

5js

标签:bsp   nbsp   class   object   rip   pre   console   UNC   log   

原文地址:https://www.cnblogs.com/gao-chao/p/13393200.html


评论


亲,登录后才可以留言!