Convert all Array Elements to Uppercase in JavaScript-Code Examples

Radu TM

Convert all Array Elements to Uppercase in JavaScript

JavaScript by Radu TM β€’ June 22, 2022

// convert all array elements to uppercase in javascript

const arr = [ 'hi', ' there! 😊' ];

arr.forEach((element, index) => {
  // convert element to uppercase
  arr[index] = element.toUpperCase();
});

console.log(arr); // [ 'HI', 'THERE! 😊' ]

0

22.249

Convert all Array Elements to Uppercase in JavaScript

JavaScript by Radu TM β€’ June 22, 2022

const arr = ['a', 'b', 'c'];

arr.forEach((element, index) => {
  arr[index] = element.toUpperCase();
});

console.log(arr); // ['A', 'B', 'C']

0

22.249

Related JavaScript Queries

Latest JavaScript Queries

Explore code examples by categories