Max (golf)
Return the largest array element. The array is non-empty and contains finite numbers.
Preview challenge → Free account required to solveJAVASCRIPT IN PRACTICE
Shortest code (golf) - solve it, but length counts. Fit within the character limit and beat the shortest-solution record. Trains conciseness and language tricks.
Solving requires a free account.
Pick a challenge and explore the rules through a concrete example.
Return the largest array element. The array is non-empty and contains finite numbers.
Preview challenge → Free account required to solveReverse string with min chars. Reverse Unicode code points without splitting emoji surrogate pairs.
Preview challenge → Free account required to solveFor integer n, return a boolean: true if n is even, otherwise false. Zero and negative even integers also return true.
Preview challenge → Free account required to solveAvailable challenges: 7.
See all challenges →The full catalogue requires a free account.
JavaScript code golf practises concision: you seek a shorter expression while preserving the required behaviour. You explore alternative uses of operators and language methods. In application code, assess those shortcuts for readability as well as character count.
First write a solution that passes the tests, then shorten it. Change one fragment at a time and check the character limit. Type-coercion shortcuts can fail for zero, empty strings or empty arrays, so rerun every case after each optimisation.
Read the description without logging in. Solving requires a free account.