-
Notifications
You must be signed in to change notification settings - Fork 103
Literals
kazuho edited this page Jul 2, 2012
·
11 revisions
Literals of JSX is mostly the same to that of JavaScript.
Literal | Description |
---|---|
null [: type] | declares null, may have the type attributed |
false | a boolean constant |
true | a boolean constant |
Identical to JavaScript.
Identical to JavaScript.
Identical to JavaScript.
// a function that takes no arguments, and returns void
function () : void {}
// a function that takes one argument (of number) and returns a number that in incremented by one
function (n : number) : number {
return n + 1;
}
// the argument types and return types may be omitted (if it is deductable from the outer expression)
var sum = 0;
[ 1, 2, 3 ].forEach(function (e) {
sum += e;
});
log sum; // 6