function memory_generateConstPlayfield( n ) { var idGroups = {}; var id = 0; for (let gid = 0; gid < n; ++gid) { idGroups[id] = gid; id += 1; idGroups[id] = gid; id += 1; } return idGroups; } function test_memory_generateConstPlayfield() { let idGroups = memory_generateConstPlayfield(2) if ( Object.keys(idGroups).length == 4 && idGroups[0] == 0 && idGroups[1] == 0 && idGroups[2] == 1 && idGroups[3] == 1 ) { return "OK: memory_generateConstPlayfield" } return "ERR: memory_generateConstPlayfield" } console.log(test_memory_generateConstPlayfield())