Functions

Rest Parameters

Rest Parameters

A rest parameter gathers extra arguments into an array. That lets a function accept a flexible number of values without changing its signature for each call.

Your task: Write highestScore(...scores) so it returns the highest provided score. If no scores are provided, return 0.

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.

Rest Parameters

A rest parameter gathers extra arguments into an array. That lets a function accept a flexible number of values without changing its signature for each call.

Your task: Write highestScore(...scores) so it returns the highest provided score. If no scores are provided, return 0.

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.

Console

Run code to see output.