Skip to content

Commit 92c364a

Browse files
June LeeJune Lee
authored andcommitted
completed: ObjectsStudio01.js
1 parent dcd6665 commit 92c364a

1 file changed

Lines changed: 13 additions & 3 deletions

File tree

objects-and-math/studio/ObjectsStudio01.js

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,21 @@
11
// Code your selectRandomEntry function here:
2-
3-
2+
function selectRandomEntry(howMany) {
3+
let selection = [];
4+
let index;
5+
while (selection.length < howMany) {
6+
index = Math.floor(Math.random()*(idNumbers.length));
7+
if(selection.includes(idNumbers)) {
8+
index = index
9+
}
10+
selection.push(idNumbers[index]);
11+
}
12+
return selection;
13+
}
414
// Code your buildCrewArray function here:
515

616

717
let idNumbers = [291, 414, 503, 599, 796, 890];
8-
18+
//console.log(selectRandomEntry(3))
919
// Here are the candidates and the 'animals' array:
1020
let candidateA = {
1121
'name':'Gordon Shumway',

0 commit comments

Comments
 (0)