Math.floor is undefined
Answered
Gecco posted this in #help-forum
GeccoOP
Whenever I try and use Math.floor it is undefined, if I print the function with
console.log(Math.floor) it works fine but otherwise not.Answered by Coffee Coke
try using
Math.floor(Math.random() * this.poems.length - 1), I don't see any other problems with this information2 Replies
@Gecco Whenever I try and use Math.floor it is undefined, if I print the function with `console.log(Math.floor)` it works fine but otherwise not.
try using
Math.floor(Math.random() * this.poems.length - 1), I don't see any other problems with this informationAnswer
if poems lenght is 5 for example, poems[5] wouldn't exist and return undefined