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

The robot.html page (provided in the Google Drive), features a robot that can be

ID: 3753344 • Letter: T

Question

The robot.html page (provided in the Google Drive), features a robot that can be given 3 simple tasks. You need to implement those 3 simple tasks based on what the user inputs. All outputs need to be structured as a ul element with li elements as its children.

The first is Count Vowels. The user can type a sentence into the input area then click the Count Vowels buttons. The robot will then output an unordered list in the black box area below the buttons with each vowel that appeared in the sentence and how many occurrences it found, even if it is zero. The robot will ignore all punctuation and will also not consider ‘y’ a vowel. A screenshot example is below.

The second is Count Words. The user can type a sentence into the input area and click the Count Words button. The robot will then output a list of words and have many times they are used. The robot ignores punctuation and capitalization when comparing words.

The third, and final, is Count Punctuation. The user can type two words into the input area and click the Count Punctuation button. The robot will then count the following punctuation: exclamation mark, semicolon, comma, period, question mark, colon, apostrophe, double-quote, hyphen. The robot then displays the count of the punctuation used, and will not list any that are zero.

Restrictions:

You use any third party JavaScript libraries

You don’t enable JavaScript’s strict mode

You use var instead of let

You don’t use the EventListener API

You don’t create DOM elements via JavaScript or the DOM API (ie don’t set innerHTML or innerText with Strings)

If the page doesn’t render and work properly with the latest Google Chrome

If any errors or console logs appear in the browser’s web developer console

The output is not a ul element with li elements

Your code does not pass https://eslint.org/demo with no issues. (In the Rules Configuration, make sure tick the browser and es6 boxes, as well as setting ECMA Version to 6)

JavaScript.

In case needed, this is robot.html referred to in the first line.

Explanation / Answer

robot.js

function countVowel(strings)
{
var list = 'aeiouAEIOU';
var cnt = 0;
var str = document.getElementById("robotInput").value;  
for(var i = 0; i < strings.length ; i++)
{
if (list.indexOf(strings[i]) !== -1)
{
cnt += 1;
}
  
}
return cnt;
}

console.log(countVowel(str));

Rate an upvote....Thankyou

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