Answers for "object as a parameter in javascript"

27

javascript function variable arguments

function foo() {
  for (var i = 0; i < arguments.length; i++) {
    console.log(arguments[i]);
  }
}

foo(1,2,3);
//1
//2
//3
Posted by: Guest on July-09-2020
1

parameters in javascript

function myFunction(x, y) {
  if (y === undefined) {
    y = 2;
  }
}
Posted by: Guest on December-23-2020
-1

object as a parameter in javascript

var fac = function me(n) {
    if (n > 0) {
        return n * me(n-1);
    } else {
        return 1;
    }
};
console.log(fac(3)); // 6
Posted by: Guest on January-28-2021

Code answers related to "object as a parameter in javascript"

Code answers related to "Javascript"

Browse Popular Code Answers by Language