😂Javascript Array chunkArrayInGroups(arr, size)
http://www.java2s.com/ref/javascript/javascript-array-chunkarrayingroups-arr-size.html

D:\Tiah\working\MARUNO-21\test.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<script>
/*/*from w ww. j a v a 2 s .c o m*/
// Write a function that splits an array (first argument) into groups the length of size (second argument) and returns them as a two-dimensional array.
// Remember to use Read-Search-Ask if you get stuck. Write your own code.
// Here are some helpful links:
// Array.prototype.push()
// Array.prototype.slice()
function chunkArrayInGroups(arr, size) {
var newArray = [];
for (var i = 0; i < arr.length; i += size) {
newArray.push(arr.slice(i, size + i));
}
return newArray;
}
console.log(chunkArrayInGroups(["a", "b", "c", "d","e"], 2));
</script>
</body>
</html>Hoặc
PreviousScripts: async, defer phần 2(ok)NextSequentially Resolve Promises Works, Giải quyết tuần tự các lời hứa hoạt động (ok)
Last updated