Last active
March 29, 2016 08:32
-
-
Save kounelios13/c84648fb94b607a5a182 to your computer and use it in GitHub Desktop.
Get a string from the user and extract the numbers from the string
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var str=prompt("Give me a string containing numbers"); | |
var numbers=null; | |
if(str != null) | |
numbers=str.match(/[+-]?\d+(\.\d+)?/g); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment