SHARE
TWEET

return

a guest Feb 16th, 2020 74 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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. =======================
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top