aboutsummaryrefslogtreecommitdiff
path: root/challenge-145/abigail/node/ch-1.js
blob: 2d4b94d8968e99a92a88a06563a9527bf9db8145 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#!/usr/local/bin/node

//
// See ../README.md
//

//
// Run as: node ch-1.js < input-file
//

let fs      = require ("fs")
let [a, b]  = fs . readFileSync (0) . toString () . trim () . split ("\n") .
              map (line => (line . split (" ")) . map (n => +n))

console . log (a . reduce ((sum, n, i) => {return sum + a [i] * b [i]}, 0))