|
|
The JavaScript interpreter supports some usefule classes and function.
They will be explained here.
You should be common with JavaScript, if not go, by a book and learn it.
It's very easy if you already know C++ or an other programming language.
It should be clear that none of the classes or functions that are implemented
in common browsers are available here. We are using only the language JavaScript.
| |
|
Some of the builtin functions are supporting overloading
and default parameters, even if this is normally not possible in JS.
But I wanted to reduce the overhead.
Definition:
- Class: Foobar
-
- Constructors:
-
Foobar();
// default constructor
Foobar( String text );
- Functions:
-
String bar();
String foo( String text, String other_text = hello );
// do something
String foo( Int i );
- Variable:
-
String err;
// Error Code
|
- Constructors
-
By using a constructor a new instance of a class will be generated.
At our example there are two constructors. The only difference between
them is the number of parameters. This means you can construct the
class by using two different methods.
Example:
var foobar_1 = new Foobar();
// first method
var foobar_2 = new Foobar( "foobar" );
// second method
|
- Functions
-
You can use the function as usal, but the functions can be exist more than once,
if the number of type of the parameter varies. If a value for a parameter is given
it will be used as default value.
Example:
foobar_1.bar()
// normal function call
foobar_1.foo( 123 );
// calling one version of the foo function
/* calling one version of the foo function, the default parameter won't be used. */
foobar_1.foo( "foo", "bar" );
/* calling one version of the foo function, the default parameter will be used. */
foobar_1.foo( "foo" );
|
| |
|
This page was created by
King Leo
. Page generator was
Leo<HTML>
version
0.99.0
.
|