Predict 函数返回输出
预测输出 简单
题目
什么做 这个 code print?
代码
function add(a: number, b: number): number {
return a + b;
}
function greet(name: string): string {
return `Hello, ${name}`;
}
console.log(add(3, 4));
console.log(greet("Ada"));
提示
返回类型 annotations 是 erased at 运行时 — 只是 compute 值.
解释
添加(3, 4) 返回 7. greet("Ada") 返回 "Hello, Ada" using template literal. 类型 annotations 是编译-时间仅 and 有否 运行时副作用. 输出: 7 and Hello, Ada on separate 行.
查阅不认识的术语
新手友好的术语表用大白话解释编程术语——变量、函数、DOM、Promise 等等。
解读错误信息
用大白话解释常见错误——什么意思、为什么发生、如何修复。
动手做项目
通过引导式项目应用所学,含起始代码与解决方案。