gpt4 book ai didi

coffeescript - CoffeeScript 中的非表达式是什么?

转载 作者:行者123 更新时间:2023-12-01 12:56:59 25 4
gpt4 key购买 nike

我在看this great video由 Jeremy 在 CoffeeScript 上发表。他解释说,CoffeeScript 的理想之一是让“一切都是表达式”。

CoffeeScript 离这个理想有多近?什么是 CoffeeScript 非表达式?

最佳答案

the documentation 中所述,有一些内容未在 coffeescript 中转换为表达式。 :

There are a handful of statements in JavaScript that can't be meaningfully converted into expressions, namely break, continue, and return. If you make use of them within a block of code, CoffeeScript won't try to perform the conversion.

其他所有东西都包裹在函数闭包中并由 coffeescript 处理,这意味着你可以做一些很酷的事情,比如

alert(
try
nonexistent / undefined
catch error
"And the error is ... #{error}"
)

关于coffeescript - CoffeeScript 中的非表达式是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9140946/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com