← Back to Tutorial
TypeScript Compiler
TypeScript Code
Clear
Compile ▶
let flexible: any = "I can be anything"; flexible = 42; flexible = { name: "Alice" }; let uncertain: unknown = "I need checking"; if (typeof uncertain === "string") { console.log(uncertain.toUpperCase()); } else if (typeof uncertain === "number") { console.log(uncertain.toFixed(2)); }
Output
Download JS
TypeScript code will be compiled here