-4
const episodes = [
{ id: 's06e01', title: 'Pilot' },
{ id: 's06e02', title: 'Top Banana' },
{ id: 's06e03', title: 'Charity Drive' },
{ id: 's06e04', title: 'Visiting Ours' },
{ id: 's06e05', title: 'My Mother, the Car' },
{ id: 's06e06', title: 'In God We Trust' },
{ id: 's06e07', title: 'Storming the castle' },
{ id: 's06e08', title: 'Pier Pressure' },
{ id: 's06e09', title: 'Public Relations' },
];
const finaleEpisode = { id: 's06e10', title: 'Bringing Up Buster' };
const addToPlaylist = episodes.concat(finaleEpisode)
for (let i = 0; i < addToPlaylist.length; i++) {
setTimeout(() => {
// clears all characters printer on previous loop
process.stdout.clearLine();
// use \r at the end to return the cursor to the begining
process.stdout.write("You are Now Watching " + addToPlaylist[i].id + ' ' + addToPlaylist[i].title + "\r");
}, i * 2000);
}
setTimeout(function(){console.log('\x1Bc'); }, 21000);
で使用するのNode.jsアプリケーションをリファクタリングする必要がありますそれぞれの繰り返しで1秒間、「あなたは今見ている」という文字列で連結されていますこのコードは、コンソールログが遅れで表示し、次のエピソードを表示するには、削除される時に各エピソード1を表示Node.jsの上で実行されたときに、ブラウザ
ブラウザでオブジェクト全体を最初に表示するようにコードを再フォーマットしたいのですが、一度表示されると、ブラウザーから何も表示されなくなるまで、また、.filter()とObject.assign()を再フォーマットされたコードに使用するまで、ブラウザーからの注文を受け取ります。
あなたが何をしましたか?あなたはどこにいるのですか? StackOverflowはあなたの仕事をするためのものではなく、あなたが立ち往生している場所の非常に特殊な問題を助けるためのものです。 – samanime
特定の質問をしていただけますか? –
'process'呼び出しを破棄し、' process..write'を 'console.log'に置き換えます。 – dhilt