This page is severely out of date, please go to Read The Docs for the full docs
# operator which can remove the need for some brackets. Input is also stored in some variables. Output is implicit.
TeaScript is a compiled language, or specifically, transpiled. This is done with the help of Babel.js.
readline may also be used depending on the enviorment. TeaScript can take multiple inputs.
||Array of inputs|
The output is the value of the last evaluated expression. To put simply, this means that the last thing run is the output. The global
L can also be used to output but this is not implemented yet in the online interpreter.
To avoid accidentally parsing within strings. In syntax can be relatively strict in some places.
To shorten function declarations, you can write
(# instead of
Normally, when defining functions, you would need to write something like this:
array.map((item, index, array)=> /* code */ )
To avoid rewriting this over and over. You can simply use a
array.map(#/* code */)
This will compile to...
array.map((l,i,a)=>/* code */)
Array / String indexes
This works in a similar way as above. When you have a function and then and then an array key. You may use an alternative syntax to shorten this.
Essentially what the
# does is:
#n where n is a digit or letter becomes:
An example, if you were to get the n-th item from a string:
This can become:
In some cases you can completely remove periods (e.g.
strslice). After the characters
xliaLSAX$`)/]'", any letter/character will be considered a property. That probably sounds confusing so if you speak regex, it's matched by,
[xliaLSAX$`)\/\]'"][A-Za-z0-9]. The full RegExp used is:
Because this is probably very confusing, some examples:
x.S(3) -> xS(3) l.S(3) -> lS(3) i.S(3) -> iS(3) a.S(3) -> aS(3) b.S(3) -> b.S(3) // Period can't be removed because of 'b'
And for parenthesis:
x.S(3).s`` -> xS(3)s`` b.S(3).s`` -> b.S(3)s``
Abbreviations / Property Names
The shortening or property names is probably one of the most important aspect of TeaScript, because new built-ins / shortened property names are added all the time, it would be difficult to keep this list up to date. You may see the list at website.
1-byte Special Characters
With ISO-8859-1 (not UTF-8), certain characters will be replaced with longer character sequences at compile-time.
Will be converted to:
A full list of these can be found in the properties json file, here (line 68).