v1
6/7/2021 by pushkine -00
Setup HTML - click to add setup HTML
disable setup JavaScript
Setup JavaScript
let arr;
let keys;

function init() {
	keys = [];
	if (Math.random() > 0.5) {
		arr = { a: Math.random(), b: Math.random(), c: Math.random(), d : Math.random()};
	} else {
		arr = [Math.random(),Math.random(),Math.random(),Math.random()];
	}
}

function* iterate_keys(arr) {
	if(arr.constructor === Object) {
		let key = "";
		for (key in arr) yield key;
	} else {
		for (let i = 0; i < arr.length; i++) yield i;
	}
}
delete caserun single casemove downdrag and drop case


ready



init();
let i = 0;
if(arr.constructor === Object) {
	let key = "";
	for (key in arr) keys[i++] = key;
} else {
	for (; i < arr.length; i++) keys[i] = i;
}
delete caserun single casemove upmove downdrag and drop case


ready



init();
keys = Object.keys(arr);
delete caserun single casemove updrag and drop case


ready



init();
let i = 0;
for(const key of iterate_keys(arr)) {
	keys[i++] = key;
}
Test Case - click to add another test case
Teardown JS - click to add teardown JavaScript
Output (DOM) - click to monitor output (DOM) while test is running
RUN