| Start |
|---|
in with lists In Python this evaluates to True, but in JavaScript to false. This is because in Python in checks if a value is contained in a list, so 2 is in [2, 3] as its first element. In JavaScript in is used with objects and checks if an object contains the property with the name expressed by the value. So JavaScript considers [2, 3] as an object or a key-value map like this: and checks if it has a property or a key '2' in it. Integer 2 is silently converted to string '2'. |
Read Article
https://develop.horje.com/learn/1434/reference