我最近围绕JS代码戳返回类型,我发现了以下注释:明确设置的功能
/**
* Explicitly set the return type here to prevent the primitive being lost when using new
* @return {boolean}
*/
function giveMeABoolean(please) {
...
}
是怎么回事?在JS中返回类型?我一直在网上搜索,无法找到任何关于此的信息。经过一些测试后,使用新没有注释时,原语确实丢失。任何人都可以解释这个注释如何工作?
注释不改变行为的。所有评论都被口译员抛弃。 –