ES6 Tutorial for Beginners Part 2 | ECMAScript 6 Tutorial | Angular JS Tutorial for Beginners

preview_player
Показать описание

ES6 Tutorial for Beginners Part 2 | ECMAScript 6 Tutorial | Angular JS Tutorial for Beginners
Hello, and welcome to the Front-end web development Advanced training conducted by Acadgild. In Here in this tutorial you will learn the concepts of ES6 and it is a sequel to the first part.

Agenda of this training Session: to learn the following topics in-depth.
• What are Set & Maps
• What are Rest Parameters
• What is Spread
• What are iterators
• What are Generators
• What are classes
• What is inheritance
• Get & Set
• Module

Sets and Maps:
Sets:
• ES5 doesn’t have a set data structure.
• The set object lets you store unique value of any type, whether primitive values or object references
• Set objects are collections of values, you can iterate its elements in insertion order. A value in the set may only occur once; it is unique in the set’s collection.
Maps:
• The Map object is a simple key/value map.
• Any value (both object and primitive values) may be used as either a key or value.
• A map object iterates its elements in insertion order

WeakMaps
• WeakMaps provide leak-free object keyed side tables. It’s a Map that doesn’t prevent its keys from being garbage collected. We don’t have to worry about memory leaks.
• If the object is destroyed, the garbage collector removes an entry from the WeakMap and frees memory
• It has almost the same API like a Map, but we can’t iterate over the WeakMap collection. We can’t even determine the length of the collection because we don’t have size attribute here.

Rest Parameters
• The rest parameters syntax allows us to represent an indefinite number of arguments as an array.
• In the above example, theArgs would collect the third argument of the function because the first one is mapped to a, and the second to b and all the consecutive arguments.
• If we want to use ES5, we probably also want to use arguments object.
• But It’s not obvious that the function is capable of handling any parameters. We have to scan a body of the function and find arguments object.
Spread:
• The spread is closely related to rest parameters, because of … (three dots) notation. It allows splitting an array to single arguments which are passed to the function as separate arguments.
Iterators:
• An iterator is an object with a next method that returns tuples.
• ES6 gives us a pattern for creating custom iterators and it has a similar implementation to iterable or __next__in python.
• It has built-in iterable: string, array, TypeArray, Map and Set, an iterator object can be any object with a next () method.
Iterables:
• Data structures that can be iterated over are called iterable in ECMAScripts 6
• They have a method that returns an iterator for all of their elements
• Symbol is, in turn, an unique and immutable data type which can be used as an identifier for object properties -no equivalent in ES5

Generators:
• Generators are special kind of function that can be suspended and resumed.
• They have yield operator which could be called a “resumable return”: it returns value, but when the generator is resumed, execution doesn’t start fresh, it continues after the yield.
• Generators are tightly integrated with iterators in ECMAScript 6

Classes: Classes are something like another syntactic sugar over the prototype-based OO pattern.

Get & Set: Other great things in upcoming ES6 are getters and setters for object properties

Go through the entire video to learn more about ES6 part 2 in-depth. Happy Learning!!

For more updates on courses and tips follow us on:
Рекомендации по теме