サンプルプログラム1(PL JavaScript編)

// hello world を出力する最初の第一歩的プログラム
console.log("Hello World")
// 一行読むだけのプログラム(呼んだ文字列は単に破棄される)
require('readline').createInterface({
  input: process.stdin
}).on('line',(line)=>{
    process.exit(0)
})
// 一行分 読んだものを書く 
require('readline').createInterface({
  input: process.stdin
}).on('line',(line)=>{
  console.log(line)
  process.exit(0)
})
// 一行ずつ 読んでは書く(オウム返し的プログラム)
require('readline').createInterface({
  input: process.stdin
}).on('line',(line)=>{
  console.log(line)
})
// 一行ずつ 読んでは書く(オウム返し的プログラム)
let rl=require('readline')
rl.createInterface({
  input: process.stdin
})
rl.on('line',function(line){
  console.log(line)
})

補足 Rubyとの違い及び共通点

(これまでに出てきたコードに関連して)