DML School of Technology
Menu

First steps, Lists

The largest number

The task

Given a list of numbers (at least one), return the largest. Try it without the built-in max, using a loop.

Write a function called largest.

Tests

CallExpectedYours
largest([3,9,2]) 9 not run
largest([-5,-2,-9]) -2 not run
largest([7]) 7 not run
largest([1,1,1]) 1 not run

Next challenge · All challenges

solution.js

Tab indents. To leave the editor, press Escape, then Tab.

Output

Run prints what your code prints. Run the tests to check your function.