Implement the function extractNumber(s).
It should accept a string and extract a number from it.
It’s guaranteed that there will be a single number in the string.
Examples: $59.99
-> 59.99
, 99 euro only!
-> 99, 1 BTC
-> 1
This task is part of the Full-Stack JavaScript Course
If you have any issues with it, you can ask for community help below the post
Feel free to help others if you’ve already solved the task
functions.js
export const extractNumber = (s) => {
return Number(s);
}
solution.js
/**
* Implement the function extractNumber(s).
*
* It should accept a string and extract a number from it.
* */
import { extractNumber } from './functions.js';
console.log(extractNumber('$59.99'));
console.log(extractNumber('EUR 1.35'));
console.log(extractNumber('1 BTC'));
console.log(extractNumber('agdflhwet galsdf 13245 sdflgkhytaol chalsdf'));