Similar code written in different style gives error!!
See original GitHub issueChallenge [Generate Random Whole Numbers with JavaScript](https://www.freecodecamp.com/challenges/generate-random-whole-numbers-with-javascript
User Agent is: Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/50.0.2661.94 Safari/537.36
.
Please describe how to reproduce this issue, and include links to screenshots if possible.
My code:
var randomNumberBetween0and19 = Math.floor(Math.rando
m() * 20);
function randomWholeNum() {
// Only change code below this line.
var rand = Math.random() * 10;
return Math.floor(rand);
// return Math.floor(Math.random() * 10); //works fine
//but above doesn't work
}
Issue Analytics
- State:
- Created 7 years ago
- Comments:9 (4 by maintainers)
Top Results From Across the Web
The 7 Most Common Types of Errors in Programming and ...
Runtime Errors Runtime errors happen as a user is executing your program. The code might work correctly on your machine, but on the...
Read more >The code formatting problem, and how to solve it - Medium
The solution to the code formatting problem is this: every programming language should have one, and only one, valid way to format code....
Read more >Types of Errors in Java with Examples - GeeksforGeeks
Syntax errors are grammatical errors whereas, logical errors are errors arising out of an incorrect meaning. For example, if a programmer ...
Read more >Fix the top 10 most common compile time errors in Java
Example of an 'unreachable code' error, one of several common Java compile errors. 1. Class and source file mismatch. The name of the...
Read more >Java Software Errors: How to Avoid 50 Code Issues in Java
We've rounded up 50 of the most common Java software errors, complete with code examples and tutorials to help you work around common...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@raisedadead Yes, I have tested the code many times.
@ranaamritparth Just to confirm you have tested this :
The original description has some code that can give a false positive.