OneBite.Dev - Coding blog in a bite size

convert a string to uppercase in Javascript

Code snippet on how to convert a string to uppercase in Javascript

  let string = 'Uppercase Me!';
  let upperCasedString = string.toUpperCase();
  console.log(upperCasedString);

This code converts a string to uppercase. It starts by setting a variable called string with the string value ‘Uppercase Me!‘. Then it sets a new variable called upperCasedString with the value of the string variable, converted to uppercase using the .toUpperCase() function. Finally, it logs the new upperCasedString to the console.

javascript