DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports Events Over 2 million developers have joined DZone. Join Today! Thanks for visiting DZone today,
Edit Profile Manage Email Subscriptions Moderation Admin Console How to Post to DZone Article Submission Guidelines
View Profile
Sign Out
Refcards
Trend Reports
Events
Zones
Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Partner Zones AWS Cloud
by AWS Developer Relations
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Partner Zones
AWS Cloud
by AWS Developer Relations
  1. DZone
  2. Data Engineering
  3. Data
  4. Guide to New JavaScript Features Introduced at Google I/O 2019

Guide to New JavaScript Features Introduced at Google I/O 2019

Ryan Kh user avatar by
Ryan Kh
·
Aug. 12, 22 · Presentation
Like (3)
Save
Tweet
Share
17.95K Views

Join the DZone community and get the full member experience.

Join For Free

google-sign-graffitti

On May 6 and 7, 2019, the most recent Google I/O conference was held. This is an annual technology event that has been organized by Google every year since 2008. The forum brings developers worldwide to present and discuss topics related to Google products, open Internet technologies, and new trends in the software industry.

One of the biggest trends covered at this event was a series of changes to JavaScript. Mathias Bynens and Sathya Gunasekaran covered many of these changes in a talk titled: "What's new in JavaScript." 

This is a great video to check out. These two men have worked on Google's V8 JavaScript engine project, so they are very knowledgeable about the impact of these changes. However, we wanted to summarize the changes here.

You may also like: How JavaScript Actually Works: Part 1.

Recent Google Conference Highlights the Evolution of JavaScript

JavaScript is no longer a programming language used only to develop front-end web applications. Based on interviews with several programmers from the coworking space, JavaScript has become a powerful language and is widely used for:

  • Desktop applications with Electron.

  • Multiplatform mobile applications with React Native.

According to the 2019 StackOverflow survey, JavaScript is the most popular programming language.

Several new JavaScript features and specifications have been released. The 2019 Google I/O forum outlined all of these changes.

JavaScript Continues to Transform

One of the most interesting things about JavaScript is how much it continues to transform over time. It is believed that JavaScript has been and will continue to be one of the most transformational pieces of software in the industry. 

There is a good chance that it will be used in ways that we haven’t even thought of yet, and it is important to keep this in mind as people continue to work to figure out what they can learn from everything that has happened to JavaScript already. 

There is simply no way around the fact that many people will ultimately need to use JavaScript as a primary way to continue to program their latest inventions, and it is great news that it is still working to improve itself every day. 

JavaScript Features Announced at Last Year’s Google I/O Conference

Multiple new JavaScript changes were originally revealed in the 2018 Google I/O conference but were not compatible with all browsers until now. In 2019, these functions will be implemented in every major browser.

Iterations and Asynchronous Generator Features

Iterators can be described as pointers that sequentially run through data structure elements. These include every string, array, set, and a map within these structures. The Symbol.iterator key can be used to iterate through these features. The next defined method is also useful. This feature can return the properties listed below:

  • Value: This variable returns the value for the very next element in a given sequence called with the nextdefined method.

  •  Done: This Boolean variable references the secession of a sequence.

An iterator or generator can be used to asynchronously read data streams. This is very similar to the syntax of the command known as  async-await, but there are a couple of important differences.

This command will wait until the URL response has been received. After this condition is satisfied, fragments of data are released and appended to the variable. A while() function continues until the sequence is completed. You can see how these changes have made JavaScript cleaner and less detailed.

The loop-await-of continues receiving response data from the URL, and the process is terminated once the stream is complete.

Finally, for Your Promises

The new version of JavaScript uses the block for promises. This code is contained within the block and executed after the promise is rejected or resolved.

Option to Write Catch Blocks

You no longer need to pass an argument when writing a catch block.

Trimming on Various Sections of String

The trim function most commonly removes white space from a string variable. However, you might not want to remove whitespace from the entire string. You can use the trimEnd and trimStart functions to delineate the parts of the string that you want to trim.

Spread Command for Objects

The spread operator will be not only available not only with arrays but also in JavaScript objects. The spread syntax operator is valuable for object cloning.

Attributes of a Class

There are two improvements related to the attributes of a class. The first is to remove the builder function.

The constructor in the previous class is used to create an instance of the objects and assign a default value to the _country attribute. The underscore at the beginning of the variable name is a convention for declaring private attributes of the class.

However, it is only a convention and not something that is strictly applied. This means that anyone can access the _country property and could change the name of the destination country because the _country attribute remains publicly accessible.

Unless you make an internal change when assigning a value to the _country attribute, the function that assigns the value to the attribute previously retrieves the country name from the random function. In this way, the value cannot be assigned from the direct assignment to the instantiated object.

The syntax of classes is improved by removing the class builder and directly initializing all top-level class attributes. The other significant improvement is making every private member truly private.

New Array Methods: flat and flatMap

The flat method creates a new array containing elements and/or arrays the main array may contain.

New Object.fromEntries() method

The Object.fromEntries() method transforms a list of key-value pairs into an object. It produces a result contrary to the Object.entries() method.

With the Object.fromEntries() method, the opposite happens. That is, it converts an object into an array.

Further Reading

  • Three JavaScript Array Methods Every Developer Should Know.
  • Functional Programming in JavaScript.
  • JavaScript Objects in Depth, Part 1: The Fundamentals.
JavaScript engine Google (verb) Data structure

Opinions expressed by DZone contributors are their own.

Popular on DZone

  • Spring Boot vs Eclipse MicroProfile: Resident Set Size (RSS) and Time to First Request (TFR) Comparative
  • Cloud Performance Engineering
  • gRPC on the Client Side
  • Building a Real-Time App With Spring Boot, Cassandra, Pulsar, React, and Hilla

Comments

Partner Resources

X

ABOUT US

  • About DZone
  • Send feedback
  • Careers
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 600 Park Offices Drive
  • Suite 300
  • Durham, NC 27709
  • support@dzone.com
  • +1 (919) 678-0300

Let's be friends: