Exploring Fun with JavaScript String Operations

Thiyagu Arunachalam
2 min readSep 29, 2023

Hey there, future coding wizards! Today, we dive into the fascinating world of JavaScript and learn about string operations. Strings are like digital words that computers understand, and we’ll discover how to play with them in this adventure.

Photo by Greg Rakozy on Unsplash

What are strings?

Strings are a sequence of characters, like letters, numbers, or symbols, that you can use in your code. Think of them as a digital version of your favorite book or a message you send to a friend.

Creating a String?

In JavaScript, you can create a string by enclosing text in single (‘ ‘) or double (“ “) quotes. For example:

let greeting = "Hello, Friend";
let name = 'Alice';

Combining Strings (Concatenation)

Imagine you want to greet someone by combining their name with a message. We can do that with a simple operation called concatenation.

let greeting = "Hello, Friend";
let name = 'Alice';
let message = greeting + name;
console.log(message) //outputs Hello, Friend Alice;

The plus (+) operator is known as the concatenation operator, which is used to combine two strings.

Finding String Length

--

--

Thiyagu Arunachalam

Hi there! I'm a science and technology enthusiast with a passion for writing about the latest developments in science and Tech.