Create join_array_like_objects.md
This commit is contained in:
11
snippets/join_array_like_objects.md
Normal file
11
snippets/join_array_like_objects.md
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
### Joining an array-like object
|
||||||
|
|
||||||
|
The following example joins array-like object (arguments), by calling Function.prototype.call on Array.prototype.join.
|
||||||
|
|
||||||
|
```
|
||||||
|
function f(a, b, c) {
|
||||||
|
var s = Array.prototype.join.call(arguments);
|
||||||
|
console.log(s); // '1,a,true'
|
||||||
|
}
|
||||||
|
f(1, 'a', true);
|
||||||
|
```
|
||||||
Reference in New Issue
Block a user