Skip to content
Advertisement

Detect multi-digit numbers seperated by spaces in a string

I’m trying to write a function that returns the largest and smallest number in a string. However, not all numbers in the string are 1 digit numbers – some are 2 or 3 digits long.

Examples:

JavaScript

This exercice originates from codewars.com

Advertisement

Answer

It’s really easy to do with a list comprehension and int conversion

JavaScript
User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement