Basics
Challenges
Classes
Debugging
Events
External Files
Flow Control
Forms
Functions
Html Elements
Installation
Interfaces
Keywords
Modules
Namespaces
Operators
Reference Files
String
Types
A Lambda expression can also be referred to as a "arrow function". It "returns this".
// example 1
// streamlined version of Arrow Function
var RandomMath = (x: number, y: number) => x + y;
// example 2
class VendingMachine
{
private _paid : number = 0;
// method which accepts arg Type of 'coin'.
AcceptCoin(coin : Quarter) : void
{
this._paid += coin.ValueOfCoin;
}
}
...becomes...
class VendingMachine
{
private _paid : number = 0;
// method which accepts arg Type of 'coin'.
AcceptCoin = (coin : Quarter) : void =>
{
this._paid += coin.ValueOfCoin;
}
}