typescript入门之函数箭头表达式

  • A+
所属分类:Angular

---
title: TypeScript入门之函数箭头表达式
date: 2018-10-23 16:49:45
categories: angular
tags:
- typescript
- 箭头
- 函数
---

箭头表达式是function(){},匿名函数的简写.旨在解决javascript的this指向问题.

写函数的时候也更简洁

typescript入门之函数箭头表达式

函数一个参数的时候小括号可以不 写,写在一行后面的大括号可以不写,return也可以不写,

如果写了大括号就必须加上return,上面的例子第二个括起来的就是没写return...所以是错误的写法

ZPY

发表评论

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen: