JavaScript - Algorithm exercise - Dividing an array in small partsHow do I check if an array includes an object in JavaScript?Deleting array elements in JavaScript - delete vs spliceHow to insert an item into an array at a specific index (JavaScript)?How do you check if a variable is an array in JavaScript?Sorting an array of JavaScript objects by propertyHow do I empty an array in JavaScript?Loop through an array in JavaScriptHow do I remove a particular element from an array in JavaScript?How can I add new array elements at the beginning of an array in Javascript?For-each over an array in JavaScript?
Does an ice chest packed full of frozen food need ice?
Should an arbiter claim draw at a K+R vs K+R endgame?
At what point in time did Dumbledore ask Snape for this favor?
Was Jesus good at singing?
How to officially communicate to a non-responsive colleague?
Last survivors from different time periods living together
Soft question: Examples where lack of mathematical rigour cause security breaches?
Cross-dimension teleportation using command block or datapack?
Arriving at the same result with the opposite hypotheses
Was there a priest on the Titanic who stayed on the ship giving confession to as many as he could?
What can plausibly explain many of my very long and low-tech bridges?
What is the actual quality of machine translations?
Preventing Employees from either switching to Competitors or Opening Their Own Business
Using a found spellbook as a Sorcerer-Wizard multiclass
Implement Homestuck's Catenative Doomsday Dice Cascader
If you had a giant cutting disc 60 miles diameter and rotated it 1000 rps, would the edge be traveling faster than light?
How Can I Tell The Difference Between Unmarked Sugar and Stevia?
Can a user sell my software (MIT license) without modification?
Was the output of the C64 SID chip 8 bit sound?
Find duplicated column value in CSV
What makes Ada the language of choice for the ISS's safety-critical systems?
Was the Tamarian language in "Darmok" inspired by Jack Vance's "The Asutra"?
How does an ordinary object become radioactive?
How to chain Python function calls so the behaviour is as follows
JavaScript - Algorithm exercise - Dividing an array in small parts
How do I check if an array includes an object in JavaScript?Deleting array elements in JavaScript - delete vs spliceHow to insert an item into an array at a specific index (JavaScript)?How do you check if a variable is an array in JavaScript?Sorting an array of JavaScript objects by propertyHow do I empty an array in JavaScript?Loop through an array in JavaScriptHow do I remove a particular element from an array in JavaScript?How can I add new array elements at the beginning of an array in Javascript?For-each over an array in JavaScript?
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;
I have this algorithm exercise that splits an array into smaller parts. This is working right, but I did not understand the operation. Could someone explain this to me in more detail. Please.
const letters = ['a', 'b', 'c', 'd', 'e']
function chunk(array, size)
const chunked = [];
for (let element of array)
const last = chunked[chunked.length - 1]
if (!last
return chunked;
console.log(chunk(letters, 2))
It returns:
['a','b']
['c'.'d']
['e']
This parameter that in this case is the number 2, which is passed in the function, is the number of items that each array contains.
console.log(chunk(letters, 2))
I didn't understand the fact that it generated 2 arrays 'chunked' and 'last' and in the end only return 'chunked'. But I did not understand the link between the 2 arrays: 'chunked' and 'last'
javascript
add a comment |
I have this algorithm exercise that splits an array into smaller parts. This is working right, but I did not understand the operation. Could someone explain this to me in more detail. Please.
const letters = ['a', 'b', 'c', 'd', 'e']
function chunk(array, size)
const chunked = [];
for (let element of array)
const last = chunked[chunked.length - 1]
if (!last
return chunked;
console.log(chunk(letters, 2))
It returns:
['a','b']
['c'.'d']
['e']
This parameter that in this case is the number 2, which is passed in the function, is the number of items that each array contains.
console.log(chunk(letters, 2))
I didn't understand the fact that it generated 2 arrays 'chunked' and 'last' and in the end only return 'chunked'. But I did not understand the link between the 2 arrays: 'chunked' and 'last'
javascript
2
what exactly you don't understand ?
– Ali
Mar 24 at 16:22
The fact that it generated 2 arrays 'chunk' and 'last' and in the end only return 'chunked'. But I did not understand the 'last' array link
– claudiobitar
Mar 24 at 16:31
add a comment |
I have this algorithm exercise that splits an array into smaller parts. This is working right, but I did not understand the operation. Could someone explain this to me in more detail. Please.
const letters = ['a', 'b', 'c', 'd', 'e']
function chunk(array, size)
const chunked = [];
for (let element of array)
const last = chunked[chunked.length - 1]
if (!last
return chunked;
console.log(chunk(letters, 2))
It returns:
['a','b']
['c'.'d']
['e']
This parameter that in this case is the number 2, which is passed in the function, is the number of items that each array contains.
console.log(chunk(letters, 2))
I didn't understand the fact that it generated 2 arrays 'chunked' and 'last' and in the end only return 'chunked'. But I did not understand the link between the 2 arrays: 'chunked' and 'last'
javascript
I have this algorithm exercise that splits an array into smaller parts. This is working right, but I did not understand the operation. Could someone explain this to me in more detail. Please.
const letters = ['a', 'b', 'c', 'd', 'e']
function chunk(array, size)
const chunked = [];
for (let element of array)
const last = chunked[chunked.length - 1]
if (!last
return chunked;
console.log(chunk(letters, 2))
It returns:
['a','b']
['c'.'d']
['e']
This parameter that in this case is the number 2, which is passed in the function, is the number of items that each array contains.
console.log(chunk(letters, 2))
I didn't understand the fact that it generated 2 arrays 'chunked' and 'last' and in the end only return 'chunked'. But I did not understand the link between the 2 arrays: 'chunked' and 'last'
javascript
javascript
edited Mar 24 at 16:36
claudiobitar
asked Mar 24 at 16:19
claudiobitarclaudiobitar
401113
401113
2
what exactly you don't understand ?
– Ali
Mar 24 at 16:22
The fact that it generated 2 arrays 'chunk' and 'last' and in the end only return 'chunked'. But I did not understand the 'last' array link
– claudiobitar
Mar 24 at 16:31
add a comment |
2
what exactly you don't understand ?
– Ali
Mar 24 at 16:22
The fact that it generated 2 arrays 'chunk' and 'last' and in the end only return 'chunked'. But I did not understand the 'last' array link
– claudiobitar
Mar 24 at 16:31
2
2
what exactly you don't understand ?
– Ali
Mar 24 at 16:22
what exactly you don't understand ?
– Ali
Mar 24 at 16:22
The fact that it generated 2 arrays 'chunk' and 'last' and in the end only return 'chunked'. But I did not understand the 'last' array link
– claudiobitar
Mar 24 at 16:31
The fact that it generated 2 arrays 'chunk' and 'last' and in the end only return 'chunked'. But I did not understand the 'last' array link
– claudiobitar
Mar 24 at 16:31
add a comment |
5 Answers
5
active
oldest
votes
You are creating an array of arrays. The outer array is called chunked
. The last
array is the last inner array up to this point. chunked
looks like:
[[/*some values*/], [/*some values*/], [/* this is last */]]
That's what this line is doing:
const last = chunked[chunked.length - 1] // get the final child array in chunked
You then decide whether to push the current value into this subarray or add a new subarray. This choice is determined by whether the length of last
is less than the chunk size — in other words whether it is full. That's what this test is doing:
if (!last || last.length === size)
The !last
part is used to check if there is a last
array because on the first iteration it won't exist yet — the outer array is empty.
For what it's worth, it might be easier to understand it you just use a simple loop that increments by chunk size:
const letters = ['a', 'b', 'c', 'd', 'e']
function chunk(array, size)
const chunked = [];
for (let i = 0; i < array.length; i+=size)
chunked.push(array.slice(i, i+size))
return chunked
console.log(chunk(letters, 2))
add a comment |
Generally there are three things:
last
contains the last chunk, freshly taken for each iteration, which grows until it reaches the specified size- when
last
reaches the specified size,chunked.push([element])
pushes a new array intochunked
([element]
without an array in front of it, is a short syntax for creating a new array with a single element - and for the next iteration, that is going to be thelast
chunk. Try writingconsole.log(1)
,console.log([1])
and perhapsconsole.log([1,2])
into a JS console to see their difference. - if the
last
chunk has not reached the specified size, theelement
is just appended to it
In particular there is one "trick", for the first iteration: when chunked
is an empty array at the beginning, last = chunked[chunked.length - 1]
translates to chunked[-1]
. Unlike many other languages, JavaScript does not die or throw an exception here, it just says the given element is undefined
, which is a falsy value and triggers the !last
condition, thus the push([element])
thing will run. This is how the first chunk is created.
add a comment |
this will get the last element of chunked
array , which is either undefined
or the last chunk array
const last = chunked[chunked.length - 1]
then you check if last
is undefined
or is an array with size of size
then you add new array to chunked
array with the current element
if (!last || last.length === size)
chunked.push([element])
else , which mean that last is an array with size less than size
, you push current element to last
else
last.push(element)
add a comment |
- a function
chunk
which take 2 arguments, an array and length of chunks - a
chunked
array is defined - using
for
loop iterating over the array - if the
last
array is not the last array insidechunked
array or last element ofchunked
array is equal to size argument, then push new element fromarray
array inside another array so that it form a chunked array - else push the new element from
array
array to last array ofchunked
array - return
chunked
array
add a comment |
More or less: initialize an empty array chunked
.
Inside a loop: look into chunked
's last element. Is it non-existent, or is it already exactly the required length? If yes, take the next letter, make a 1-element array out of it, and append it to chunked
. If no, then append the letter to chunked
's last element instead.
Run the code in a debugger, set watch expressions for chunked
, last
and element
and watch what's happening to them.
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%2f55325872%2fjavascript-algorithm-exercise-dividing-an-array-in-small-parts%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
5 Answers
5
active
oldest
votes
5 Answers
5
active
oldest
votes
active
oldest
votes
active
oldest
votes
You are creating an array of arrays. The outer array is called chunked
. The last
array is the last inner array up to this point. chunked
looks like:
[[/*some values*/], [/*some values*/], [/* this is last */]]
That's what this line is doing:
const last = chunked[chunked.length - 1] // get the final child array in chunked
You then decide whether to push the current value into this subarray or add a new subarray. This choice is determined by whether the length of last
is less than the chunk size — in other words whether it is full. That's what this test is doing:
if (!last || last.length === size)
The !last
part is used to check if there is a last
array because on the first iteration it won't exist yet — the outer array is empty.
For what it's worth, it might be easier to understand it you just use a simple loop that increments by chunk size:
const letters = ['a', 'b', 'c', 'd', 'e']
function chunk(array, size)
const chunked = [];
for (let i = 0; i < array.length; i+=size)
chunked.push(array.slice(i, i+size))
return chunked
console.log(chunk(letters, 2))
add a comment |
You are creating an array of arrays. The outer array is called chunked
. The last
array is the last inner array up to this point. chunked
looks like:
[[/*some values*/], [/*some values*/], [/* this is last */]]
That's what this line is doing:
const last = chunked[chunked.length - 1] // get the final child array in chunked
You then decide whether to push the current value into this subarray or add a new subarray. This choice is determined by whether the length of last
is less than the chunk size — in other words whether it is full. That's what this test is doing:
if (!last || last.length === size)
The !last
part is used to check if there is a last
array because on the first iteration it won't exist yet — the outer array is empty.
For what it's worth, it might be easier to understand it you just use a simple loop that increments by chunk size:
const letters = ['a', 'b', 'c', 'd', 'e']
function chunk(array, size)
const chunked = [];
for (let i = 0; i < array.length; i+=size)
chunked.push(array.slice(i, i+size))
return chunked
console.log(chunk(letters, 2))
add a comment |
You are creating an array of arrays. The outer array is called chunked
. The last
array is the last inner array up to this point. chunked
looks like:
[[/*some values*/], [/*some values*/], [/* this is last */]]
That's what this line is doing:
const last = chunked[chunked.length - 1] // get the final child array in chunked
You then decide whether to push the current value into this subarray or add a new subarray. This choice is determined by whether the length of last
is less than the chunk size — in other words whether it is full. That's what this test is doing:
if (!last || last.length === size)
The !last
part is used to check if there is a last
array because on the first iteration it won't exist yet — the outer array is empty.
For what it's worth, it might be easier to understand it you just use a simple loop that increments by chunk size:
const letters = ['a', 'b', 'c', 'd', 'e']
function chunk(array, size)
const chunked = [];
for (let i = 0; i < array.length; i+=size)
chunked.push(array.slice(i, i+size))
return chunked
console.log(chunk(letters, 2))
You are creating an array of arrays. The outer array is called chunked
. The last
array is the last inner array up to this point. chunked
looks like:
[[/*some values*/], [/*some values*/], [/* this is last */]]
That's what this line is doing:
const last = chunked[chunked.length - 1] // get the final child array in chunked
You then decide whether to push the current value into this subarray or add a new subarray. This choice is determined by whether the length of last
is less than the chunk size — in other words whether it is full. That's what this test is doing:
if (!last || last.length === size)
The !last
part is used to check if there is a last
array because on the first iteration it won't exist yet — the outer array is empty.
For what it's worth, it might be easier to understand it you just use a simple loop that increments by chunk size:
const letters = ['a', 'b', 'c', 'd', 'e']
function chunk(array, size)
const chunked = [];
for (let i = 0; i < array.length; i+=size)
chunked.push(array.slice(i, i+size))
return chunked
console.log(chunk(letters, 2))
const letters = ['a', 'b', 'c', 'd', 'e']
function chunk(array, size)
const chunked = [];
for (let i = 0; i < array.length; i+=size)
chunked.push(array.slice(i, i+size))
return chunked
console.log(chunk(letters, 2))
const letters = ['a', 'b', 'c', 'd', 'e']
function chunk(array, size)
const chunked = [];
for (let i = 0; i < array.length; i+=size)
chunked.push(array.slice(i, i+size))
return chunked
console.log(chunk(letters, 2))
answered Mar 24 at 16:37
Mark MeyerMark Meyer
45.7k33971
45.7k33971
add a comment |
add a comment |
Generally there are three things:
last
contains the last chunk, freshly taken for each iteration, which grows until it reaches the specified size- when
last
reaches the specified size,chunked.push([element])
pushes a new array intochunked
([element]
without an array in front of it, is a short syntax for creating a new array with a single element - and for the next iteration, that is going to be thelast
chunk. Try writingconsole.log(1)
,console.log([1])
and perhapsconsole.log([1,2])
into a JS console to see their difference. - if the
last
chunk has not reached the specified size, theelement
is just appended to it
In particular there is one "trick", for the first iteration: when chunked
is an empty array at the beginning, last = chunked[chunked.length - 1]
translates to chunked[-1]
. Unlike many other languages, JavaScript does not die or throw an exception here, it just says the given element is undefined
, which is a falsy value and triggers the !last
condition, thus the push([element])
thing will run. This is how the first chunk is created.
add a comment |
Generally there are three things:
last
contains the last chunk, freshly taken for each iteration, which grows until it reaches the specified size- when
last
reaches the specified size,chunked.push([element])
pushes a new array intochunked
([element]
without an array in front of it, is a short syntax for creating a new array with a single element - and for the next iteration, that is going to be thelast
chunk. Try writingconsole.log(1)
,console.log([1])
and perhapsconsole.log([1,2])
into a JS console to see their difference. - if the
last
chunk has not reached the specified size, theelement
is just appended to it
In particular there is one "trick", for the first iteration: when chunked
is an empty array at the beginning, last = chunked[chunked.length - 1]
translates to chunked[-1]
. Unlike many other languages, JavaScript does not die or throw an exception here, it just says the given element is undefined
, which is a falsy value and triggers the !last
condition, thus the push([element])
thing will run. This is how the first chunk is created.
add a comment |
Generally there are three things:
last
contains the last chunk, freshly taken for each iteration, which grows until it reaches the specified size- when
last
reaches the specified size,chunked.push([element])
pushes a new array intochunked
([element]
without an array in front of it, is a short syntax for creating a new array with a single element - and for the next iteration, that is going to be thelast
chunk. Try writingconsole.log(1)
,console.log([1])
and perhapsconsole.log([1,2])
into a JS console to see their difference. - if the
last
chunk has not reached the specified size, theelement
is just appended to it
In particular there is one "trick", for the first iteration: when chunked
is an empty array at the beginning, last = chunked[chunked.length - 1]
translates to chunked[-1]
. Unlike many other languages, JavaScript does not die or throw an exception here, it just says the given element is undefined
, which is a falsy value and triggers the !last
condition, thus the push([element])
thing will run. This is how the first chunk is created.
Generally there are three things:
last
contains the last chunk, freshly taken for each iteration, which grows until it reaches the specified size- when
last
reaches the specified size,chunked.push([element])
pushes a new array intochunked
([element]
without an array in front of it, is a short syntax for creating a new array with a single element - and for the next iteration, that is going to be thelast
chunk. Try writingconsole.log(1)
,console.log([1])
and perhapsconsole.log([1,2])
into a JS console to see their difference. - if the
last
chunk has not reached the specified size, theelement
is just appended to it
In particular there is one "trick", for the first iteration: when chunked
is an empty array at the beginning, last = chunked[chunked.length - 1]
translates to chunked[-1]
. Unlike many other languages, JavaScript does not die or throw an exception here, it just says the given element is undefined
, which is a falsy value and triggers the !last
condition, thus the push([element])
thing will run. This is how the first chunk is created.
answered Mar 24 at 16:38
tevemadartevemadar
5,2032928
5,2032928
add a comment |
add a comment |
this will get the last element of chunked
array , which is either undefined
or the last chunk array
const last = chunked[chunked.length - 1]
then you check if last
is undefined
or is an array with size of size
then you add new array to chunked
array with the current element
if (!last || last.length === size)
chunked.push([element])
else , which mean that last is an array with size less than size
, you push current element to last
else
last.push(element)
add a comment |
this will get the last element of chunked
array , which is either undefined
or the last chunk array
const last = chunked[chunked.length - 1]
then you check if last
is undefined
or is an array with size of size
then you add new array to chunked
array with the current element
if (!last || last.length === size)
chunked.push([element])
else , which mean that last is an array with size less than size
, you push current element to last
else
last.push(element)
add a comment |
this will get the last element of chunked
array , which is either undefined
or the last chunk array
const last = chunked[chunked.length - 1]
then you check if last
is undefined
or is an array with size of size
then you add new array to chunked
array with the current element
if (!last || last.length === size)
chunked.push([element])
else , which mean that last is an array with size less than size
, you push current element to last
else
last.push(element)
this will get the last element of chunked
array , which is either undefined
or the last chunk array
const last = chunked[chunked.length - 1]
then you check if last
is undefined
or is an array with size of size
then you add new array to chunked
array with the current element
if (!last || last.length === size)
chunked.push([element])
else , which mean that last is an array with size less than size
, you push current element to last
else
last.push(element)
answered Mar 24 at 16:39
AliAli
6,82731735
6,82731735
add a comment |
add a comment |
- a function
chunk
which take 2 arguments, an array and length of chunks - a
chunked
array is defined - using
for
loop iterating over the array - if the
last
array is not the last array insidechunked
array or last element ofchunked
array is equal to size argument, then push new element fromarray
array inside another array so that it form a chunked array - else push the new element from
array
array to last array ofchunked
array - return
chunked
array
add a comment |
- a function
chunk
which take 2 arguments, an array and length of chunks - a
chunked
array is defined - using
for
loop iterating over the array - if the
last
array is not the last array insidechunked
array or last element ofchunked
array is equal to size argument, then push new element fromarray
array inside another array so that it form a chunked array - else push the new element from
array
array to last array ofchunked
array - return
chunked
array
add a comment |
- a function
chunk
which take 2 arguments, an array and length of chunks - a
chunked
array is defined - using
for
loop iterating over the array - if the
last
array is not the last array insidechunked
array or last element ofchunked
array is equal to size argument, then push new element fromarray
array inside another array so that it form a chunked array - else push the new element from
array
array to last array ofchunked
array - return
chunked
array
- a function
chunk
which take 2 arguments, an array and length of chunks - a
chunked
array is defined - using
for
loop iterating over the array - if the
last
array is not the last array insidechunked
array or last element ofchunked
array is equal to size argument, then push new element fromarray
array inside another array so that it form a chunked array - else push the new element from
array
array to last array ofchunked
array - return
chunked
array
answered Mar 24 at 16:44
Sushant MagooSushant Magoo
194112
194112
add a comment |
add a comment |
More or less: initialize an empty array chunked
.
Inside a loop: look into chunked
's last element. Is it non-existent, or is it already exactly the required length? If yes, take the next letter, make a 1-element array out of it, and append it to chunked
. If no, then append the letter to chunked
's last element instead.
Run the code in a debugger, set watch expressions for chunked
, last
and element
and watch what's happening to them.
add a comment |
More or less: initialize an empty array chunked
.
Inside a loop: look into chunked
's last element. Is it non-existent, or is it already exactly the required length? If yes, take the next letter, make a 1-element array out of it, and append it to chunked
. If no, then append the letter to chunked
's last element instead.
Run the code in a debugger, set watch expressions for chunked
, last
and element
and watch what's happening to them.
add a comment |
More or less: initialize an empty array chunked
.
Inside a loop: look into chunked
's last element. Is it non-existent, or is it already exactly the required length? If yes, take the next letter, make a 1-element array out of it, and append it to chunked
. If no, then append the letter to chunked
's last element instead.
Run the code in a debugger, set watch expressions for chunked
, last
and element
and watch what's happening to them.
More or less: initialize an empty array chunked
.
Inside a loop: look into chunked
's last element. Is it non-existent, or is it already exactly the required length? If yes, take the next letter, make a 1-element array out of it, and append it to chunked
. If no, then append the letter to chunked
's last element instead.
Run the code in a debugger, set watch expressions for chunked
, last
and element
and watch what's happening to them.
answered Mar 24 at 16:44
mbojkombojko
3,1821415
3,1821415
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%2f55325872%2fjavascript-algorithm-exercise-dividing-an-array-in-small-parts%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
2
what exactly you don't understand ?
– Ali
Mar 24 at 16:22
The fact that it generated 2 arrays 'chunk' and 'last' and in the end only return 'chunked'. But I did not understand the 'last' array link
– claudiobitar
Mar 24 at 16:31