> LeekScript
LeekScript 3 is the third version of LeekScript, released on November 30, 2021.
It is now possible to declare anonymous objects with the following syntax:
And to use them as a classic object:
These objects have as class the class Object and cannot have methods, except Object.keys() and Object.values(). It is possible to add fields to them on the fly:
Here are all the reserved keywords from LeekScript 3, to name a variable, a function, a class, a method, a field etc. They are not all used in the language but are in anticipation of future versions:
The following methods and fields of reflection are added:
Object.keys(): returns an array of keys (in the form of character strings) of the keys (or fields) of the object:{ x: 1, y: 2 }.keys() === ['x', 'y'].Object.values(): returns an array of object values:{ x: 1, y: 2 }.values() === [1, 2].Class.name: returns the name of the class.Class.super: returns the super class of the class, null if it does not exist.Class.fields(): returns an array of fields (in the form of character strings) of the class:class A { a b } A.fields() === ['a', 'b'].Class.staticFields(): returns an array of static fields (in the form of character strings) of the class:class A { static c static d } A.staticFields() === ['c', 'd'].Class.methods(): returns an array of methods (in the form of character strings) of the class:class A { m() {} n() {} } A.methods() === ['m', 'n'].Class.staticMethods(): returns an array of static methods (in the form of character strings) of the class:class A { static o() {} static p() {} } A.staticFields() === ['o', 'p'].The base classes are introduced in the language:
null valuestrue and false12, 5.571 etc.12, -5 etc.[1, 2, 3] etc."hello" etc.{ x: 12 } etc.function() {}Number, Array, MyClass etc.We can therefore create values with these classes:
And use instanceof:
Impossible de charger les données du jeu.
Vérifiez votre connexion et réessayez.