Question: Write a JavaScript function on the following: a.) Create a function to count the occurrence of a substring in a string. Function will accept 2

 Write a JavaScript function on the following: a.) Create a function

Write a JavaScript function on the following: a.) Create a function to count the occurrence of a substring in a string. Function will accept 2 parameters; first parameter is the string to be searched on and the second will the string to be search. Function should also validate the parameter values, the second argument is not allowed to have empty strings but can also accept integers. a b.) Create a function that will truncate a string/phrase to a certain number of words. Function should validate if input string is a valid sentence or phrase

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!