Guest User

Untitled

a guest
Jan 16th, 2019
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.03 KB | None | 0 0
  1. //First Question
  2. function capitlizeFirstLetter(inputString){
  3. return inputString.replace(/\w\S*/g, function(str){return str.charAt(0).toUpperCase() + str.substr(1).toLowerCase();})
  4. }
  5.  
  6.  
  7.  
  8. // Second Question
  9. function largestInteger(num1,num2,num3){
  10. return num1 > num2 && num1 > num3 ? num1
  11. : num2 > num1 && num2 > num3 ? num2
  12. : num3 > num1 && num3 > num2 ? num3
  13. : "The numbers provided are all equal";
  14. }
  15.  
  16. console.log(largestInteger(5,5,5))
  17.  
  18. // Third Question
  19. function moveLast3Char(inputString){
  20. return inputString.substr(-3, 3) + inputString.substr(0, inputString.length - 3);
  21. }
  22.  
  23. // Fourth Question
  24. function getAngleType(angle){
  25. return angle >= 0 && angle < 90 ? "Acute angle"
  26. : angle == 90 ? "Right angle"
  27. : angle > 90 && angle < 180 ? "Obtuse angle"
  28. : angle == 180 ? "Straight"
  29. : "Please enter a valid Degree input";
  30. }
  31.  
  32.  
  33. console.log(capitlizeFirstLetter('Testing'));
  34. console.log(largestInteger(5,5,5));
  35. console.log(moveLast3Char('Python'));
  36. console.log(getAngleType(180));
Add Comment
Please, Sign In to add comment