Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

It only throws if you access the property with the [] or . syntax, so I don't think this particular thing is a big problem.


What other syntax is there to access a property?


They only barely mention it, but I think they expect you do to `foo = 'foo' in obj ? obj.foo : undefined` instead of `foo = obj.foo`


I really doubt it, as that's an unsound bypassing of the type system. Missing properties are slow in JavaScript, because the in-memory representation of the class has to be modified when new properties are added. Given that strong mode is about performance, it would make far more sense to just prohibit missing properties and encourage use of other ES6 language mechanisms such default parameters instead.


You check if is there before you access it with . or [].


Oh right. I love those null/undefined checking chains, it really puts the Java in JavaScript.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: