I am a C# developer that is trying to get his hands on JavaScript as well.
For a data handling program, I want to create a data structure like:
id,
begin,
end,
organiser,
name,
city,
postalcode,
street,
venue,
name,
city,
postalcode,
street
Coming from C#, I would create a "class" (gig.js) for the main structure:
function Gig(gig)
{
this.id = gig.id;
this.begin = gig.begin;
this.end = gig.end;
this.organiser = gig.organiser;
this.venue = gig.venue;
}
and a "class" (address.js) for organiser and venue:
function Address(a)
{
this.name = a.name;
this.city = a.city;
this.postalcode = a.postalcode;
this.street = a.street;
}
As I need to refer to the Address-class in the Gig-class, I wanted to reference the address-class in the main class, like
include address.js
I have searched through the web and to my huge surprise, there seems to be no include mechanism at all. HTML5 introduced a way to include JavaScript in another JavaScript, but is seems like no browser is supporting this so far I red some possible solutions here but they all look like hacks for a (from what I expected) simple one line code.
So, how do you do using another JavaScript-File nowadays? Do I need to use an other architectural approach for this? Do I simply include them in the calling html and when I write the code for the main class, I simply hope, that the address class was loaded as well?
Thanks in advance,
Frank