JavaScript - 17

JavaScript - 17: String Methods

You are given a string. Use string methods to:

  • Convert it to uppercase
  • Find the length of the string
  • Check if it contains a specific word
  • Replace a word with another

Print all the results using console.log().

✦ JavaScript Editor
▶ Live Output

👀 Show Solution
let text = "I love learning JavaScript!";

console.log("Uppercase:", text.toUpperCase());
console.log("Length:", text.length);
console.log("Contains 'JavaScript':", text.includes("JavaScript"));
console.log("Replaced:", text.replace("JavaScript", "coding"));