-
针对数组的析构表达式 + resetspread
查看全部 -
析构表达式,参数要和返回时的参数名相同,不然会报错,得到的参数数量和返回时的数量不同不要紧
查看全部 -
死循环与generator
查看全部 -
generator 方法,控制程序进行到哪一步,function变为function* ,并再断点处使用yield 关键字。
使用时必须用一个变量赋值为改函数后再调用.next()方法。
查看全部 -
形参个数固定,传参个数不定
查看全部 -
RESET操作符,定义不定数量的参数 ...args
查看全部 -
可选参数必须在必选参数后面,可选参数若为定义,注意方法里的内容是否会出错
查看全部 -
参数添加默认值,并且设置在最后面
查看全部 -
参数的各种类型
查看全部 -
var arr = [1,2,3,4,5,6] var [,,n1,n2,...others] = arr console.log(n1,n2,others) // 3 4 [4,5,6]
查看全部 -
// 析构表达式 var obj = { shop:'tixudao', price:{ originPrice:20, countPrice:10 }, logo:'xxx.png' } var {shop,price:{originPrice},logo:shopLogo} = obj; console.log(shop) console.log(originPrice) // 获取引用对象类型中的值 console.log(shopLogo) // 给获取的值重命名
查看全部 -
参数新特性(:) 五种基本类型: string any number boolean void(不返回任何值) 类型自动识别机制(在第一次生成时会自动识别类型) 自定义类型 class Person { name:string; age:number; } var demon:Person = new Person() demon.name = 'demon'; demon.age = 16
查看全部 -
//字符串新特性(``) --多行字符串 在字符串模版中可以添加回车进行换行 //字符串新特性(``) --字符串模版 //字符串新特性(``) --自动拆分字符串 function test(template,name,age){ console.log(template) console.log(name) console.log(age) } var mname = 'demon' var mage = 18 test`hello my name is ${mname},i'm ${mage}` echo array(3) demon 18
查看全部 -
// 安装tssudo npm install -g typescript // 查看ts版本 tsc -version // 执行ts文件 编译为js tsc hello.ts
查看全部 -
npm install -g typescript
安装完了后 tsc --version检查是否安装成功
命令行 tsc xxx.ts即可在同级目录下将ts转为js文件
查看全部
举报
0/150
提交
取消