Skip to content

Commit 550d638

Browse files
author
Edward King
committed
exercise complete
1 parent 46e2dcb commit 550d638

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

modules/exercises/index.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//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')
55
const randomSelect = //Import function from randomSelect.js.
66

77
//Candidate data:

modules/exercises/randomSelect.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
1+
2+
13
function randomFromArray(arr){
24
//Your code here to select a random element from the array passed to the function.
5+
return arr[Math.floor(Math.random() * arr.length)];
36
}
47

8+
//arr1 =[1, 2, 3];
9+
10+
console.log(randomFromArray(arr1));
511
//TODO: Export the randomFromArray function.
12+
module.exports = randomFromArray;

0 commit comments

Comments
 (0)