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

2 Likes

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.

10 Likes

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

2 Likes

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

3 Likes

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

2 Likes

HaHaHaHaHaHa…

Thanks for the good laugh. I needed a good laugh while reading through this lesson :wink:

3 Likes

Even though ‘no one’ uses it, clients often want their website to be compatible with IE probably because they think people actually use IE - of course, some companies use IE as it can be hard to switch a whole company’s browser

So in the end, try to always make your website compatible with as many browsers as you can

3 Likes

Hi all!

How important it is for me to make it compatible with Internet Explorer?
I have to research who will be my target audience or there is a commun sense for senior developers when to let it go?

Cause for me seems to be impossible to know that all of my functions and statements will be compatible with all the browsers and its versions.

Another question: how can I know that my software will have some features broken in a new update?
Like, if I try to use chrome in my app there will be a warning before it turns deprecated or it just stop working one day?
There are any services that I can plug in my aplication that warns me about it?

yea, researching target audience is a good idea. But it might also be you need features not supported by IE. So then a decision needs to be made. Always a tricky balancing act. Experience at weighing the pros and cons is valuable here

you can check documentation (MDN, caniuse) for that. You don’t have to remember

Generally, there will be a deprecated warning in the console or in your text-editor or IDE. Then it often takes months if not years before the feature is actually removed.

Depending on how you build/setup your website, users might email you that some feature stopped working. Or maybe you have a monitoring tool and might notice something in unusual in this monitoring tool.