javascript touppercase array code example

Example 1: touppercase javascript array

const names = ['Ali', 'Atta', 'Alex', 'John'];

const uppercased = names.map(name => name.toUpperCase());

console.log(uppercased);

// ['ALI', 'ATTA', 'ALEX', 'JOHN']

Example 2: convert an array to uppercase or lowercase js

var fruits = ["Banana", "Orange", "Apple", "Mango"];
undefined
string = fruits.join(' ').toUpperCase();
// Output"BANANA ORANGE APPLE MANGO"

Example 3: javascript capitalize array

const names = ['Ali', 'Atta', 'Alex', 'John'];

const uppercased = names.map(name => name.toUpperCase());

console.log(uppercased);

// ['ALI', 'ATTA', 'ALEX', 'JOHN']