我在几个地方见过这个
function fn() {
return +new Date;
}
Run Code Online (Sandbox Code Playgroud)
我可以看到它返回的是时间戳而不是日期对象,但我找不到有关加号正在做什么的任何文档.
谁能解释一下?
为什么"counter"和"type"在以下摘录中以加号为前缀?
export type counterStateType = {
+counter: number
};
type actionType = {
+type: string
};
Run Code Online (Sandbox Code Playgroud)
(这段代码取自我试图解决的电子反应样板应用程序.我已经用Google搜索和binged,我设法建立的是类型来自"Flow").