Complete the code to declare a variable that will appear in the compiled JavaScript.
let [1] = 5;
The variable name count will appear in the compiled JavaScript. Types like number, type, and interface are removed during compilation.
Complete the code to declare a function that will be present in the compiled JavaScript.
function [1]() { return 10; }
The function name calculate will appear in the compiled JavaScript. Types and interfaces like MyType, Number, and IResult are removed.
Fix the error in the code so that the variable survives compilation.
const [1]: string = "hello";
The variable greeting will be present in the compiled JavaScript. The type annotation : string is removed, but the variable name remains.
Fill both blanks to create a class and method that survive compilation.
class [1] { [2]() { return 42; } }
The class Calculator and its method compute will appear in the compiled JavaScript. Types like IResult and number do not survive.
Fill all three blanks to create an object with a property and a method that survive compilation.
const obj = {
[1]: 10,
[2]() { return this.[3]; }
};The property value and method getValue survive compilation. The method returns the property value. The type type does not survive.