Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Can somebody explain this short code

10 views
Skip to first unread message

Tony

unread,
May 23, 2013, 6:01:50 AM5/23/13
to
Note this code is autogenerated
What I don't understand is this
How is it possible to call function dsFrsvoyage_ttFrsvoyage when the
signature doesn't match.
The function dsFrsvoyage_ttFrsvoyage doesn't any argument but you can call
it with an argument.


function dsFrsvoyage()
{
this.ttFrsvoyage = new Array(1);
this.ttFrsvoyage[0] = new dsFrsvoyage_ttFrsvoyage(1);
}

function dsFrsvoyage_ttFrsvoyage()
{
this.Vesselid = "";
this.Arrtime = null;
this.Deptime = null;
this.Objecttype = "";
this.Dnggoods = false;
this.prevport = "";
this.port = "";
this.nextport = "";
this.VoyNum = "";
this.done = false;
this.sent = "";
this.todestination = "";
this.fromdestination = "";
this.Remark = "";
this.errstat = "";
this.cancelled = false;
this.Sendstat = "";
this.Objectid = 0;
this.UID = "";
this.UIDDATE = null;
this.UIDTIME = "";
this.UIDPGM = "";
this.Z_Seq = 0;
this.MISC1 = "";
this.MISC2 = "";
this.MISC3 = "";
this.UIDsign = "";
this.UIDupdate = null;
this.UIDuppgm = "";
this.UIDuptime = "";
}

//Tony

Tony Mountifield

unread,
May 23, 2013, 6:16:24 AM5/23/13
to
In article <knkp6o$sov$1...@dont-email.me>,
Yes, JS does not do any argument prototype checking, and you don't need
to name the parameters in the function definition.

The arguments are placed in an automagically-created object called arguments,
and then the elements are placed in any named parameters there might be.

function foo(a,b) {
// a contains arguments[0]
// b contains arguments[1]
// further arguments are just in arguments[2] onwards.
}

foo(11,22,33,44); // a=arguments[0]=11, b=arguments[1]=22, arguments[2]=33, arguments[3]=44

Since in your example, the generated function doesn't use arguments[],
the 1 passed in is ignored.

> //Tony

// Another Tony :)
--
Tony Mountifield
Work: to...@softins.co.uk - http://www.softins.co.uk
Play: to...@mountifield.org - http://tony.mountifield.org
0 new messages