-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtimestables.js
More file actions
32 lines (23 loc) · 682 Bytes
/
timestables.js
File metadata and controls
32 lines (23 loc) · 682 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
let num = 5
function timesTable(num) {
let array1 = []
for (n = 1; n <= num; n++) {
array1.push(n)
}
let line2 = array1.map(function(number, index){
return 2 * array1[index]
})
let line3 = array1.map(function(number, index){
return 3 * array1[index]
})
let line4 = array1.map(function(number, index){
return 4 * array1[index]
})
let line5 = array1.map(function(number, index){
return 5 * array1[index]
})
console.log(`${array1.join(' ')} \n${line2.join(' ')} \n${line3.join(' ')} \n${line4.join(' ')} \n${line5.join(' ')}`)
}
// console.log(timesTable(5))
// module.exports = { timesTable: timesTable }
module.exports = timesTable