Array Basics
👨💼 Perfect! You've mastered basic array operations.
🦉 A common pattern for getting the last element:
const last = products[products.length - 1]
// Or using at() (newer, cleaner):
const last = products.at(-1) // Negative index counts from end
The
at() method is great for accessing from the end without the length - 1
math.