默认参数,方法的默认值 function test (a:string, b:string, c:string="jojo"){//declare in the last
console.log(a);
console.log(b);
}
console.log(a);
console.log(b);
}
2017-11-06
字符串特性:
多行字符串·· 撇号
字符串模板:${}
自动拆分字符串function test(template, name, age) {
console.log(template);
console.log(name);
console.log(age);
}
let myname: string = "qiubo";
let age = 18;
test`my name is ${myname}, I'm ${age}`
多行字符串·· 撇号
字符串模板:${}
自动拆分字符串function test(template, name, age) {
console.log(template);
console.log(name);
console.log(age);
}
let myname: string = "qiubo";
let age = 18;
test`my name is ${myname}, I'm ${age}`
2017-11-06
本地开发使用npm(node package management)
npm --version
npm install -g typescript (全局安装) tsc (typescript compiler)
export class Hello {
//delare a class}
tsc Hello.ts --> Hello.js
IDE里开发 webstorm
npm --version
npm install -g typescript (全局安装) tsc (typescript compiler)
export class Hello {
//delare a class}
tsc Hello.ts --> Hello.js
IDE里开发 webstorm
2017-11-06
环境:安装compiler(convert ts to js),让浏览器支持;
在线:http://www.typescriptlang.org/ playground
在线:http://www.typescriptlang.org/ playground
2017-11-06
找到了,babel的控制台输出是要在左边settings里选中Evaluate,然后打开F12控制台,就能看到输出!
2017-11-06