Can you please see below and review attachment adding


Can you please see below and review attachment. (adding parameters to functions & using function parameters)

You made some modifications to your program, but you did not change the function to accept a parameter. You can either modify the function in your program to accept a parameter, or you can use the function I demonstrate below in your program by adding it to your source code file.

To demonstrate I'm going to create a function that meets those requirements described below.

I'm going to name the function display_alert, because that is what the function does.

I'm going to name the parameter, message, because that's what the data contains.

The function is defined as follows:

function display_alert(message){
window.alert(message);
}

It looks very similar to the function you defined below, except for the fact that it gets the data to be displayed in the alert message, from the input parameter.
It uses the parameter variable as an argument to pass to the window.alert() function.

Your program should call this function 13 times.

Each time the function is called, the parameter variable will have a different value.

Two examples of calling the above function with an argument:

var mess1 = "Ten";
display_alert("Ten"); // call the function with an string literal argument
display_alert(mess1); // call the function with a variable argument
// A variable must be declared before(above) using it.

In both examples the value passed to the function is the string "Ten".

Notice that the name of the variable used in the argument does not have to be the same as the name of the parameter variable in the function definition.

Attachment:- Assignment2.zip

Solution Preview :

Prepared by a verified Expert
Programming Languages: Can you please see below and review attachment adding
Reference No:- TGS01244842

Now Priced at $20 (50% Discount)

Recommended (90%)

Rated (4.3/5)