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

Apr 8
11 O'Reilly FREE Books

- Data Analysis
- Data Science
- Machine Learning
- Deep LearningImage
Image
Image
Image
1. Python for Data Analysis

🎄 wesmckinney.com/book/Image
2. Hands-on Machine Learning

🎄 rasa-ai.com/wp-content/upl…Image
Read 14 tweets
Apr 6
10000+ Pages FREE Programming Notes

❯ Python
❯ Java
❯ C/C++, DSA
❯ HTML, CSS, JavaScript
❯ SQL
❯ Linux, Git

40 other subjects - Beginner Friendly Notes

No signup required. Find links inside.Image
1. Python

- More than 200 Chapters
- 700+ Pages

goalkicker.com/PythonBook/Image
2. JavaScript

- More than 100 chapters
- 400+ Pages

goalkicker.com/JavaScriptBook/

❯ Node.js
goalkicker.com/NodeJSBook/

❯ React
goalkicker.com/ReactJSBook/

❯ React Native
goalkicker.com/ReactNativeBoo…

❯ TypeScript
goalkicker.com/TypeScriptBook…

❯ jQuery
goalkicker.com/jQueryBook/

❯ Angular
goalkicker.com/Angular2Book/Image
Read 10 tweets
Apr 5
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
Apr 4
FREE FREE FREE

Best "C++" Books for Absolute Beginners Image
Image
Image
Image
1. Fundamentals of C++ Programming

- 796 pages, 22 chapters
- Fresh Release (2024)
- Absolute Beginner Friendly
- Covers everything
from Hello World! to handling exceptions

🎄 python.cs.southern.edu/cppbook/progcp…Image
2. Thinking in C++

- Available in 2 volumes
- Total ~1400 pages
- Textbook for absolute beginners

❯ Volume1
micc.unifi.it/bertini/downlo…

❯ Volume2
micc.unifi.it/bertini/downlo… Image
Read 6 tweets
Apr 2
Bookmark these 75 sites FOREVER!!!

Open the thread for all the links. Image
1. Web Development (HTML/CSS/JS)

❯ HTML ➟ web.dev/html
❯ HTML ➟ learn-html.org
❯ HTML ➟ developer.mozilla.org/en-US/docs/Lea…

❯ CSS ➟ web.dev/css
❯ CSS ➟ css-tricks.com/guides
❯ CSS ➟ developer.mozilla.org/en-US/docs/Lea…

❯ JavaScript ➟ web.dev/javascript
❯ JavaScript ➟ developer.mozilla.org/en-US/docs/Lea…

❯ HTML & CSS ➟ theodinproject.com/paths/full-sta…
❯ HTML & CSS ➟ scrimba.com/learn-html-and…
2. JavaScript, React, Next, Node.js, Express.js

❯ JavaScript ➟ javascript.info
❯ JavaScript ➟ web.dev/javascript
❯ JavaScript ➟ developer.mozilla.org/en-US/docs/Lea…
❯ JavaScript ➟ theodinproject.com/paths/full-sta…

❯ Node.js ➟ nodejs.org/learn/
❯ Node.js ➟ theodinproject.com/paths/full-sta…

❯ Express.js ➟ developer.mozilla.org/en-US/docs/Lea…
❯ Express.js ➟ expressjs.com/en/starter/ins…

❯ React ➟ scrimba.com/learn-react-c0e
❯ React ➟ theodinproject.com/paths/full-sta…

❯ Next.js ➟ youtube.com/playlist?list=…
Read 10 tweets
Mar 29
When it comes to AI & ML,

These 10 channels will teach you more than any degrees. Image
1. Andrej Karpathy

youtube.com/@AndrejKarpathy

One of the most influential personalities in AI domain.

❯ Neural Networks: Zero to Hero
youtube.com/playlist?list=…

❯ Intro to LLM
youtube.com/watch?v=zjkBMF…

❯ Deep Dive into LLMs
youtube.com/watch?v=7xTGNN… Image
2. sentdex

youtube.com/@Sentdex

❯ Machine Learning
youtube.com/playlist?list=…

❯ Neural Networks from Scratch in Python
youtube.com/playlist?list=… Image
Read 11 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!

:(