gpt4 book ai didi

javascript - JavaScript 中的 'in' 函数是怎么回事?

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

最近破坏了我的代码的是我天真地认为:

'+' in ['+','-',...] = true

唯一的问题是它实际上评估为 false!

请有人帮我理解这里发生了什么!

最佳答案

The in operator returns true if the specified property is in the specified object or its prototype chain.

来源:https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/in

关于javascript - JavaScript 中的 'in' 函数是怎么回事?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57977581/

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