Copy codeThe Code is as follows: <Head>
<Meta http-equiv = "Content-Type" content = "text/html; charset = UTF-8">
<Title> test </title>
</Head>
<Body>
<Script type = "text/javascript"> <! --
Function Man (name, age ){
// Define instance attributes
This. name = name;
This. age = age;
}
// Define static attributes. The default gender is male. transgender is not excluded. ^ v ^
Man. sex = 'male ';
// Define prototype attributes
Man. prototype. phone = '000000 ';
// Except name. sex and Man. prototype. phone, all others are Undefined.
Alert (Man. sex + "-----" + Man. prototype. phone + "--" + Man. name + "--" + Man. age + "--" + Man. phone );
Var man = new Man ("Tom", 24 );
Alert (Man. sex + "--" + man. name + "--" + man. age + "--" + man. phone );
/**
* Example: the prototype attribute is used as the instance attribute of the class after being instantiated.
* However, instance attributes cannot be used as prototype attributes after being instantiated.
*/
// --> </Script>
</Body>
</Html>