Foundations
Last Item by Length
Last Item by Length
The final index in an array is always one less than the array length. That pattern keeps working when the array grows or shrinks.
Your task: Use topics.length to create lastTopic from the provided array. Log the last topic.
Free with a JS Exercises account
Sign in to start coding, run your solution, and keep your progress saved for later. No payment needed.
By continuing, you agree to our Terms and Privacy Policy. We'll send occasional product updates and news. You can unsubscribe anytime.
Last Item by Length
The final index in an array is always one less than the array length. That pattern keeps working when the array grows or shrinks.
Your task: Use topics.length to create lastTopic from the provided array. Log the last topic.