Functional JavaScript-compatible programming language
- Subset of ES3
- Import external JavaScript
- Type annotations
To keep ES3 compatibility, type annotations can be expressed as comments
//@: a -> a
var identity = function (value) {
return value;
};
Type annotations will be applied to the next function expression found
Inline annotations are also valid
var api = {
identity: /*@: a -> a */ function (value) {
return value;
}
};
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects
module
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators
Primary expressions
function
: function expression[]
: array initializer{}
: object initializer()
: grouping operator
Left-hand-side expressions
object['property']
: property accessors
Unary operators
!
: logical not
Arithmetic operators
+
: addition-
: substraction*
: multiplication/
: division%
: remainder
Relational operators
<
: less than>
: greater than<=
: less than or equal>=
: greater than or equal
Equality operators
===
: identity!==
: non-identity
Binary logical operators
&&
: and||
: or
Assignment operators
=
: assignment
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements
Control flow
{}
: blockif...else
: executes a statement if expression is truethrow
: throws a user-defined exceptiontry...catch
: mark a block of statements to try
Declarations
var
: declares a variable, optionally initializing it to a value
Functions and classes
return
: specifies the value to be returned