Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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.

image text in transcribedimage text in transcribed

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

Is the current human resources management system obsolete?

Answered: 1 week ago

Question

7. How might you go about testing these assumptions?

Answered: 1 week ago