JSFiddle - React, Tailwind, and code Playground
by bryandowning
JavaScript
var superArr = [];
function Clip(a) {
this.length = a;
}
/*
* num: number of clip collections to add to container
* max: number of clips per collection
* container: array to add collections to
*/
function addClips( num, max, container ){
while(num--){
// arr: a collection of clips
var arr = [];
for( var i = 0; i < max; i++ ){
arr.push(
// just did a random number for the length
new Clip( Math.floor( Math.random() * 10 ) )
);
}
container.push( arr );
}
}
addClips( 5, 8, superArr );
console.log( superArr );
console.log( superArr[0][0].length );