TypeScript - Lambda
TypeScript 支援 Lambda 語法,語法如下:
(input parameters) => expression
(input parameters) => {statement;}
寫起來就像下面這樣:
var Execute = (cmd: string, ...params: string[]): void =>
alert(cmd + "(" + params.join(", ") + ")");
Execute("Test", "Param1", "Param2");
{% img /images/posts/TypeScriptLambda/1.png %}