The intention is that you don't know all types of sausages that exist, so you have to identify them using their packaging (and as natan wrote, other specifics of a good sausage package). All of the necessary info is in the Kata's description.
With math you are moving in the good direction.
As for implantation, you know that you have problems with larger numbers and still do multiplication.
Just look at "numerator = 2757240" in the description example, thats crazy.
Try to work out math further to by pass this, so that you would not have such a larger number at one point of time.
How can a value be undefined, when I am clearly passing a string to the function.
How do you know that? You're not passing anything to the function, THE TESTS are passing input to your function. Follow Chrono79's advice to print the input and see why it's happening.
"a" is the array, to know the length of the array to add the correct amounts of "0" - "y" wich is the index
.
The intention is that you don't know all types of sausages that exist, so you have to identify them using their packaging (and as natan wrote, other specifics of a good sausage package). All of the necessary info is in the Kata's description.
Maybe you're testing the wrong things. Look at how the description specifies good sausage and test that.
Fixed in C++ translation
Oh dear, I am an idiot.
Sorry for that, will fix it.
With math you are moving in the good direction.
As for implantation, you know that you have problems with larger numbers and still do multiplication.
Just look at "numerator = 2757240" in the description example, thats crazy.
Try to work out math further to by pass this, so that you would not have such a larger number at one point of time.
How do you know that? You're not passing anything to the function, THE TESTS are passing input to your function. Follow Chrono79's advice to print the input and see why it's happening.
Print the input, in javascript with
console.log(text);
as the first line of your function and check why your code is failing.Read https://github.com/codewars/codewars.com/wiki/Troubleshooting-your-solution#print-input