Generate Random Fractions with JavaScript- Tests passing when they shouldn't

Generate Random Fractions with JavaScript- Tests passing when they shouldn't
0

#1

Even if i return hard-coded decimal value all the tests get passed but they shouldn’t.

Your code so far

function randomFraction() {

  // Only change code below this line.


 // Math.random();
  return 0.3;
  

  // Only change code above this line.
}

Your browser information:

Your Browser User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:57.0) Gecko/20100101 Firefox/57.0.

Link to the challenge:


#2

Ah, you can trick it by just having Math.random() somewhere… Nice catch!


#3

@BenGitter, ammm… even when we don’t use Math.random() anywhere (see the commented out Math.random(), in the above code), and just return a hard coded decimal number, the tests pass, when they shouldn’t.

I think there might be bug(s) in how the tests are being checked by the logic of the exercise itself.

But yeah, nice catch @acloseknityarn


#4

Yes, that was what I meant. Even if it is commented out, as long as it is there, it passes.