Перейти к содержимому

JavaScript Tutorial #14 | reading user input in Node.js

SyntaxPilot

0:00 / 0:00

JavaScript Tutorial #14 | reading user input in Node.js

1 просмотр · 6 ч назад
SyntaxPilot
25 подписчиков
1 просмотр · 6 ч назад
JavaScript Tutorial: Episode 14 of SyntaxPilot's free JavaScript full course, with real-life examples for every concept. reading user input in Node.js. In this video you'll learn: • Why hard-coded values don't scale • ReferenceError: prompt is not defined in Node.js • What stdin (standard input) is • fs.readFileSync(0, "utf8") • Input is always a string: "10" + "20" = "1020" • Number() to convert • split(" ") and split("\n") • The trailing newline bug and trim() • Validating input: NaN, empty, negative • readline: reading line by line • Mini project: a bill from typed orders Every concept starts with a real-life example, then an animation and notes, then live code in the SyntaxPilot online compiler. Practice free in the SyntaxPilot compiler (nothing to install): https://syntaxpilot-learning-2026.web... Detailed notes for this episode (code, outputs, practice): https://syntaxpilot-learning-2026.web... Chapters 00:00 Welcome 00:23 Today's agenda 00:43 Values stuck in the code 01:29 prompt? Not in Node 02:05 Reading stdin 03:23 Strings to numbers 04:08 The phantom order bug 05:20 Checking what people type 06:16 Line by line: readline 07:29 Project: a bill from typed orders 09:46 Common mistakes 10:08 Quick quiz 10:25 Recap and homework 10:47 Next episode Next episode: Basics project: a quiz game Post your homework and quiz answer in the comments, and subscribe for the full basic-to-master playlist, free. #JavaScript #JavaScriptTutorial #SyntaxPilot