Введи у термінал (після встановлення NodeJS
):
npm install prompt-and-alert
Постав у початок файлу:
let write = require('prompt-and-alert').write;
let writeWord = require('prompt-and-alert').writeWord;
let writeLine = require('prompt-and-alert').writeLine;
let alert = require('prompt-and-alert').alert;
let getChar = require('prompt-and-alert').getChar;
let read = require('prompt-and-alert').read;
let readWord = require('prompt-and-alert').readWord;
let readLine = require('prompt-and-alert').readLine;
let readAll = require('prompt-and-alert').readAll;
let prompt = require('prompt-and-alert').prompt;
-
write(text, end)
— вивід тексту у консольtext
— текст, який буде виведений у консольend
— кінець виводу -
writeWord(text, end)
— вивід слова у консольtext
— текст, який буде виведений у консольend
— кінець слова -
writeLine(text, end)
— вивід рядка у консольtext
— текст, який буде виведений у консольend
— кінець рядка -
alert(msg)
— вивід повідомлення у консольmsg
— повідомлення, яке буде виводитися у консоль -
getChar()
— отримання char-коду останнього непрочитаного символа -
read(end)
— читання з консолі до кінцяend
— кінець -
readWord(end)
— читання останнього непрочитаного словаend
— кінець слова -
readLine(sep)
— читання останнього непрочитаного рядкаsep
— розділювач, який розділяє слова в рядку, по ньому відбувається поділ рядка на масив слів. При розділювачі""
ділення на масив слів не відбувається. -
readAll()
— читання усьогу потоку з консолі -
prompt(msg)
— читання з консолі після вивіду у консоль повідомленняmsg
— повідомлення, яке буде виводитися у консоль
Type to terminal (after installing NodeJS
):
npm install prompt-and-alert
Put on a start of a file:
let write = require('prompt-and-alert').write;
let writeWord = require('prompt-and-alert').writeWord;
let writeLine = require('prompt-and-alert').writeLine;
let alert = require('prompt-and-alert').alert;
let getChar = require('prompt-and-alert').getChar;
let read = require('prompt-and-alert').read;
let readWord = require('prompt-and-alert').readWord;
let readLine = require('prompt-and-alert').readLine;
let readAll = require('prompt-and-alert').readAll;
let prompt = require('prompt-and-alert').prompt;
-
write(text, end)
— text output to the consoletext
— the text that will be output to the consoleend
— the end of the output -
writeWord(text, end)
— output the word to the consoletext
— the text that will be output to the consoleend
— the end of a word -
writeLine(text, end)
— output a line to the consoletext
— the text that will be output to the consoleend
— the end of the line -
alert(msg)
— output a message to the consolemsg
— the message that will be output to the console -
getChar()
— getting the char code of the last unread character -
read(end)
— reading from the console to the endend
— the end -
readWord(end)
- reading the last unread wordend
— the end of a word -
readLine(sep)
- reading the last unread linesep
— the delimiter that separates words in a line, it is used to divide the line into an array. With the separator""
, division into an array of words does not occur. -
readAll()
— reading the entire stream from the console -
prompt(msg)
- reading from the console after outputting a message to the consolemsg
— the message that will be output to the console
v2.1.0
(c)
2022-07-19 alkhizha, s0urcedev