How does join() produce different results depending on the arguments?How does JavaScript .prototype work?How to get the difference between two arrays in Javascript?How does the “this” keyword work?How do I pass command line arguments to a Node.js program?How does data binding work in AngularJS?How does Access-Control-Allow-Origin header work?How do I update each dependency in package.json to the latest version?How does Trello access the user's clipboard?How does Facebook disable the browser's integrated Developer Tools?Why do we need middleware for async flow in Redux?
Set vertical spacing between two particular items
Why isn’t the tax system continuous rather than bracketed?
how to remove the dotted white border around focused button text?
Bash echo $-1 prints hb1. Why?
The difference between Rad1 and Rfd1
Avoid bfseries from bolding pm in siunitx
Dual statement category theory
AT system without -5v
Professor Roman gives unusual math quiz ahead of
Averting Real Women Don’t Wear Dresses
Is this the golf ball that Alan Shepard hit on the Moon?
The use of "I" and "we" used in the same sentence and other questions
Wilcoxon signed rank test – critical value for n>50
Intuitively, why does putting capacitors in series decrease the equivalent capacitance?
How can I convince my reader that I will not use a certain trope?
What does 2>&1 | tee mean?
How to modify the uneven space between separate loop cuts, while they are already cut?
What do you call the action of someone tackling a stronger person?
Disabling automatic add after resolving git conflict
Did Chinese school textbook maps (c. 1951) "depict China as stretching even into the central Asian republics"?
SPI Waveform on Raspberry Pi Not clean and I'm wondering why
Does ultrasonic bath cleaning damage laboratory volumetric glassware calibration?
“Transitive verb” + interrupter+ “object”?
Should I report a leak of confidential HR information?
How does join() produce different results depending on the arguments?
How does JavaScript .prototype work?How to get the difference between two arrays in Javascript?How does the “this” keyword work?How do I pass command line arguments to a Node.js program?How does data binding work in AngularJS?How does Access-Control-Allow-Origin header work?How do I update each dependency in package.json to the latest version?How does Trello access the user's clipboard?How does Facebook disable the browser's integrated Developer Tools?Why do we need middleware for async flow in Redux?
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
I can't quite understand why the join() call below produces different results, depending on the type of argument(s) provided.
Here's what I found:
var test = function()
var args = Array.prototype.join.call(arguments,"_");
return args
;
console.log(test([1,2,3])) // #1: returns 1,2,3
console.log(test(1,2,3)) // #2: returns 1_2_3Given join(arguments, '_'), shouldn't it produce a _ delimited string in both tests above? Why does #1 return a comma delimited value instead?
javascript arrays function
add a comment |
I can't quite understand why the join() call below produces different results, depending on the type of argument(s) provided.
Here's what I found:
var test = function()
var args = Array.prototype.join.call(arguments,"_");
return args
;
console.log(test([1,2,3])) // #1: returns 1,2,3
console.log(test(1,2,3)) // #2: returns 1_2_3Given join(arguments, '_'), shouldn't it produce a _ delimited string in both tests above? Why does #1 return a comma delimited value instead?
javascript arrays function
5
if you tried toconsole.log(arguments)in yourtestfunction, it'd be clear for you how it's working
– Ammar
Jun 17 at 8:00
You can also trytest([1,2,3], [4,5,6])
– Bergi
Jun 17 at 18:41
add a comment |
I can't quite understand why the join() call below produces different results, depending on the type of argument(s) provided.
Here's what I found:
var test = function()
var args = Array.prototype.join.call(arguments,"_");
return args
;
console.log(test([1,2,3])) // #1: returns 1,2,3
console.log(test(1,2,3)) // #2: returns 1_2_3Given join(arguments, '_'), shouldn't it produce a _ delimited string in both tests above? Why does #1 return a comma delimited value instead?
javascript arrays function
I can't quite understand why the join() call below produces different results, depending on the type of argument(s) provided.
Here's what I found:
var test = function()
var args = Array.prototype.join.call(arguments,"_");
return args
;
console.log(test([1,2,3])) // #1: returns 1,2,3
console.log(test(1,2,3)) // #2: returns 1_2_3Given join(arguments, '_'), shouldn't it produce a _ delimited string in both tests above? Why does #1 return a comma delimited value instead?
var test = function()
var args = Array.prototype.join.call(arguments,"_");
return args
;
console.log(test([1,2,3])) // #1: returns 1,2,3
console.log(test(1,2,3)) // #2: returns 1_2_3var test = function()
var args = Array.prototype.join.call(arguments,"_");
return args
;
console.log(test([1,2,3])) // #1: returns 1,2,3
console.log(test(1,2,3)) // #2: returns 1_2_3javascript arrays function
javascript arrays function
edited Jun 17 at 8:06
Kobe
1,6472 silver badges19 bronze badges
1,6472 silver badges19 bronze badges
asked Jun 17 at 7:54
tkim90tkim90
1439 bronze badges
1439 bronze badges
5
if you tried toconsole.log(arguments)in yourtestfunction, it'd be clear for you how it's working
– Ammar
Jun 17 at 8:00
You can also trytest([1,2,3], [4,5,6])
– Bergi
Jun 17 at 18:41
add a comment |
5
if you tried toconsole.log(arguments)in yourtestfunction, it'd be clear for you how it's working
– Ammar
Jun 17 at 8:00
You can also trytest([1,2,3], [4,5,6])
– Bergi
Jun 17 at 18:41
5
5
if you tried to
console.log(arguments) in your test function, it'd be clear for you how it's working– Ammar
Jun 17 at 8:00
if you tried to
console.log(arguments) in your test function, it'd be clear for you how it's working– Ammar
Jun 17 at 8:00
You can also try
test([1,2,3], [4,5,6])– Bergi
Jun 17 at 18:41
You can also try
test([1,2,3], [4,5,6])– Bergi
Jun 17 at 18:41
add a comment |
6 Answers
6
active
oldest
votes
When you pass an array to test, the arguments object becomes an array of arrays, not a plain array of plain values. It's the difference between
arguments = [[1,2,3]];
and
arguments = [1,2,3];
When you call .join on an array of arrays, each inner array gets implicitly coerced to a string first, resulting in '1,2,3' - the values of the inner arrays do not get .joined by the delimiter, only the immediate children of the outer array get .joined by the delimiter.
I didn't know that if the argument was an array, it's wrapped in another array! That makes sense!
– tkim90
Jun 17 at 8:10
1
@tkim90 The arguments are always wrapped in an array, not just when the argument is an array.
– Bergi
Jun 17 at 18:42
add a comment |
In your code, you only have one argument in the first example, that being an array. Joining a single element will remove the brackets:
var test = function()
var args = Array.prototype.join.call(arguments,"_");
return args
;
console.log(test([1,2,3])) // args = [[1,2,3]]
console.log(test(1,2,3)) // args = [1,2,3]
console.log([[1,2,3]].join('_'))
console.log([1,2,3].join('_'))Another way to look at this is to provide another array as an argument to test():
var test = function()
var args = Array.prototype.join.call(arguments,"_");
return args
;
console.log(test([1,2,3], [4,5,6]))add a comment |
The first one, first argument is [1,2,3] which is joined with the second argument, which is nothing -> output is [1,2,3].toString().
Second call, it's actually joining all the 3 arguments, resulting in outputting 1_2_3.
add a comment |
Because you're passing one argument which is an array - so it converts it to a string, then attempts to join it to the other arguments (there are none) so it just returns the string.
var test = function()
var args = Array.prototype.join.call(arguments, "_");
return args
;
console.log(test([1, 2, 3]));
console.log(test(1, 2, 3));You can solve this by checking if there's only one argument passed.
var test = function()
var args = arguments.length == 1 ? arguments[0].join("_") : Array.prototype.join.call(arguments, "_");
return args;
;
console.log(test([1, 2, 3]));
console.log(test(1, 2, 3));add a comment |
In the first example you are not calling .join on the array but on arguments. That variable will be populated with an array-like object that has an array as first index, in essence, you are calling the equivalent of:
let myArguments = [[1, 2, 3]];
console.log(myArguments.join("_"));instead of what you do (the equivalent of) in the second example:
let myArguments = [1, 2, 3];
console.log(myArguments.join("_"));add a comment |
The result is different, because arguments is different.
On the first call (test([1,2,3]), you have one argument which is an array.
On the second call, you have 3 arguments, each one being a number.
Array.prototype.join is meant to be called over arrays. It will stringify each of the items in the array.
In you your first case, your arguments "array" has only one member, which is an array itself. This argument will be stringfied. An array stringfied becomes exactly what is logged in your code.
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f56626979%2fhow-does-join-produce-different-results-depending-on-the-arguments%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
6 Answers
6
active
oldest
votes
6 Answers
6
active
oldest
votes
active
oldest
votes
active
oldest
votes
When you pass an array to test, the arguments object becomes an array of arrays, not a plain array of plain values. It's the difference between
arguments = [[1,2,3]];
and
arguments = [1,2,3];
When you call .join on an array of arrays, each inner array gets implicitly coerced to a string first, resulting in '1,2,3' - the values of the inner arrays do not get .joined by the delimiter, only the immediate children of the outer array get .joined by the delimiter.
I didn't know that if the argument was an array, it's wrapped in another array! That makes sense!
– tkim90
Jun 17 at 8:10
1
@tkim90 The arguments are always wrapped in an array, not just when the argument is an array.
– Bergi
Jun 17 at 18:42
add a comment |
When you pass an array to test, the arguments object becomes an array of arrays, not a plain array of plain values. It's the difference between
arguments = [[1,2,3]];
and
arguments = [1,2,3];
When you call .join on an array of arrays, each inner array gets implicitly coerced to a string first, resulting in '1,2,3' - the values of the inner arrays do not get .joined by the delimiter, only the immediate children of the outer array get .joined by the delimiter.
I didn't know that if the argument was an array, it's wrapped in another array! That makes sense!
– tkim90
Jun 17 at 8:10
1
@tkim90 The arguments are always wrapped in an array, not just when the argument is an array.
– Bergi
Jun 17 at 18:42
add a comment |
When you pass an array to test, the arguments object becomes an array of arrays, not a plain array of plain values. It's the difference between
arguments = [[1,2,3]];
and
arguments = [1,2,3];
When you call .join on an array of arrays, each inner array gets implicitly coerced to a string first, resulting in '1,2,3' - the values of the inner arrays do not get .joined by the delimiter, only the immediate children of the outer array get .joined by the delimiter.
When you pass an array to test, the arguments object becomes an array of arrays, not a plain array of plain values. It's the difference between
arguments = [[1,2,3]];
and
arguments = [1,2,3];
When you call .join on an array of arrays, each inner array gets implicitly coerced to a string first, resulting in '1,2,3' - the values of the inner arrays do not get .joined by the delimiter, only the immediate children of the outer array get .joined by the delimiter.
answered Jun 17 at 7:58
CertainPerformanceCertainPerformance
114k16 gold badges75 silver badges104 bronze badges
114k16 gold badges75 silver badges104 bronze badges
I didn't know that if the argument was an array, it's wrapped in another array! That makes sense!
– tkim90
Jun 17 at 8:10
1
@tkim90 The arguments are always wrapped in an array, not just when the argument is an array.
– Bergi
Jun 17 at 18:42
add a comment |
I didn't know that if the argument was an array, it's wrapped in another array! That makes sense!
– tkim90
Jun 17 at 8:10
1
@tkim90 The arguments are always wrapped in an array, not just when the argument is an array.
– Bergi
Jun 17 at 18:42
I didn't know that if the argument was an array, it's wrapped in another array! That makes sense!
– tkim90
Jun 17 at 8:10
I didn't know that if the argument was an array, it's wrapped in another array! That makes sense!
– tkim90
Jun 17 at 8:10
1
1
@tkim90 The arguments are always wrapped in an array, not just when the argument is an array.
– Bergi
Jun 17 at 18:42
@tkim90 The arguments are always wrapped in an array, not just when the argument is an array.
– Bergi
Jun 17 at 18:42
add a comment |
In your code, you only have one argument in the first example, that being an array. Joining a single element will remove the brackets:
var test = function()
var args = Array.prototype.join.call(arguments,"_");
return args
;
console.log(test([1,2,3])) // args = [[1,2,3]]
console.log(test(1,2,3)) // args = [1,2,3]
console.log([[1,2,3]].join('_'))
console.log([1,2,3].join('_'))Another way to look at this is to provide another array as an argument to test():
var test = function()
var args = Array.prototype.join.call(arguments,"_");
return args
;
console.log(test([1,2,3], [4,5,6]))add a comment |
In your code, you only have one argument in the first example, that being an array. Joining a single element will remove the brackets:
var test = function()
var args = Array.prototype.join.call(arguments,"_");
return args
;
console.log(test([1,2,3])) // args = [[1,2,3]]
console.log(test(1,2,3)) // args = [1,2,3]
console.log([[1,2,3]].join('_'))
console.log([1,2,3].join('_'))Another way to look at this is to provide another array as an argument to test():
var test = function()
var args = Array.prototype.join.call(arguments,"_");
return args
;
console.log(test([1,2,3], [4,5,6]))add a comment |
In your code, you only have one argument in the first example, that being an array. Joining a single element will remove the brackets:
var test = function()
var args = Array.prototype.join.call(arguments,"_");
return args
;
console.log(test([1,2,3])) // args = [[1,2,3]]
console.log(test(1,2,3)) // args = [1,2,3]
console.log([[1,2,3]].join('_'))
console.log([1,2,3].join('_'))Another way to look at this is to provide another array as an argument to test():
var test = function()
var args = Array.prototype.join.call(arguments,"_");
return args
;
console.log(test([1,2,3], [4,5,6]))In your code, you only have one argument in the first example, that being an array. Joining a single element will remove the brackets:
var test = function()
var args = Array.prototype.join.call(arguments,"_");
return args
;
console.log(test([1,2,3])) // args = [[1,2,3]]
console.log(test(1,2,3)) // args = [1,2,3]
console.log([[1,2,3]].join('_'))
console.log([1,2,3].join('_'))Another way to look at this is to provide another array as an argument to test():
var test = function()
var args = Array.prototype.join.call(arguments,"_");
return args
;
console.log(test([1,2,3], [4,5,6]))var test = function()
var args = Array.prototype.join.call(arguments,"_");
return args
;
console.log(test([1,2,3])) // args = [[1,2,3]]
console.log(test(1,2,3)) // args = [1,2,3]
console.log([[1,2,3]].join('_'))
console.log([1,2,3].join('_'))var test = function()
var args = Array.prototype.join.call(arguments,"_");
return args
;
console.log(test([1,2,3])) // args = [[1,2,3]]
console.log(test(1,2,3)) // args = [1,2,3]
console.log([[1,2,3]].join('_'))
console.log([1,2,3].join('_'))var test = function()
var args = Array.prototype.join.call(arguments,"_");
return args
;
console.log(test([1,2,3], [4,5,6]))var test = function()
var args = Array.prototype.join.call(arguments,"_");
return args
;
console.log(test([1,2,3], [4,5,6]))answered Jun 17 at 7:57
KobeKobe
1,6472 silver badges19 bronze badges
1,6472 silver badges19 bronze badges
add a comment |
add a comment |
The first one, first argument is [1,2,3] which is joined with the second argument, which is nothing -> output is [1,2,3].toString().
Second call, it's actually joining all the 3 arguments, resulting in outputting 1_2_3.
add a comment |
The first one, first argument is [1,2,3] which is joined with the second argument, which is nothing -> output is [1,2,3].toString().
Second call, it's actually joining all the 3 arguments, resulting in outputting 1_2_3.
add a comment |
The first one, first argument is [1,2,3] which is joined with the second argument, which is nothing -> output is [1,2,3].toString().
Second call, it's actually joining all the 3 arguments, resulting in outputting 1_2_3.
The first one, first argument is [1,2,3] which is joined with the second argument, which is nothing -> output is [1,2,3].toString().
Second call, it's actually joining all the 3 arguments, resulting in outputting 1_2_3.
answered Jun 17 at 7:58
HRK44HRK44
1,0974 silver badges19 bronze badges
1,0974 silver badges19 bronze badges
add a comment |
add a comment |
Because you're passing one argument which is an array - so it converts it to a string, then attempts to join it to the other arguments (there are none) so it just returns the string.
var test = function()
var args = Array.prototype.join.call(arguments, "_");
return args
;
console.log(test([1, 2, 3]));
console.log(test(1, 2, 3));You can solve this by checking if there's only one argument passed.
var test = function()
var args = arguments.length == 1 ? arguments[0].join("_") : Array.prototype.join.call(arguments, "_");
return args;
;
console.log(test([1, 2, 3]));
console.log(test(1, 2, 3));add a comment |
Because you're passing one argument which is an array - so it converts it to a string, then attempts to join it to the other arguments (there are none) so it just returns the string.
var test = function()
var args = Array.prototype.join.call(arguments, "_");
return args
;
console.log(test([1, 2, 3]));
console.log(test(1, 2, 3));You can solve this by checking if there's only one argument passed.
var test = function()
var args = arguments.length == 1 ? arguments[0].join("_") : Array.prototype.join.call(arguments, "_");
return args;
;
console.log(test([1, 2, 3]));
console.log(test(1, 2, 3));add a comment |
Because you're passing one argument which is an array - so it converts it to a string, then attempts to join it to the other arguments (there are none) so it just returns the string.
var test = function()
var args = Array.prototype.join.call(arguments, "_");
return args
;
console.log(test([1, 2, 3]));
console.log(test(1, 2, 3));You can solve this by checking if there's only one argument passed.
var test = function()
var args = arguments.length == 1 ? arguments[0].join("_") : Array.prototype.join.call(arguments, "_");
return args;
;
console.log(test([1, 2, 3]));
console.log(test(1, 2, 3));Because you're passing one argument which is an array - so it converts it to a string, then attempts to join it to the other arguments (there are none) so it just returns the string.
var test = function()
var args = Array.prototype.join.call(arguments, "_");
return args
;
console.log(test([1, 2, 3]));
console.log(test(1, 2, 3));You can solve this by checking if there's only one argument passed.
var test = function()
var args = arguments.length == 1 ? arguments[0].join("_") : Array.prototype.join.call(arguments, "_");
return args;
;
console.log(test([1, 2, 3]));
console.log(test(1, 2, 3));var test = function()
var args = Array.prototype.join.call(arguments, "_");
return args
;
console.log(test([1, 2, 3]));
console.log(test(1, 2, 3));var test = function()
var args = Array.prototype.join.call(arguments, "_");
return args
;
console.log(test([1, 2, 3]));
console.log(test(1, 2, 3));var test = function()
var args = arguments.length == 1 ? arguments[0].join("_") : Array.prototype.join.call(arguments, "_");
return args;
;
console.log(test([1, 2, 3]));
console.log(test(1, 2, 3));var test = function()
var args = arguments.length == 1 ? arguments[0].join("_") : Array.prototype.join.call(arguments, "_");
return args;
;
console.log(test([1, 2, 3]));
console.log(test(1, 2, 3));answered Jun 17 at 7:58
Jack BashfordJack Bashford
26.7k6 gold badges24 silver badges51 bronze badges
26.7k6 gold badges24 silver badges51 bronze badges
add a comment |
add a comment |
In the first example you are not calling .join on the array but on arguments. That variable will be populated with an array-like object that has an array as first index, in essence, you are calling the equivalent of:
let myArguments = [[1, 2, 3]];
console.log(myArguments.join("_"));instead of what you do (the equivalent of) in the second example:
let myArguments = [1, 2, 3];
console.log(myArguments.join("_"));add a comment |
In the first example you are not calling .join on the array but on arguments. That variable will be populated with an array-like object that has an array as first index, in essence, you are calling the equivalent of:
let myArguments = [[1, 2, 3]];
console.log(myArguments.join("_"));instead of what you do (the equivalent of) in the second example:
let myArguments = [1, 2, 3];
console.log(myArguments.join("_"));add a comment |
In the first example you are not calling .join on the array but on arguments. That variable will be populated with an array-like object that has an array as first index, in essence, you are calling the equivalent of:
let myArguments = [[1, 2, 3]];
console.log(myArguments.join("_"));instead of what you do (the equivalent of) in the second example:
let myArguments = [1, 2, 3];
console.log(myArguments.join("_"));In the first example you are not calling .join on the array but on arguments. That variable will be populated with an array-like object that has an array as first index, in essence, you are calling the equivalent of:
let myArguments = [[1, 2, 3]];
console.log(myArguments.join("_"));instead of what you do (the equivalent of) in the second example:
let myArguments = [1, 2, 3];
console.log(myArguments.join("_"));let myArguments = [[1, 2, 3]];
console.log(myArguments.join("_"));let myArguments = [[1, 2, 3]];
console.log(myArguments.join("_"));let myArguments = [1, 2, 3];
console.log(myArguments.join("_"));let myArguments = [1, 2, 3];
console.log(myArguments.join("_"));answered Jun 17 at 7:59
VLAZVLAZ
6,8425 gold badges25 silver badges37 bronze badges
6,8425 gold badges25 silver badges37 bronze badges
add a comment |
add a comment |
The result is different, because arguments is different.
On the first call (test([1,2,3]), you have one argument which is an array.
On the second call, you have 3 arguments, each one being a number.
Array.prototype.join is meant to be called over arrays. It will stringify each of the items in the array.
In you your first case, your arguments "array" has only one member, which is an array itself. This argument will be stringfied. An array stringfied becomes exactly what is logged in your code.
add a comment |
The result is different, because arguments is different.
On the first call (test([1,2,3]), you have one argument which is an array.
On the second call, you have 3 arguments, each one being a number.
Array.prototype.join is meant to be called over arrays. It will stringify each of the items in the array.
In you your first case, your arguments "array" has only one member, which is an array itself. This argument will be stringfied. An array stringfied becomes exactly what is logged in your code.
add a comment |
The result is different, because arguments is different.
On the first call (test([1,2,3]), you have one argument which is an array.
On the second call, you have 3 arguments, each one being a number.
Array.prototype.join is meant to be called over arrays. It will stringify each of the items in the array.
In you your first case, your arguments "array" has only one member, which is an array itself. This argument will be stringfied. An array stringfied becomes exactly what is logged in your code.
The result is different, because arguments is different.
On the first call (test([1,2,3]), you have one argument which is an array.
On the second call, you have 3 arguments, each one being a number.
Array.prototype.join is meant to be called over arrays. It will stringify each of the items in the array.
In you your first case, your arguments "array" has only one member, which is an array itself. This argument will be stringfied. An array stringfied becomes exactly what is logged in your code.
edited Jun 17 at 8:25
answered Jun 17 at 7:59
Walter MacambiraWalter Macambira
1,89313 silver badges25 bronze badges
1,89313 silver badges25 bronze badges
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f56626979%2fhow-does-join-produce-different-results-depending-on-the-arguments%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
5
if you tried to
console.log(arguments)in yourtestfunction, it'd be clear for you how it's working– Ammar
Jun 17 at 8:00
You can also try
test([1,2,3], [4,5,6])– Bergi
Jun 17 at 18:41