'Write a JavaScript console program to read the input file and convert the sentence into acronym

Input and Output Format: Refer sample input and output for formatting specifications. Input is a data (sentence separated by space) Output displays the converted acronym. (Uppercases) Note: Input should be read from input.txt Input accepts special characters and numbers also.

Input 1: Hyper text markup language

Output 1: HTML

Input 2: What is the time now ?

Output 1: WITTN?



Solution 1:[1]

const str = "What is the time now ?"
const output = str.split(" ")
    .map(w => w[0].toUpperCase()).join("")
console.log(str, output)

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 phentnil