Is property value shorthand in objects compatible with all browsers?

Question

Is property value shorthand in objects compatible with all browsers?

Answer

Not quite, most are, but Internet Explorer 11 is not compatible, although there are libraries called transpilers, like babel, that can be used to change our code from ES6+ to ES5 once we are done writing and we are ready to test everywhere.

18 Likes

thanks for the heads up

Thank you for your insight! Is there any way of finding out the compatibility for each browser?

yep, caniuse is often very helpful. Couldn’t find it on there, with some googling i got to MDN:

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Object_initializer

at the bottom is browser compatibility table, including Shorthand property names, only Internet Explorer has no support at all.

6 Likes

Perfect! Thank you - I’ve got this bookmarked. It wouldn’t surprise me that IE wouldn’t have any support :rofl:

That is very correct

Who uses Internet Explorer in 2020 anyways? Microsoft even dropped it in favor of their new Microsoft edge browser which uses the same engine as google chrome

1 Like

Some companies like banks. We all hate Microsoft (Internet Explorer), but some people have to work with it.