Amongst the new features released with the new are a bounty of new built-in methods. These new methods aim to simplify and standardize some familiar scenarios that developers encounter when working with JS data types like , , and . ES6 standard in Javascript Numbers Strings Object Arrays One of the goals of ES6 was to make coding in JS cleaner and more concise, let’s take a look at how these new methods help move us towards that goal. In each code snippet below you will see: //ES6 — this is the new ES6 implementation of the feature //ES5 — this is the ES5 equivalent(if there is one) of the new ES6 implementation If you like this post check our last post on JS ES6 Proxies Introducing Javascript ES6 Proxies Object Property Assignment When working with objects you often need to combine 2 or more objects. The new function provides a clean method for doing just that. Object.assign() Object Merge Object.assign merge We start off with 3 Objects on lines 2–4 with the intention of combining them into the Object. In ES5 you had to loop through and independently append the values to the object. In ES6 you can do this with a single line of code(line 15). destination destination What happens when you merge objects with same properties you ask? Let’s see. Merge With Same Properties You can also use to clone Objects. Object.assign() Object Clone Object.assign clone Array Element Finding Commonly when working with Arrays you will want to find an OR the in an Array. ES6 provides 2 new Array methods and to do this. Let’s take a look at these new ES6 functions and their ES5 equivalents(there is no ES5 equivalent for ). element index of an element find() findIndex() It is important to note that will return the FIRST element in the Array that satisfies the provided testing function. find() findIndex() Line 7 and Line 12 accomplish the same thing, you can see the simplicity in the ES6 implementation on line 12. There is no ES5 equivalent for line 13(findIndex). Line 14 shows the function returning the element to satisfy the test. findIndex() FIRST String Repeating ES6 has added a simple new method. String.repeat() string repeating String Searching ES6 has added 3 new methods to aid the developer when searching for segments of text within a String. , and . This one I love because something about has always struck me as inefficient and error prone. startsWith() endsWith() includes() indexOf() string searching Number Type Checking There are several new functions for checking for non-numbers and finite numbers. and Number.isNaN() Number.isFinite() number type checking There are several things to note here: The differences between the new ES6 and the global are laid out pretty well and . Number.isNaN() isNaN() here here is actually infinity, it a numeric value that Infinity. The actual value is 1.797693134862315E+308. The same for _-Infinity, -_1.797693134862315E+308. Infinity NOT represents Number Sign Determination ES6 introduces a new function to determine the sign of a number including the special cases of and non-number. Math.sign() signed zero(-0) number sign determination So that’s it for Proxies in ES6. Let us know your thoughts and questions and follow us on . Keep after it. PLEASE twitter If you like this article, please recommend and share to help others find it!