+ 1
Use of parameters in js?
What is the use of parameters and how do they work?
1 Respuesta
+ 3
think of them as input for a function so you could have a function that takes in two numbers (as parameters) and returns the average. the syntax would look like:
function avg(var x, var y)
{ return x + y / 2; }
//to call avg:
var Foo = avg(10, 20);