Modern JavaScript: Leveling Up Arrays and Intl

This ad is not shown to multipass and full ticket holders
JSNation US
JSNation US 2026
November 16 - 19, 2026
New York, US & Online
Upcoming event
JSNation US 2026
JSNation US 2026
November 16 - 19, 2026. New York, US & Online
Bookmark
Rate this content
Sentry
Promoted
Code breaks, fix it faster

Crashes, slowdowns, regressions in prod. Seer by Sentry unifies traces, replays, errors, profiles to find root causes fast.

Get started

Since JavaScript releases new features every year now, you might miss some of the cool updates to built-in objects like Array and Intl. We'll explore new methods and objects like Array.fromAsync() and Intl.Segmenter, and show you how to navigate browser support for new features so you can remove external libraries or transpiling steps. 

This talk has been presented at JSNation US 2024, check out the latest edition of this JavaScript Conference.

FAQ

Mariko uses the handle 'kosamari' on most social platforms.

Tools like Babel became important for preprocessing JavaScript code in Mariko's development workflow.

The Baseline project provides clear information about which web platform features are supported across major browsers, helping developers assess feature interoperability and browser compatibility.

Mariko discussed new array methods like Array.flat, Array.toReversed, Array.toSorted, and Array.toSpliced.

The intl.segmentor helps segment text based on language-specific word boundaries, particularly useful for languages like Japanese that don't use spaces for word breaks.

Baseline provides information on feature support across major browsers, helping developers determine when a feature is safe to use without compatibility issues.

Baseline has three levels: Newly Available, Widely Available (30 months after becoming Newly Available), and Limited Availability.

Mariko is from the Chrome Developer Relations Team.

Mariko learned JavaScript after switching from business development and product management to coding, starting with jQuery and later learning ES6.

ES6 introduced new ways to define variables, classes, arrow functions, and new data structures like sets and maps.

Mariko Kosaka
Mariko Kosaka
27 min
18 Nov, 2024

Comments

Sign in or register to post your comment.
Video Summary and Transcription
Hi, I'm Mariko from Chrome Developer Relations Team. Let's dive into the talk, leveling up JavaScript. I sat down and learned JavaScript. I sat down and learned ES6 again. TC39 has published a new version of JavaScript spec every year. I want to focus on the parts of JavaScript that got updates recently. So ArrayFlat creates a new flattened array. You can also pass a depth argument to flatten nested arrays. Another method, copyToReserve, creates a reversed copy of an array. There's also copy to sort, which creates a sorted copy of an array. Another useful method is array to spliced, which allows you to remove and add items to a copied array. Lastly, the array at method returns an item at a given index. Array at accepts negative numbers for reverse order lookup. Find last iterates in reverse order and returns the item or index. Copy to change the value at a given index with a function. Object group by allows grouping and creating a new object by type. JavaScript intl allows for word segmentation in different languages, improving readability. It also includes features like data type format, number format, and plural rules for locale-based results. Staying up to date on web features is challenging due to time-consuming research and potential errors in implementation. Baseline provides clear information on web platform features supported by major browsers, ensuring compatibility without issues. Baseline provides two levels of support: newly available and widely available. By aligning your project to Baseline, you can confidently avoid browser compatibility issues. You can use Baseline to keep up with what's new on the web by installing the Baseline widget. Websites and dashboards like feature explorer and web starters.dev have been released. The project roadmap includes developer tooling and integrating Baseline into linters and actions. Check the RAM archive insights page for user data based on Baseline years. We are planning for more tools next year, including linting and AI integration.

1. Introduction: Learning JavaScript and ES6

Short description:

Hi, I'm Mariko from Chrome Developer Relations Team. Let's dive into the talk, leveling up JavaScript. I sat down and learned JavaScript. I sat down and learned ES6 again. TC39 has published a new version of JavaScript spec every year. I want to focus on the parts of JavaScript that got updates recently.

Hi, I'm Mariko, I'm from Chrome Developer Relations Team. My handle is kosamari pretty much anywhere, although I haven't posted... I don't know where to go with all of the social things. You can find me on Blue Sky, but I haven't posted tech content.

