功能后,JavaScript中的冒号是什么意思? [英] what does the colon mean in Javascript after function?

查看:115
本文介绍了功能后,JavaScript中的冒号是什么意思?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

功能

 功能setup():React我看到Facebook F8应用程序代码有一个:。组件{
...
}

这是什么意思?



继承?

解决方案

通常是流式注释,在这种情况下意味着 setup()返回一个React.Component。或者它也可以是TypeScript,在这种特殊情况下不能做出复杂的猜测。


I saw the Facebook F8 app code there is a ":" after the function

function setup(): React.Component {
  ...
}

what does this mean?

inheritance?

解决方案

Usually it's flowtype annotation and in this case means that setup() returns a React.Component. Or it could be TypeScript as well, can't make sophisticated guess in this particular case.

这篇关于功能后,JavaScript中的冒号是什么意思?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