I have the following function
//simple function with parameters and variable
function thirdfunction(a,b,c,d){
console.log("the value of a is: " + a);
console.log("the value of b is: " + b);
console.log("the value of c is: " + c);
console.log("the value of d is: " + d);
console.log("the arguments for each values are: " + arguments);
console.log("the number of arguments passed are: " + arguments.length);
}
console.log("no parameter values are passed");
thirdfunction();
console.log("only a and b parameter values are passed");
thirdfunction(1,2);
However when the values passed in arguments are not displayed if I concatenate the text the arguments for each values are:. Why is that?
The output I have from Google's console is as follows when concatenating;
no parameter values are passed
the value of a is: undefined
the value of b is: undefined
the value of c is: undefined
the value of d is: undefined
the arguments for each values are: [object Arguments]
the number of arguments passed are: 0
only a and b parameter values are passed
the value of a is: 1
the value of b is: 2
the value of c is: undefined
the value of d is: undefined
the arguments for each values are: [object Arguments]
the number of arguments passed are: 2
The following values are passed when I don't concatenate.
no parameter values are passed
the value of a is: undefined
the value of b is: undefined
the value of c is: undefined
the value of d is: undefined
[]
the number of arguments passed are: 0
only a and b parameter values are passed
the value of a is: 1
the value of b is: 2
the value of c is: undefined
the value of d is: undefined
[1, 2]
the number of arguments passed are: 2
EDIT
Not sure why the question got down voted but the problem I have is that when I use the statement console.log("the arguments for each values are: " + arguments); the output in the console is console.log("the arguments for each values are: " + arguments); however if I pass the statement console.log(arguments); the output in the console is [] or [1, 2]?
console.log("the arguments for each values are: " + arguments);the response returned is [object Arguments] whilst if I do ` console.log("the arguments for each values are: " + arguments);` I get[]or[1, 2]argumentsis not an array, that's why it only shows[object Arguments].