Adding a constructor to a custom data class

so, Iv made a class, with some variables, how do I add a function to it so like with say Vector3() I can have a constructor like AmmoType(“Shells”,0) instead of
var a : AmmoType;
a.type = “Shells”
a.ammount = 0;

how do I make it so it has a constructor that will return it?

in js plz

thanks

To make a constructor in C# (javascript don’t need the public I suppose) :

public CLASSNAME( ARGUMENTS )
{
   // affect your class variables and do whatever you want here.
}

For Javascript,

function ClassName(args : type)
{
    // Stuff
}

It is just a normal function with the function name being the same as the class’s name.