Question: I need a typed answer. Consider the following HTML page: Part c to fare based on this page. Design Enter a Value Submit Code Enter

I need a typed answer.

I need a typed answer. Consider the following HTML page: Part cto fare based on this page. Design Enter a Value Submit Code

Consider the following HTML page: Part c to fare based on this page. Design Enter a Value Submit Code

Enter a Value

Write separate JavaScript functions to the scenarios given below. c) Assume that the page accepts a string and a number (n) separated with a comma. (5 marks) Write a JavaScript function called concatenateString() to concatenate a given string n times. The output will be displayed as an alert. Sample input : hello,3 Sample output : hello hello hello d) Assume that the page accepts two strings separated with a comma. Write a (5 marks) JavaScript function called search String() to find whether the second string is contained within the first string. If found the method should return true, if not method should return false. Sample input : hello world, hello Output : true Sample input : hello world, java Output: false (5 marks) e) Assume that the page accepts a date as the value. Write a JavaScript function called checkDate() find whether it is a future date. The function should display an alert saying "The date is expired if user enters a past date. a (5 marks) f) Assume that the page accepts two strings separated with a comma. Write a JavaScript function called countString() to find a count the how many times the second string appears in the first string. The method should display the count as an alert Sample input: "Ba Ba Black Sheep", "Ba" Output : 2 times Sample input : "Have you any wool, sheep" Output: 0 times

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!