Purchase Solution

NASA Like pop-up counter javascript.

Not what you're looking for?

Ask Custom Question

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.

Attachments
Purchase this Solution

Solution Summary

The solution contains a small javascript program that displays how to pass parameter values to the function. This function then displays the message received as the parameter as a browser window alert.

Solution Preview

Dear student,

Please find attached the solution.
Let me know if you have any doubt/confusion about anything.

Please do not forget to give a ...

Purchase this Solution


Free BrainMass Quizzes
Javscript Basics

Quiz on basics of javascript programming language.

Word 2010: Tables

Have you never worked with Tables in Word 2010? Maybe it has been a while since you have used a Table in Word and you need to brush up on your skills. Several keywords and popular options are discussed as you go through this quiz.

C# variables and classes

This quiz contains questions about C# classes and variables.

Java loops

This quiz checks your knowledge of for and while loops in Java. For and while loops are essential building blocks for all Java programs. Having a solid understanding of these constructs is critical for success in programming Java.

C++ Operators

This quiz tests a student's knowledge about C++ operators.