Sandro Rey
Sandro Rey

Reputation: 2989

NodeJs: Upper case a string

I want to Upper case a string, I've tried this, but none of them works

format.printf((info:any) => `${info.timestamp} ${upperCase(info.level)}: ${info.message}`)
format.printf((info:any) => `${info.timestamp} ${capitalize.words(info.level)}: ${info.message}`)
format.printf((info:any) => `${info.timestamp} ${capitalize(info.level)}: ${info.message}`)

Upvotes: 2

Views: 14032

Answers (1)

Rise
Rise

Reputation: 1601

Try to use JavaScript built-in function toUpperCase().

Something like below.

var str = "Hello World!";
var res = str.toUpperCase();

console.log(res) // "HELLO WORLD!"

Official guide: https://www.w3schools.com/jsref/jsref_touppercase.asp

Upvotes: 10

Related Questions