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

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

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

require ('readline')
. createInterface ({input: process . stdin})
. on ('line', _ =>
       console . log (_ . trim    ()        // Remove leading/trailing spaces
                        . split   (/\s+/)   // Split on white space
                        . reverse ()        // Reverse the words
                        . join    (" ")))   // And join them again.
;