JavaScript Context Dependent Semantics: p in o
In JavaScript, you have these syntax:
p in o
- check if property exist. 〔see JS: “in” Operator〕
for (p in o) {…}
- enumerate properties. 〔see JS: for-in Loop〕
Both contains
p in o
,
but their meaning is very different.
In other words, the in
operator has context dependent semantics.