其他分享
首页 > 其他分享> > 对象

对象

作者:互联网

<!DOCTYPE html> <html lang="en"> <head>     <meta charset="UTF-8">     <meta http-equiv="X-UA-Compatible" content="IE=edge">     <meta name="viewport" content="width=device-width, initial-scale=1.0">     <title>Document</title>     <script>
        function Car(name,speed){             this,name=name;             this.speed=speed;         }
Car.prototype.showName=function(){

                console.log(this.name)             }        

        var car=new  Car("奔驰",300);         var car2=new Car("宝马",280);
        console.dir(car);         console.dir(car2);         //car2.showname();     </script> </head> <body>     </body> </html>

标签:function,console,name,对象,Car,car2,speed
来源: https://www.cnblogs.com/2604493891com/p/15568365.html