Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What are the advantages of ES5 over ES3?

Tags:

ecmascript-5

Maybe it's a basic question, but what differences are there between: - a web project developped with ES3 support and - a web project developped with ES5 support?

In other words, what enhancements can you add to your projects if you support ES5 ?

like image 227
Johan Chouquet Avatar asked Jun 11 '14 09:06

Johan Chouquet


People also ask

What is difference between ES5 vs ES6?

Difference between ES5 and ES6ES5 supports primitive data types that are string, number, boolean, null, and undefined. In ES6, there are some additions to JavaScript data types. It introduced a new primitive data type 'symbol' for supporting unique values.

Why is ES6 better than ES5?

If you want to give some parameters default values, ES6 allows you to do that with much less syntax than ES5. Spread operator: The spread operator has many more applications. The spread operator took the individual values from the array and added them into the new array.


1 Answers

It's probably hard to list here all things that are new in ES5, but the ones that may be helpful in your case are mostly related to language improvements. Some of the key points:

  • Methods for searching and manipulating array contents: indexOf, map, filter, reduce, forEach, etc.
  • Standard of representation for dates as strings (ISO 8601).
  • Functions for converting objects to and from JSON
  • 'use strict' - strict mode changes some JavaScript silent errors to throw errors, fixes some Javascript mistakes to enable better optimisation and so on.

Switching to ES5 can probably speed up your development process a bit and can help make your code robust and optimised.

like image 127
Grzegorz Kapusta Avatar answered Sep 17 '22 05:09

Grzegorz Kapusta