/*Description: Filter the number Oh, no! The number has been mixed up with the text. Your goal is to retrieve the number from the text, can you return the number back to its original state? Task Your task is to return a number from a string. Details You will be given a string of numbers and letters mixed up, you have to return all the numbers in that string in the order they occur. */ var FilterString = function (value) { let numberStr = ""; for (let i = 0; i < value.length; ++i) { if (!isNaN(Number(value[i]))) { numberStr+= value[i]; } } return Number(numberStr); };
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter