Question: Activity 1 : Working with Events Create a new file in the Lab 4 folder called events.js Write a script that takes two arguments on

Activity 1: Working with Events
Create a new file in the Lab 4 folder called events.js
Write a script that takes two arguments on the command line. The first argument is a word,
w and the second argument is a sentence s that contains several occurrences of w.
The script must start by checking on the correct number of command line arguments before
executing any further actions.
The script will then find all the occurrences of w in s. You need to set up an event that
executes each time w is found in s. The event will print the number of copies and position of
w found so far.
After ensuring the correct execution of the script upload the script to BB.
Sample Run
Note that you need to put the sentence in quotes
Note:
The first three sentences in the output are generated by the event while the last sentence is
generated at the end of your code.
 Activity 1: Working with Events Create a new file in the

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!