gpt4 book ai didi

javascript - <| 是什么意思?这段代码的意思是?

转载 作者:行者123 更新时间:2023-12-03 00:00:51 26 4
gpt4 key购买 nike

function foo() {}
var bar = foo <| function() {};

我还是第一次见到这样的事情。 <| 是什么意思?意思是?

来源:https://github.com/allenwb/ESnext-experiments/blob/master/ST80collections-exp1.js

最佳答案

现在您已经发布了源链接,您可以在文件顶部的注释中准确地看到它的作用 ( line 36 ):

the <| operator -- defines the [[Prototype]] of a literal...

For these examples <| used with a function expression sets the [[Prototype]] of the object created as the value of the function's "prototype" property to the value of the "prototype" property of the the LHS object. This is in addition to setting the [[Prototype]] of the function object itself. In other words, it builds sets the [[Prototype]] of both the function and of function.prototype to potentially different values.

更新:当我遇到 full ECMAScript Harmony proposal for this "literal [[Prototype]] operator" 时,我才想起这个问题。 。其中的信息比上面引用的信息多得多,因此值得一读。

关于javascript - <| 是什么意思?这段代码的意思是?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7208645/

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