Skip to content

Instantly share code, notes, and snippets.

@diverted247
Created December 13, 2012 18:27
Show Gist options
  • Save diverted247/4278497 to your computer and use it in GitHub Desktop.
Save diverted247/4278497 to your computer and use it in GitHub Desktop.
TypeScript Function Initializers
function strange(x, y, z) {
if (typeof y === "undefined") { y = x * 2; }
if (typeof z === "undefined") { z = x + y; }
return z;
}
function strange( x: number , y = x * 2 , z = x + y ) {
return z;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment