'foo in bar' evaluates to null if bar is a native JavaScript Object
See original GitHub issueThis looks wrong to me, @chochos:
dynamic {
dynamic obj = dynamic [];
Boolean bool = 0 in obj;
print(bool);
}
Prints <null>
.
Issue Analytics
- State:
- Created 7 years ago
- Comments:19 (19 by maintainers)
Top Results From Across the Web
Check if a value is an object in JavaScript - Stack Overflow
The Object constructor creates an object wrapper for the given value. If the value is null or undefined, it will create and return...
Read more >Optional chaining (?.) - JavaScript - MDN Web Docs
The optional chaining ( ?. ) operator accesses an object's property or calls a function. If the object is undefined or null ,...
Read more >Object destructuring best practice in Javascript | by Crunch Tech
The object destructuring assignment syntax gives us a third way to access object properties: const { foo } = myObj // 'bar'
Read more >The 10 Most Common JavaScript Issues Developers Face
If you need help figuring out why your JavaScript isn't working, ... var object = {foo: "bar", foo: "baz"}; ) or a duplicate...
Read more >The Best JavaScript Examples - freeCodeCamp
Argument Example The arguments object is an array-like object (in that ... "foo" + "bar" // concatenates the strings and returns "foobar".
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
And nobody likes my idea to just create two toplevel functions to create empty objects and arrays? Because I find the whole business of
dynamic
vsdynamic []
somewhat cryptic (and highly JS-specific, if we ever implementdynamic
for the Java backend creating empty objects and arrays makes little sense). Using functions would make it very explicit what you’re doing.I doubt that those other languages will map perfectly to JS’ idea of hashmaps and arrays, so if we would ever support them as a backend we’d probably have to come up with other conventions for their constructs. To me this seems like one of these ad-hoc decisions just to make things work. Especially when creating a special syntax that only works for specific backend(s).