Ajay Yadav
Ajay Yadav

@ATechAjay

12 Tweets 2 reads Apr 08, 2022
💛 Day 4️⃣ / 3️⃣0️⃣ days of basics in JavaScript series
→ What is the string data type?
→ What is the meaning of the "immutable" string in javaScript?
→ How to access characters from the string?
→ Strings are case-sensitive?
→ What is backtick in JS?
#javascript30
🧵👇
📌 What is the string data type?
→ A string is a series of characters.
→ Or, it is a set of characters.
→ Or, it represents textual data.
→ Strings are must be surrounded by double or single quotes or backticks( ` ` ).
→ So, length of the string = number of characters in that string.
→ All characters of the string have a position or index.
→ The index or position of the character of the string is start with 0.
→ The 1st character of the string is at 0, for 2nd is at 1, and so on...
📌 What is the meaning of the "immutable" string in javaScript?
→ JavaScript strings are immutable.
→ That means we can not change or alter the string.
→ But, we can assign the string value into a variable is allowed.
📌 How to access characters from the string?
→ There are 2 ways to access the character of the string.
1️⃣ We can access the character of the string using the index.
→ Here string characters treat as the elements of an array.
2️⃣ Or, you can access your character using the charAt( ) method.
→ Just you have to call that method and pass the index value.
📌 Strings are case-sensitive?
→ Yes, javaScript strings are case-sensitive.
→ "ajay" is not equal to "AJAY"
→ Both are different strings.
📌 What is backtick in JS?
→ You can also use backticks to wrap the string.
→ It is also known as "template literals" in javaScript.
👀👇
→ It's used to insert a variable or expression between the string.
→ You can add your variable or expression between curly braces.
👀 ${variable/expression}
💚 That's all for now, we will meet in the next thread!
But if you like make sure to:
1. Follow me @ATechAjay
2. Retweet the first tweet.
3. Turn on the notification to never miss these amazing tweets.
Thank you so much for staying to the end of this thread.

Loading suggestions...