In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-30 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/02 Report--
The difference between classes and objects
Class: mold
Object: product (finished product)
For example:
Var arr1=new Array (12, 10, 11, 112, 111, 52)
Array: class
Arr1: object
Can only arr1.push (), not Array.push ()
Use constructor to add attributes, prototype add method
Function createPerson (name,qq) / / constructor
{
/ / after the new is created, the system automatically declares:
/ / var this=new Object ()
This.name=name
This.qq=qq
/ / return obj
/ / the system will automatically return:
/ / return this
}
Var obj=new createPerson ('Zhan Shaonan', '265404540')
Var obj2=new createPerson ('Esteban', '112233')
CreatePerson.prototype.showName=function () / / prototype
{
Alert ('my name is:'+ this.name)
}
CreatePerson.prototype.showqq=function ()
{
Alert ('my QQ is:'+ this.qq)
}
Obj.showName ()
Obj.showqq ()
Obj2.showName ()
Obj2.showqq ()
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.