๐—ง๐—ต๐—ฟ๐—ฒ๐—ฒ ๐— ๐—ผ๐—ฑ๐—ฒ๐—ฟ๐—ป ๐—๐—ฎ๐—๐—ฎ๐—ฆ๐—ฐ๐—ฟ๐—ถ๐—ฝ๐˜ ๐—™๐—ฒ๐—ฎ๐˜๐˜‚๐—ฟ๐—ฒ๐˜€ JavaScript has changed a lot in recent years. You now have cleaner ways to do common coding tasks. Three useful additions are:

You can use structuredClone() to create a deep copy of an object. This is better than the old way of using JSON.parse(JSON.stringify(obj)). The old way breaks when dealing with complex data types. structuredClone() preserves many built-in JavaScript types, including Dates and circular references.

You can use at() to access the last element of an array. This is cleaner than the old way of using arr[arr.length - 1]. You can use negative indexes to count from the end of the array. For example:

You can use findLast() to find the last item in an array that matches a condition. This is simpler than the old way of reversing the array and using find(). For example, you can use users.findLast(u => u.active) to find the last active user.

These new features can improve your everyday coding. You can learn more about them and stay up-to-date with the latest JavaScript developments. Source: https://dev.to/zamfir80/three-modern-javascript-features-that-replace-older-patterns-1ogm