Advertisement
sujonshekh

Math functions

Sep 6th, 2020
1,359
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. math = Math.round(2.9);
  2. math2 = Math.ceil(2.3);
  3. math3 = Math.floor(2.3);
  4. math4 = Math.sqrt(64);
  5. math5 = Math.pow(2,2);
  6. math6 = Math.min(2,5,10,25);
  7. math7 = Math.max(2,5,10,25);
  8.  
  9.  
  10. console.log(math,math2,math3,math4,math5,math6,math7);
  11.  
  12. // Random Number
  13.  
  14. math = Math.random() *100;
  15. math = Math.floor(math) +1;
  16.  
  17. console.log(math);
  18.  
  19. // Love Calculator
  20.  
  21. let firstName = prompt ("What is Your Name?");
  22. let partnerName = prompt ("What is Your  Partner Name?");
  23.  
  24. // Calculation
  25. let number = Math.random();
  26. number = number *100;
  27.  number = Math.floor(number) +30;
  28.  
  29.  
  30.  // Showing Results
  31. alert (firstName + " and "+ partnerName + " 's Love Percentage is : "+ number + "%");
  32.  
  33.  
  34.  
  35.  
  36.  
  37.  
  38.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement