Try to write JS with the object-oriented approach
// Define a JS object
Function Evatemplate_indexlinkinfo (ID, templateid, elementid, ismust, index, weight)
{
This . ID = ID;
This . Templateid = Templateid;
This . Elementid = Elementid;
This . Ismust = Ismust;
This . Index = Index;
This . Weight = Weight;
// Example method 1
This . Equals = Function (OBJ)
{
If (Obj1.templateid = Obj2.templateid
&& Obj1.elementid = Obj2.elementid
&& Obj1.ismust = Obj2.ismust
&& Obj1.index = Obj2.index
&& Obj1.weight = Obj2.weight)
Return True ;
Return False ;
}
}
// Example method 2
Evatemplate_indexlinkinfo.prototype.equals = Function (OBJ)
{
If (Obj1.templateid = Obj2.templateid
&& Obj1.elementid = Obj2.elementid
&& Obj1.ismust = Obj2.ismust
&& Obj1.index = Obj2.index
&& Obj1.weight = Obj2.weight)
Return True ;
Return False ;
}
// Static Method for Determining whether two instances are equal (in fact, it is a disguised static method)
Evatemplate_indexlinkinfo.equals = Function (Obj1, obj2)
{
If (Obj1.templateid = Obj2.templateid
&& Obj1.elementid = Obj2.elementid
&& Obj1.ismust = Obj2.ismust
&& Obj1.index = Obj2.index
&& Obj1.weight = Obj2.weight)
Return True ;
Return False ;
}