answersLogoWhite

0

You can pass a parameter in to setTimeout by using a closure instead of a direct function call.

var eggs = 0;

function addOneAndPrint (num)

{

num += 1;

console.log(num);

}

//Add one to eggs and print that to the console in a second

setTimeout(

function()

{

addOneAndPrint(eggs);

}

, 1000);

User Avatar

Wiki User

13y ago

What else can I help you with?

Related Questions

What is meant by the term SetTimeOut?

SetTimeOut is a term that is used in Java programming. It refers to the time it takes for a function in a program to time out or stop. SetTimeOut is a vital function.


Can you pass the object as parameter?

But of course.


How do you pass structures as a parameter to the functions in c plus plus?

Put their names into the parameter-list.


How do you pass the parameter in applet?

If you have the function main()... You can use its arguments to pass information.


One of strategy in programming a form of parameter transmission in which a copy of value of a parameter is sent to procedure...what is it?

pass by value


How to pass the parm parameter in PL1?

In JCL it would be of the form exec pgm=mypgroam, parms="/B" where the info after the "/" is the parameter strring.


What is the term used for the variable that receives an argument that pass into a module?

parameter


In what way is an argument passed by so it is not affected by a change of the content of the parameter value?

Pass by value.


Which is the default parameter passing technique in c plus plus language?

The default is to pass by value.


Is it possible in C plus plus builder xe to pass objects like TSQLConnection object to a dll as a parameter if yes then how?

Pass the object by reference to a function in the DLL.


What are the different parameter passing methods used by c plus plus?

Pass by value, constant value, reference and constant reference. Pass by value is the default in C++ (pass by reference is the default in Java).


What are the possibe problems if you use call by value instead of call by reference?

When you pass by value you essentially pass a temporary copy of the value. If the value's parameter is declared const, then copying the value could be costly, especially if the value is a large and complex structure or object. If the value's parameter is non-const, then it has to be assumed the function intends to alter the value in some way. If you pass by value, only the copy will be affected, not the original value. When a parameter is declared constant, passing by reference is generally the way to go. When it is non-const, pass by reference if you fully expect any changes to be reflected in the original value, otherwise pass by value.