WE_USE_JS Telegram 4114
👩‍💻 Чтение ввода и преобразование в верхний регистр

Напишите скрипт на Node.js, который читает строки из стандартного ввода и выводит их в верхнем регистре. Если пользователь вводит "exit", программа завершается.

Пример:

hello
HELLO
world
WORLD
exit


Решение задачи🔽

process.stdin.setEncoding('utf8');

process.stdin.on('data', (data) => {
const lines = data.trim().split('\n');
for (const line of lines) {
if (line.toLowerCase() === 'exit') {
process.exit(0);
} else {
console.log(line.toUpperCase());
}
}
});
Please open Telegram to view this post
VIEW IN TELEGRAM
👍6



tgoop.com/we_use_js/4114
Create:
Last Update:

👩‍💻 Чтение ввода и преобразование в верхний регистр

Напишите скрипт на Node.js, который читает строки из стандартного ввода и выводит их в верхнем регистре. Если пользователь вводит "exit", программа завершается.

Пример:

hello
HELLO
world
WORLD
exit


Решение задачи🔽

process.stdin.setEncoding('utf8');

process.stdin.on('data', (data) => {
const lines = data.trim().split('\n');
for (const line of lines) {
if (line.toLowerCase() === 'exit') {
process.exit(0);
} else {
console.log(line.toUpperCase());
}
}
});

BY Node.JS [ru] | Серверный JavaScript


Share with your friend now:
tgoop.com/we_use_js/4114

View MORE
Open in Telegram


Telegram News

Date: |

Hui said the time period and nature of some offences “overlapped” and thus their prison terms could be served concurrently. The judge ordered Ng to be jailed for a total of six years and six months. The channel also called on people to turn out for illegal assemblies and listed the things that participants should bring along with them, showing prior planning was in the works for riots. The messages also incited people to hurl toxic gas bombs at police and MTR stations, he added. End-to-end encryption is an important feature in messaging, as it's the first step in protecting users from surveillance. Co-founder of NFT renting protocol Rentable World emiliano.eth shared the group Tuesday morning on Twitter, calling out the "degenerate" community, or crypto obsessives that engage in high-risk trading. Those being doxxed include outgoing Chief Executive Carrie Lam Cheng Yuet-ngor, Chung and police assistant commissioner Joe Chan Tung, who heads police's cyber security and technology crime bureau.
from us


Telegram Node.JS [ru] | Серверный JavaScript
FROM American