Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

15 buttons and 15 different functions simple while loops and prompt functions pl

ID: 672727 • Letter: 1

Question

15 buttons and 15 different functions simple while loops and prompt functions please help!! Create a page named functionPractice.html You will create a bunch of functions to practice making them Your page should have ONE button that runs a main that I will provide to you. Try to write and test one function at a time before continuing on. Most syntax errors I see crop up when everyone tries to put in all of their code at once. Build small, test often, don't add code until you know what you have is good. Don't forget about the debugger! 1. Write a function phone0 that alerts "ring ring" when called. 2. Write a function helloWorld0 that alerts "Hello World" when called. 3. Write a function even(num) that returns true if a number is even. It should return false if the number is odd. 4. Write a function rollDie(sides) that returms a random number between 1 and the value of sides. 5. Write a function bigger(num 1, num2) that returns the bigger number of the two parameters. 6. Write a function smaller(num1, num2) that returns the smaller number of the two parameters. 7. Write a function vowelCounter(string) that takes a String parameter and returns the number of vowels in a String. Vowels are a, e, i, o, u. Hint: the toLowerCase) could make your life easier here. 8. Write a function consonantCounter(string) that takes a String parameter and returns the number of non-vowel letters in a String. Hint: Can you use your vowelCounter function to help you with this? 9. Write a function upperCounter(string) that takes a String parameter and returns the number of uppercase characters in a String. Hint: Can the ASCII table and charCodeAt0 help you here? 10. Write a function lowerCounter(string) that takes a String parameter and returns the number of lowercase characters in a String. Hint: See the previous function's hint. 11. Write a function isAlphabetic(string) that takes a String parameter and returns true if there are only letters (no numbers, no punctuation and no spaces) in the string. Return false if there are non letter characters in the string. Hint: toLowerCase0 could help you here. Problem 7 and 8 or 9 and 10 could help you too if you wanted. 12. Write a function islnteger(string) that takes a String parameter and returns true if there are only numbers in the string. Return false if it has any letters. 13. Write a function reverseString(string) that takes a String as a parameter and returns a reversed version of a String. Example: "Go" should become "oG" Hint: A loop that counts backward and concatenation would be helpful here. 14. Write a function isPalindrome(string) that takes a String as a parameter and returns true if the String is a palindrome. A palindrome is a word that looks the same written both forward and backwards. Example: radar" is "radar" if you spell it backward. Hint: the reverseString could help you here. 15. Write a function phoneWords(string) that takes a string containing a phone number that could contain letters like “1-800-Flowers" and returns what you would actually dial on the phone. "1-800- Flowers" would result in 18003569377

Explanation / Answer

<!DOCTYPE html>

<html ng-app="store">

<head></head>
<body>
<script>
       function phone(){
           alert("ring ring");
       }
       function helloWorld(){
           alert("Hello World");
       }
       function even(num){
           if(num % 2 == 0) return true;
           else return false;
       }
       function rollDie(sides){
           return Math.floor((Math.random() * sides) + 1);
       }
       function bigger(num1, num2){
           if(num1 >= num2) return num1;
           else return num2;
       }
       function smaller(num1, num2){
           if(num1 <= num2) return num1;
           else return num2;
       }
   </script>
</body>
</html>

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote