Swapna Kumar Panda Profile picture
Dec 7, 2021 β€’ 13 tweets β€’ 4 min read β€’ Read on X
πŸ’œ Strings in JavaScript

String
↳ Primitive
↳ String Literals
↳ Single Quotes
↳ Double Quotes
↳ Back Tick
↳ String()
↳ Object
↳ new String()

Full Details Inside.

⇩
Let's explore

1️⃣ Primitive vs Object Type
2️⃣ Auto Convertible
3️⃣ Immutable
4️⃣ Easily Comparable
5️⃣ Array-Like
6️⃣ Spreadable
7️⃣ Possible to Destructure
1️⃣ Primitive vs Object Type

βœͺ In JavaScript, a string value can either be a primitive or, an object.

βœͺ What is Primitive?
A primitive is a data that is not an object and has no methods.
1️⃣.1️⃣ String Primitives

βœͺ String Primitives are created either by using String Literals or, String function [String()].

βœͺ A String Primitive has a separate data type: "string"
1️⃣.1️⃣.1️⃣ String Literals

βœͺ What is a String Literal?
String literals can be specified using single quotes ( ' ) or double quotes ( " ) or back tick characters ( ` ).

Example: πŸ‘‡ Image
1️⃣.1️⃣.2️⃣ String Function

βœͺ String function can be called in a non-constructor context (i.e., without using the new keyword).

βœͺ This basically is used to convert data of other types to string.

βœͺ After conversion, it returns a string literal.

Example: πŸ‘‡ Image
1️⃣.2️⃣ String Objects

βœͺ String primitives have a wrapper equivalent.

βœͺ String objects can be created using constructor of String type i.e., new String()

βœͺ It is mostly discouraged to create String objects manually as they mostly operate as wrappers of primitives. Image
2️⃣ Auto Convertible

βœͺ In contexts where a method is to be invoked on a primitive string or a property lookup occurs, JavaScript will automatically wrap the String primitive to a String object.

βœͺ And then call the method or perform the property lookup on the object. Image
3️⃣ Immutable

βœͺ By immutable, it means the original value (or, content) cannot be altered.

βœͺ Strings are immutable in JavaScript.

βœͺ None of the methods or, properties can alter the original string. When required to alter, they return a new string.

Example: πŸ‘‡ Image
4️⃣ Easily Comparable

βœͺ In JavaScript, string literals can easily be compared using comparison operators like ==, !=, <, <=, >, >=.

Example: πŸ‘‡ Image
5️⃣ Array-Like

βœͺ An Array-Like looks like an Array. It has a length property. It's iterable. And, its elements can be accessed using indexes.

βœͺ In JavaScript, strings are not real arrays, rather just array-like.

Example: πŸ‘‡ Image
6️⃣ Spreadable

βœͺ Like an array, a string can also be used along with spread operator [...]

βœͺ Spread Operator Assignment returns a new array of all characters in the string.

Example: πŸ‘‡ Image
7️⃣ Possible to Destructure

βœͺ Like an array, a string can also be destructured.

Let's see πŸ‘‡ Image

β€’ β€’ β€’

Missing some Tweet in this thread? You can try to force a refresh
γ€€

Keep Current with Swapna Kumar Panda

Swapna Kumar Panda Profile picture

Stay in touch and get notified when new unrolls are available from this author!

Read all threads

This Thread may be Removed Anytime!

PDF

Twitter may remove this content at anytime! Save it as PDF for later use!

Try unrolling a thread yourself!

how to unroll video
  1. Follow @ThreadReaderApp to mention us!

  2. From a Twitter thread mention us with a keyword "unroll"
@threadreaderapp unroll

Practice here first or read more on our help page!

More from @swapnakpanda

Jul 1
πŸ‘©β€πŸ’» Practice these 150+ Algorithms in

❍ C/C++
❍ Java
❍ Python
❍ JavaScript
Or, any language of your choice

Stay in top 5% of programmers.
➊ Arrays

βž€ Creating an Array
➁ Iterate through Array
βž‚ Get an Element
βžƒ Search an Element
βž„ Insert Element(s)
βž… Delete Element(s)
βž† Filter an Array
βž‡ Fetch a Sub-Array
➈ Merging Arrays
βž‰ Reverse Array
βž€βž€ Rotate Array
βž‹ Linked Lists

βž€ Creating a Linked List
➁ Iterate through Linked List
βž‚ Get an Element
βžƒ Find an Element

➀ Insert Element(s)
βž„ At Start
βž… At End
βž† At Anywhere

➀ Delete Element(s)
βž‡ From Start
➈ From End
βž‰ From Anywhere

βž€βž€ IsEmpty
βž€βž Merging Linked Lists
βž€βž‚ Reverse Linked List
βž€βžƒ Check for Cycles

Implement these algorithms for linked lists, double linked lists, circular linked lists, etc.
Read 19 tweets
Jun 27
FREE FREE FREE

11 Python Books, Absolutely FREEImage
Image
Image
Image
1. Machine Learning with Python

πŸŽ„ python-course.eu/books/bernd_kl…Image
Image
2. Data Structures & Algorithms using Python

This book of 222 pages implements all types of data structures and algorithms.

πŸŽ„ donsheehy.github.io/datastructures…Image
Image
Read 12 tweets
Jun 23
Top 60+ YouTube Courses to learn

- Python
- Java
- C/C++
- JavaScript
- C#
- PHP
- SQL
- RustImage
Image
Image
Image
2. JavaScript

❯ JavaScript
youtube.com/playlist?list=…

❯ JavaScript
youtube.com/playlist?list=…

❯ Node.js
youtube.com/playlist?list=…

❯ Express
youtube.com/playlist?list=…

❯ TypeScript
youtube.com/playlist?list=…

❯ React
youtube.com/watch?v=x4rFhT…

❯ React
youtube.com/playlist?list=…

❯ Next.js 15
youtube.com/playlist?list=…

❯ Next.js 15 & React 19 Projects
youtube.com/playlist?list=…

❯ React Native
youtube.com/playlist?list=…Image
Read 11 tweets
Jun 20
MIT's FREE AI & ML Courses

❯ 6.036 - Machine Learning
❯ 6.S191 - Deep Learning
❯ 6.034 - Artificial Intelligence
❯ 18.05 - Probability and Statistics
❯ 18.06 - Linear Algebra
❯ 18.S096 - Matrix Calculus

All course links inside:
1. 6.036 - Machine Learning

❯ Course Link
openlearninglibrary.mit.edu/courses/course…

❯ YouTube Playlist
youtube.com/playlist?list=…Image
Image
2. 6.S191 - Deep Learning

❯ Course Link
introtodeeplearning.com

❯ YouTube Playlist
youtube.com/playlist?list=…Image
Image
Read 8 tweets
Jun 19
Save these 100+ Sites FOREVER!!!

Open the thread for all the links: Image
1. Python, AI & ML, Data Science

❯ Python ➟ realpython.com
❯ Python ➟ fullstackpython.com
❯ Python ➟ planetpython.org

❯ Django ➟ learndjango.com

❯ Flask ➟ blog.miguelgrinberg.com/post/the-flask…

❯ FastAPI ➟ fastapi.tiangolo.com/learn/

❯ Machine Learning ➟ developers.google.com/machine-learni…

❯ Machine Learning ➟ tensorflow.org/resources/lear…

❯ Tensorflow ➟ tensorflow.org/learn

❯ Data Science ➟ towardsdatascience.com
2. SQL and NoSQL

❯ SQL ➟ sqlbolt.com
❯ SQL ➟ sqlzap.com
❯ SQL ➟ sqltutorial.org
❯ SQL ➟ mode.com/sql-tutorial
❯ MySQL ➟ mysqltutorial.org
❯ PostgreSQL ➟ postgresqltutorial.com
❯ SQL Server ➟ sqlservertutorial.org
❯ Oracle ➟ oracletutorial.com
❯ MongoDB ➟ mongodbtutorial.org
❯ Redis ➟ university.redis.io/academy
❯ Kafka ➟ confluent.io/lp/apache-kafk…
Read 14 tweets
Jun 18
I am a JavaScript Developer since 2005.

If I plan to learn it in 2025, I will do this:
➊ Fundamentals

Effort: 1 to 2 hours per day
Time: 2 weeks

βž€ JavaScript Engine
➁ JavaScript Runtime
βž‚ Execution Context
βžƒ Hoisting
βž„ Call Stack
βž… Event Loop
βž† Callback Queue
βž‹ Variables and, Datatypes

Effort: 1 to 2 hours per day
Time: 2 weeks

βž€ Datatypes
❯ Primitives
❯ Literals
❯ Numeric
❯ Boolean
❯ String

➁ Variable
❯ Naming
❯ Declaration (var, let, const)
❯ Assignment

✧ Special Topic
❯ Type Coercion
❯ undefined, null, NaNImage
Read 17 tweets

Did Thread Reader help you today?

Support us! We are indie developers!


This site is made by just two indie developers on a laptop doing marketing, support and development! Read more about the story.

Become a Premium Member ($3/month or $30/year) and get exclusive features!

Become Premium

Don't want to be a Premium member but still want to support us?

Make a small donation by buying us coffee ($5) or help with server cost ($10)

Donate via Paypal

Or Donate anonymously using crypto!

Ethereum

0xfe58350B80634f60Fa6Dc149a72b4DFbc17D341E copy

Bitcoin

3ATGMxNzCUFzxpMCHL5sWSt4DVtS8UqXpi copy

Thank you for your support!

Follow Us!

:(