You can use fractions, decimals or both in the parameter (ie. 5, 1/2, 2.5/6), but if nothing is provided it will default to 1.
The error looks to be - [Error: expected undefined to be a number]
im using the following to split the numbers from the string
let nums = "0123456789";
//check if string digit is a number
function checkNum(x) {
return nums.includes(x) ? true : false;
}
// combine number digits
let numbers = [...input].reduce(
(x, y) => (checkNum(y) ? x + y : x),"");
I use the condition to check to return 1 if no number is provided
if (!numbers) {
return 1;
}
I am not sure what I’m missing I have been looking to see where in the code undefined is coming up for the Initial number
Hello, you have a function that appears to be closed with more code. Is this how you wrote this? Note: I was unable to use the link through Git Hub login.
Workspace freecodecam-boilerplate-fw45jrg1kap not found.