標準入力から3つの趣味(文字列)を入力し、それらを配列に格納した後に、標準入力から配列の添え字を入力し、指定された要素のみ表示するプログラムを作成せよ。
Script const rl = require('readline').createInterface({ input: process.stdin, output: process.stdout }) const readLinePromise = (message) => { return new Promise((resolve, reject) => { rl.question(message, (answer) => { resolve(answer) }) }) } const main = async () => { const first = await readLinePromise('please input first: ') const second = await readLinePromise('please input second: ') const third = await readLinePromise('please input third: ') const hobbies = [first, second, third] rl.close() console.log(hobbies) const index = await readLinePromise('please input index: ') console.log(hobbies[index]) } main()