Syntax - Tasty Web Development Treats
Syntax - Tasty Web Development Treats

Top 18 New Things in JS - Part 2

In this episode Wes and Scott continue the discussion of their favorite top 18 new things in Javascript. Freshbooks - Sponsor Get a 30 day free trial of Freshbooks at freshbooks.com/syntax and put SYNTAX in the “How did you hear about us?” section. Graph CMS - Sponsor GraphCMS is trying to be the wo

Featured Speakers

Wes Bos & Scott Tolinski - Full Stack JavaScript Web Developers HostScott Tolinski Guest

Topics Discussed

Episode Summary

Executive Summary: In part two of their JavaScript features roundup, Wes Bos and Scott Tolinski explain spread and rest syntax, arrow functions, default parameters, named parameters, modules, dynamic imports, and classes, emphasizing practical tradeoffs and immutability. They also discuss recent React tooling and code-splitting developments, mention JavaScript features they use less often, and close with sponsor messages and course recommendations.

Main Topics: Spread and rest syntax: The hosts explain using spread to expand arrays or objects into new values, commonly for immutable updates and passing props. Rest syntax collects remaining function arguments or destructured properties into an array or object. They note that object spread makes a shallow copy, not a deep clone. Arrow functions and default parameters: Arrow functions have lexical this, can use concise implicit returns, and are useful for callbacks, though dense destructuring and implicit returns may reduce readability. Default parameters apply when an argument is undefined, not for other falsy values such as zero, false, or null. Named parameters and JavaScript modules: Passing an options object gives functions readable, order-independent named values. The hosts describe ES modules, named versus default exports, re-export patterns, and how explicit dependencies improve organization and can help remove unused code. Dynamic imports and code splitting: Dynamic imports allow code to load when needed—for example, loading shopping-cart code only when a user opens the cart. The hosts describe using bundlers and React Loadable, and discuss React's emerging lazy-loading support as a way to reduce initial JavaScript payloads. Classes and React tooling updates: Classes provide constructors, methods, and inheritance, and are common in framework code. The hosts discuss class-property syntax for state and bound handlers, alongside Create React App 2 features such as Sass, CSS Modules, Babel 7, Webpack 4, and GraphQL file imports. Less frequently used features: The hosts prefer async/await for many promise workflows but describe combining it with catch handlers. Generators and for-of loops can be useful for specific iteration patterns, though they often reach for array methods or object utilities instead. Sponsors and learning resources: FreshBooks is promoted for online invoicing and payment reminders, and GraphCMS for a GraphQL-based content backend. The hosts also recommend their JavaScript courses as ways to learn the discussed features and practices.

Key Arguments: Spread and rest syntax support concise, immutable data transformations: spread can create new arrays or objects without mutating the originals, while rest gathers unspecified values. Object spread is shallow, so nested objects remain shared references. Arrow functions are valuable chiefly because they inherit this from the surrounding scope; their concise syntax and implicit returns are useful but should be balanced against readability. Default parameters provide fallbacks only when an argument is undefined. Developers should not treat them as equivalent to a general falsy-value check. Options objects make function calls more self-documenting and less fragile than long positional parameter lists because callers can specify values by name and in any order. Explicit module imports and exports make dependencies and code boundaries clearer, especially in larger applications, and can enable unused code to be excluded from builds. Dynamic imports and code splitting can mitigate the cost of large front-end bundles by delaying code until it is needed, supporting the use of richer frameworks without loading every feature up front. Features such as generators and for-of loops are worth understanding, but developers need not force them into everyday work when simpler array methods or object utilities fit their use cases.

Data Points: Features in the roundup: Described uncertainly as about 18, possibly 17 or 20 - The hosts introduce this as the second half of their JavaScript features list and explicitly joke that they are unsure of the final count. Time from talk to React Cache rename: 20 minutes - Wes says the Simple Cache name was changed to React Cache shortly after his talk, illustrating how quickly evolving technology can date a presentation. React experience adopting arrow functions: Three or four months - Wes estimates how long it took him to feel comfortable working with arrow functions. FreshBooks usage: About 10 years - Wes says he has used FreshBooks for roughly a decade while describing its invoicing and payment features. FreshBooks trial: 30 days - The sponsor offer mentioned in the episode is a 30-day unrestricted free trial. Yearly subscription savings: 25% - Scott says listeners can save 25% by subscribing yearly to Level Up Tutorials. Meteor release: 1.7 - Scott cites Meteor 1.7 as including modern and legacy JavaScript builds. Create React App release: Version 2 - The hosts discuss Create React App 2 and its updates, including Sass support and Webpack 4.

Pivotal Quotes: "That's the real feature there. The rest of it is just what it looks like." — Wes Bos: Wes distinguishes arrow functions' lexical this behavior from their stylistic shorthand and implicit-return features. "Once you start to build out real, real applications, it becomes very obvious that keeping everything organized, separated, and in its own sort of context is extremely important." — Scott Tolinski: Scott explains why modules become especially valuable as applications grow beyond small scripts. "I use this all the time 24/7. It makes your code way more self-documented, it makes it easier to read, makes it way less brittle." — Scott Tolinski: Scott advocates for named parameters implemented by passing an options object.

Implications: Listeners should choose JavaScript features for their practical benefits, while balancing concision with maintainability. Explicit modules and demand-loaded code help manage larger applications, and the hosts' discussion underscores the need to keep learning as JavaScript and React tooling evolve.

🔓 Sign Up for Unlimited Episode Search

About Syntax - Tasty Web Development Treats

View all episodes from Syntax - Tasty Web Development Treats