Let's dive into the talk, leveling up JavaScript. I can remember two distinct times in my professional career where I sat down and learned JavaScript. I started my career in more of a business development and product management side, but then I decided to learn code. So at the time I sat down, learned basic JavaScript, and back then it was jQuery that I learned to sort of hack together a little bit of a front end app.

And that, a few years later, eventually got me a job writing code. And at this team that I joined, I was one day talking to senior engineers, and in one afternoon, like we, I think we did like some release or something, everybody was sort of in a relaxed mood, and then he tells me this thing called, there's gonna be a new JavaScript, and it's called ES6. And at that session, he told me all about there will be two more different ways to define variables, there will be class in JavaScript, ooh, scary, alone function and set and map and all the new things are coming in.

So then, at the time, I needed to sit down and learn ES6 again. And if you were around back then, you remember, if you go to a JavaScript conference like this, guarantee that there's at least one session about learn new things in ES6. So everybody was making focus onto this new version of JavaScript and learning it. And soon after, more tools got introduced to my dev workflow, like Babel, to preprocess. And that tool grew the ecosystem, I mean, the JavaScript ecosystem existed before ES6, but I feel like it accelerated of adding more things into build process and got really confusing. But we were writing code that gets preprocessed in order to be run on browser, and questions like, where can we write ES6 directly and run it in browser, that conversation happens.

And on top of that, TC39, the standard body for JavaScript or ECMAScript, decided that the release cycle for these moving forward is going to be eerie. So ES6 is actually ES2015, and since then, every year, TC39 has published a new version of JavaScript spec. And I could tell big updates, like, I think BigInt was added in 2020, but to be honest, because these come in every year and few things get added, few things get added, few things get added, I stopped paying attention. It's not like the energy I spend when I learn ES6 that every year I sit down and learn about new things. It sort of slipped things off. So today I want to focus on the parts of JavaScript that got updates recently, but you might miss that thing. And I proposed this talk when I proposed to focus on Array and Intel, because at the time I was seeing interesting things that I wanted to share with everybody. But then I added a few more things that are really handy to you. So it's not just Array and Intel. But as promised, let's start with Array. And as noted, you might know this function, you might not know this function. The point of it is to make a point that there are new things in JavaScript. So let's just quickly go through.

2. New Array Methods

Short description:

So ArrayFlat creates a new flattened array. You can also pass a depth argument to flatten nested arrays. Another method, copyToReserve, creates a reversed copy of an array. There's also copy to sort, which creates a sorted copy of an array. Another useful method is array to spliced, which allows you to remove and add items to a copied array. Lastly, the array at method returns an item at a given index.

So ArrayFlat, this is the order of the new things, creates a new flattened array. So you have original array that is nested, like this one, the App also nested array, and you call flat on this function, and you get flatArray. That's that simple. You can also pass a depth as an argument into this method. So you have a multiply nested array. You can say, I want to only flatten it by level 2. You can do that too.

Another one is copyToReserve. So this method creates a copy of an array that is reversed. So you have original array, and then you call it toReversed, then you get a new copied array that is reversed. Again, copied. So the reverse method already exists, but toReversed creates a copy. So at this point, if you consult log the original array, then you still get the un-reversed array. In fact, to something something, the copy to do something method, there's a few of them. So copy to sort, to sort it, is a new one. So you have some bunch of numbers in the array, you call to sort it, then you get a copy of array. Of course, because it's JavaScript, one after that is 100, not 20. But same as sort method, you can also pass a callback function to check for that to get a correctly sorted array.

Another one is array to spliced. So you get original array, and you pass three arguments, that where the splice should happen and how many items to remove and what new items to add. So in this case, I want to say index one, where the cherry is, I don't want to remove anything, but I want to add a red apple into this array, and you get a copied array. Again, not modifying the original array. You get a copied array with new one added into it. And of course, you don't need to add anything, same as splice, you can just give an index and numbers to remove. In this case, index one, cherry point, I want to remove two items, so cherry and lemons are removed, and then new array, I mean, copied array get returned.

So another one that is very simple but very useful is array at method. This returns item at given index. So you have original array and you say array at one index. So then you get cherry there. Now, you might be thinking, isn't that the same as just using square bracket notation? Yes, it is the same thing at this point.

Check out more articles and videos

We constantly think of articles and videos that might spark Git people interest / skill us up or help building a stellar career

How do Localise and Personalize Content with Sanity.io and Next.js
React Advanced 2021React Advanced 2021
8 min
How do Localise and Personalize Content with Sanity.io and Next.js
Top Content
Sanity.io provides a content platform for structured content that replaces traditional CMS. Their solution allows businesses to structure and query content anywhere using the Sanity studio and open source React application. The talk focuses on solving the challenge of sending personalized data to users in a static website environment using Next.js Vercel for hosting and Sanity for content querying and delivery. The Sanity studio allows for modeling pages, articles, and banners, with banners being shown to visitors based on their country. The solution involves using Grok queries to fetch the right banner based on country information, demonstrating personalization based on localization and dynamic content querying.
Emoji Encoding, � Unicode, & Internationalization
JSNation Live 2020JSNation Live 2020
34 min
Emoji Encoding, � Unicode, & Internationalization
This Talk explores the UTF-8 encoding and its relationship with emojis. It discusses the history of encoding, the birth of Unicode, and the importance of considering global usage when building software products. The Talk also covers JavaScript's encoding issues with Unicode and the use of the string.prototype.normalize method. It highlights the addition of emoji support in Unicode, the variation and proposal process for emojis, and the importance of transparency in emoji encoding. The Talk concludes with the significance of diverse emojis, the recommendation of UTF-8 for web development, and the need to understand encoding and decoding in app architecture.
End-to-end i18n
React Advanced 2021React Advanced 2021
26 min
End-to-end i18n
Thanks for joining my talk on end-to-end internationalization. I'll walk you through internationalizing a React app, covering translated strings, currency and date formatting, translator management, and injecting translated strings back into the app. The constants used throughout the app define localization settings and translations. The React Intel library is used for managing translations, and custom functions are created for consistent date and number formatting. The translation process involves extracting strings, using tools like PO Edit, and compiling the translated strings into JSON files for the React app.
Building JS Apps with Internationalization (i18n) in Mind
JSNation 2022JSNation 2022
21 min
Building JS Apps with Internationalization (i18n) in Mind
This Talk discusses building JavaScript apps with internationalization in mind, addressing issues such as handling different name formats, using Unicode for compatibility, character encoding bugs, localization and translation solutions, testing in different languages, accommodating translated text in layouts, cultural considerations, and the importance of enabling different languages for users. The speaker also mentions various open source tools for internationalization. The Talk concludes with a reminder to avoid assumptions and embrace diversity in the World Wide Web.
Internationalizing React
React Summit Remote Edition 2021React Summit Remote Edition 2021
29 min
Internationalizing React
The Talk discusses the challenges of adding and maintaining new languages in a React application and suggests ways to make the process easier. It defines internationalization as the process of architecting an application for localization and explains that localization involves adapting the content and experience for a specific locale. The speaker recommends using libraries for internationalization and provides resources for learning more about the topic. The Talk also addresses edge cases and difficulties with multiple dialects or languages, translation processes, and right-to-left CSS libraries.
Internationalization (i18n) With AI-Powered Language Model
JSNation 2024JSNation 2024
14 min
Internationalization (i18n) With AI-Powered Language Model
Today's Talk covers internationalization with the Powered Language Bundle and leveraging AI capabilities. It emphasizes the importance of planning AI roles and workflows, customizing content locally, and understanding different content types. The translation process involves linguistic analysis, accurate system instructions, and experimentation with different communication methods. The workflow includes using Express Server and Storybook for translations, connecting metadata with the user interface, and integrating AI technology responsibly for efficient and effective results.

Workshops on related topic

Localizing Your Remix Website
React Summit 2023React Summit 2023
154 min
Localizing Your Remix Website
WorkshopFree
Harshil Agrawal
Harshil Agrawal
Localized content helps you connect with your audience in their preferred language. It not only helps you grow your business but helps your audience understand your offerings better. In this workshop, you will get an introduction to localization and will learn how to implement localization to your Contentful-powered Remix website.
Table of contents:- Introduction to Localization- Introduction to Contentful- Localization in Contentful- Introduction to Remix- Setting up a new Remix project- Rendering content on the website- Implementing Localization in Remix Website- Recap- Next Steps