You don't return all of the quotes
See original GitHub issueYou use number 324
in index,js
but you have 326 quotes. That means, the last 2 quotes will never return. Please don’t use magic numbers in code. It’s a well known anti-pattern. Just replace the value with arr.length
.
While you are at it, you can simplify your functions with:
module.exports.getQuote = function (name) {
return arr[randomInt(arr.length)] //rename your from field to author in data.json
};
That is faster, because you do one less array access, and simpler because of the error I mentioned above.
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:9
Top Results From Across the Web
Wisdom Quotes - Pinterest
Nov 1, 2018 - Give without expecting anything in return (not even a thank you). That is an unconditional kindness ... everything else...
Read more >Return Quotes (141 quotes) - Goodreads
So give all the love you have. Do not hold any in reserve. What is given is not lost; it shall return.” ―...
Read more >41 Inspiring Quotes That Will Get You Through Even the ...
Some days, nothing seems to go right, no matter how hard you try. Read these inspiring words to get you through a particularly...
Read more >55 Inspirational Quotes About Learning From Failure
If you're experiencing one of those moments, all hope is not lost. Here are some inspirational quotes to help you get back on...
Read more >Return Quotes - BrainyQuote
If you love somebody, let them go, for if they return, they were always yours. And if they don't, they never were. Share...
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 Free
Top 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
@jabbar86 I have already taken it, but we can match a fight on the streets to see who survives and who can take this issue
@LeoDalcegio hahahahah No problem. you take this issue. I will contribute to another one.