Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a function named isAlpha that accepts a character (i.e., a string of length one) and returns true if it is a letter of the

Write a function named isAlpha that accepts a character (i.e., a string of length one) and returns true if it is a letter of the alphabet and false if it is not a letter of the alphabet. isAlpha should accept both uppercase and lowercase characters.

Write a function countLetters() that accepts a single string argument and uses isAlpha() to count the number of alphabetic letters in the string. You need to loop over each character in the string using a for loop, using the length property of string as part of the for loop conditional. You also need to use the string charAt() function to extract each character. You will call isAlpha() on each character in the string from within the loop. d. Write a function called countLettersWhile(), which must behave like countLetters, but it must use a while loop instead of a for loop to iterate over the string. e. Write another function countLettersDoWhile() that behaves like countLetters, but it must use a do ... while loop instead. f. Copy each function to the Chrome Console and test them.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Formal SQL Tuning For Oracle Databases Practical Efficiency Efficient Practice

Authors: Leonid Nossov ,Hanno Ernst ,Victor Chupis

1st Edition

3662570564, 978-3662570562

More Books

Students also viewed these Databases questions

Question

5. Efforts to streamline HRM processes.

Answered: 1 week ago