Advertisement
Guest User

return

a guest
Feb 16th, 2020
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.84 KB | None | 0 0
  1. Това работи:
  2. const generateTarget = () => {
  3. console.log(Math.floor(Math.random() * 10));
  4. }
  5. generateTarget();
  6. =======================
  7. А това не знам как да го накарам да работи:
  8.  
  9. const generateTarget = () => {
  10. return Math.floor(Math.random() * 10);
  11. }
  12. ========================
  13. и този return не ми е ясен:
  14.  
  15. const compareGuesses = (humanGuess, computerGuess, targetGuess) => {
  16. const humanDifference = Math.abs(targetGuess - humanGuess)
  17. const computerDifference = Math.abs(targetGuess - computerGuess)
  18. return humanDifference <= computerDifference;
  19. }
  20. =======================
  21. Какво точно прави тази функция? Явно е написана твърде съкратено:
  22.  
  23. const advanceRound = () => currentRoundNumber++;
  24. =======================
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement