Learn the Latest ECMAScript Features (ES2024, ES2023, ...)
course
Learn how the latest JavaScript features can help you improve your codebase.
Browse
Find courses, lessons, articles, talks, and podcasts.
118 resources
Showing 49–72 · Page 3 of 5
course
Learn how the latest JavaScript features can help you improve your codebase.
lessonDuration 15m 19s
lessonDuration 5m 43sFree
You no longer need to write generator functions to create basic lazy iterator functions. Now, ECMAScript supports iterator helpers that you can call on `Array.values()`. With these helpers, the values of an array will be operated on lazily, and will only run when the values are needed.
lessonDuration 3m 16sFree
The new [cause](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error/cause) data property that you can add to a thrown `Error` can be used to retain access to the original error caught in a promise rejection.
lessonDuration 3m 18sFree
You can finally make your numbers more readable in JavaScript. Add underscores in all types of numbers including BigInt, floats, hexes, octals, and binary to improve their readability. Just don't add the underscores to the beginning or end!
lessonDuration 4m 33sFree
[Promise.any](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/any) takes an iterable of promises and returns a promise that fulfills with the first promise that fulfills, and rejects when ALL of the promises in the iterable reject. [Promise.allSettled](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/allSettled) takes an iterable of promises, and returns an array of objects. The objects have a `status` property which is a string that is either `"fulfilled"` or `"rejected"`. If the `status` is `"fulfilled"` the object will contain a `value` property with the resolved value of the promise, and if the `status` is `"rejected"` the object will have a `reason` property with the reason for the promise's rejection.
lessonDuration 2m 26sFree
If we want to be able to modify the state of a promise from outside the constructor, we can use the [Promise.withResolvers](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/withResolvers) method to get access to the promise, and its `resolve` and `reject ` functions.
lessonDuration 4m 6sFree
The [Logical Assignment Operators](https://github.com/tc39/proposal-logical-assignment) bring syntactic sugar over verbose syntax which enforced us to write explicit `if` statements. Thanks to the new operators `||=`, `&&=` and `??=` we can express the conditional logic in a more concise way.
lessonDuration 5m 3sFree
The new [Array.with](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/with) method gives you an immutable syntax for changing values of an array at a specified index. Sometimes `.map` will be more efficient. So, in this lesson we'll compare both methods while replacing an object at a specific index.
lessonDuration 6m 5sFree
The ["Set Methods"](https://github.com/tc39/proposal-set-methods) proposal introduces 7 new methods to JavaScript/ECMAScript: - `union` - `intersection`, - `difference`, - `symmetricDifference`, - `isSubsetOf` - `isSupersetOf` - `isDisjointFrom` Thanks to them, complex operations using JavaScript sets will become much easier.
lessonDuration 3m 14sFree
Finding elements starting from the end of an array has gotten a lot easier with the introduction of the `at`, `findLast`, and `findLastIndex` methods! With `at` you no longer need to remember to access the end of the array like `array[array.length - 1]` trick. You can just call `.at[-1]` to get the last element! `findLast` and `findLastIndex` work the same as their `find` and `findIndex` counterparts. But, they work backwards from the end of the array. This is useful if you know what you're accessing is going to be closer to the end.
lessonDuration 4m 49sFree
[Array Grouping](https://github.com/tc39/proposal-array-grouping) is the new feature of JavaScript/ECMAScript, which splits an array (or, generally, an iterable), into smaller sub-arrays. Grouping is different than other JS array methods - it's *not* a part of the array prototype, but a static method.
lesson
lesson
lesson
lesson
lessonDuration 1m 19sFree
This lesson teaches how to create a signal in Angular with the signal function from @angular/core. Signals need an initial value, which can be a primitive, object, or any other valid expression in JavaScript. TypeScript infers the signal's type and catches errors during compilation.
course
You've seen that Angular signals are here, and know that signal-components are coming up. This marks a paradigm-shift towards reactive programming in Angular. Are you ready? What if you could start learning signals and feel pleased with your progress? And reach a point where you feel confident when using signals in production? And feel ready when signal-based components come? Changes are coming, and you can get ahead of them. By taking this cousre you will learn how to: - Create computed signals - Share your signals in services - Use and cleanup signal effects - Turn signals into observables and vice versa - ... and more In 52 minutes over the course of 20 bite-sized lessons, you'll learn everything you need to know to take advantage of signals now and be prepared for signal-based components!
lessonDuration 1m 44sFree
Signals are functions that return their current value. The component template is guaranteed to be updated when the signal value changes. TypeScript helps catch errors when using signals of different types. Signals can also be used with Angular's `ngFor` directive to loop over arrays.
lessonDuration 1m 23sFree
In some cases, using the optional chaining operator may not be sufficient to narrow down a signal's value type, such as from `string | undefined` to `string`. To achieve type narrowing, you can use Angular's `@if` directive in combination with a getter expression. By moving the signal to a private property and exposing its value through a public getter property, you can ensure that TypeScript correctly narrows down the type within the `@if` block. This approach guarantees that the same value is used throughout the template, allowing TypeScript to compile the code without errors.
lessonDuration 1m 1sFree
Event handlers can be created in Angular components to interact with signals. By defining a method in the component class and binding it to an event in the template, the current value of a signal can be accessed and logged when the event occurs. It's important to note the difference between: - Reactive signal calls in the template, which automatically update the view when the signal value changes - Imperative signal calls in the TypeScript class code, which retrieve the current value only when the event is triggered
lessonDuration 3m 53sFree
Computed signals in Angular allow for the creation of derived values based on existing signals. By defining a new property and assigning it a computed signal, you can perform calculations or transformations on top of an existing signal's value. To create a computed signal that remains responsive to changes in its dependencies, it's essential to: * Define the computed signal's callback function, which calculates the derived value based on other signals * Ensure that the computed signal is consumed by a live consumer, such as a template, to trigger re-evaluation when dependencies change The reactivity flow in Angular ensures that whenever a dependency of a computed signal changes, the computed value is automatically re-evaluated. This re-evaluation only occurs if there is a live consumer, such as a template, that depends on the computed signal.
lessonDuration 3m 16sFree
Computed signals in Angular allow for the creation of derived values based on other signals, including other computed signals. This enables the composition of complex calculations and transformations by building upon existing signals. When creating computed signals that depend on other computed signals, it's crucial to: * Ensure that there are no cyclic dependencies, where two or more computed signals directly or indirectly depend on each other * Consume the computed signal by a live consumer, such as a template, to trigger re-evaluation when dependencies change Angular's reactivity system automatically detects and prevents cyclic dependencies in computed signals, throwing an error if such a scenario is encountered.
lessonDuration 1m 42sFree
Read-only signals in Angular let you share values between components safely. They update automatically when the original signal changes. They can't be changed directly, like computed signals. And, they are useful in services.