JAVASCRIPT Tutorial
Strings in programming represent sequences of characters enclosed in single (') or double ("") quotes. They are a fundamental data type used to store and manipulate text.
let str1 = "Hello";
let str2 = "World";
let newStr = str1 + str2; // newStr = "HelloWorld"
let str = "Example String";
str.toUpperCase(); // converts string to uppercase
str.includes("Example"); // checks if string contains substring
let greeting = "Hello, world!";
let name = "John";
let lastName = "Smith";
let fullName = name + " " + lastName;
let sentence = "This is a sentence.";
sentence.toLowerCase(); // "this is a sentence."
sentence.indexOf("sentence"); // 10 (index of first occurrence of "sentence")
let message = "Welcome to JavaScript!";
console.log(message); // Output: Welcome to JavaScript!
let newMessage = message.toUpperCase(); // Convert to uppercase
console.log(newMessage); // Output: WELCOME TO JAVASCRIPT!