Answer to Question #219609 in HTML/JavaScript Web Application for binnu

Question #219609

String Ending with Vowel

Given an array of vowels in the prefilled code and a string

inputString as an input, write a JS program to check whether the inputString ends with a vowel.

Quick Tip

You can use the string methods toUpperCase() and endsWith().

Input

  • The input will be a single line containing a string inputString

Output

  • The output should be a single line containing a boolean value

Sample Input 1

Five

Sample Output 1

true

Sample Input 2

Apples grow best where there is cold in winter

Sample Output 2

false




1
Expert's answer
2021-07-22T18:47:17-0400
let inputString = prompt('Enter a string: ')
let str = inputString.toUpperCase()


if (str.endsWith('E') || str.endsWith('U') || str.endsWith('I') || str.endsWith('O') || str.endsWith('A')) {
    console.log('true')
} else {
    console.log('false')
} 

Sample Input 1:
Five
Sample Output 1:
true

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS