//form.js
response = await fetch(file.php', {
method: 'POST',
body: new FormData(form)
});
if(response.ok){
modalSuccess.open();
} else{
modalError.open();
}
let array = [1,2,3,4,5,6,7,8,9,10,11]
const chunkSize = 3;
let chunks = [];
for (let i = 0; i < array.length; i += chunkSize) {
chunks.push( array.slice(i, i + chunkSize) );
}
// на выходе
[
[1, 2, 3],
[4, 5, 6],
[7, 8, 9],
[10, 11]
]