What does [literal] in [array/object] mean?

后端 未结 5 578
忘掉有多难
忘掉有多难 2021-01-23 12:20

What does the following syntax mean:

1 in [1,2,3,5]

I know it doesn\'t search for 1 in the array. But what does it do?

I\'ve seen it u

5条回答
  •  后悔当初
    2021-01-23 13:25

    'in' operator returns true if specified property exists in specified object; used in a loop it allows you to iterate over all properties of the object

提交回复
热议问题