File tree 2 files changed +10
-3
lines changed
2 files changed +10
-3
lines changed Original file line number Diff line number Diff line change 1
1
//Import modules:
2
- const input = //Import readline-sync.
3
- const averages = //Import functions from averages.js.
4
- const printAll = //Import function from display.js.
2
+ const input = require ( 'readline-sync' ) / //Import readline-sync.
3
+ const averages = require ( './averages' ) //Import functions from averages.js.
4
+ const printAll = require ( './ display.js' )
5
5
const randomSelect = //Import function from randomSelect.js.
6
6
7
7
//Candidate data:
Original file line number Diff line number Diff line change
1
+
2
+
1
3
function randomFromArray ( arr ) {
2
4
//Your code here to select a random element from the array passed to the function.
5
+ return arr [ Math . floor ( Math . random ( ) * arr . length ) ] ;
3
6
}
4
7
8
+ //arr1 =[1, 2, 3];
9
+
10
+ console . log ( randomFromArray ( arr1 ) ) ;
5
11
//TODO: Export the randomFromArray function.
12
+ module . exports = randomFromArray ;
You can’t perform that action at this time.
0 commit comments