Mujeeb Ahmed Profile picture
Mar 22, 2022 21 tweets 8 min read Read on X
JavaScript String Methods and Properties.

A Mega 🧵. Image
1. What is a JavaScript String?
- JavaScript strings are for storing and manipulating text.
-A JavaScript string is zero or more characters written inside quotes.

➡️Example:- Image
2. JavaScript Methods and Properties.

2.1. String length

To find the length of a string, use the built-in length property:

Example:- Image
2.2. slice() :-

-slice() extracts a part of a string and returns the extracted part in a new string.

-The method takes 2 parameters: the start position, and the end position (end not included).

-JavaScript counts positions from zero.
First position is 0.
Second position is 1. ImageImage
2.3. substring():-

substring() is similar to slice().

The difference is that substring() cannot accept negative indexes.

Example:

2.4. substr();
substr() is similar to slice().

The difference is that the second parameter specifies the length of the extracted part.

Example: ImageImage
2.5. Replacing String Content;-
The replace() method replaces a specified value with another value in a string:

Example:-

-This method does not change the string it is called on.

-It returns a new string.

-It replaces only the first match

-it is case sensitive. Image
2.6. toLowerCase():-
A string is converted to lower case with toLowerCase().
Example:-

2.7. toUpperCase();-
A string is converted to Upper case with toUpperCase().
Example:- ImageImage
2.8. concat();-
concat() joins two or more strings.
Example;-

2.9, String trim():-
The trim() method removes whitespace from both sides of a string:
Example:- ImageImage
3. String Padding:-
ECMAScript 2017 added two String methods: padStart and padEnd to support padding at the beginning and at the end of a string.

10.1. padStart():-

This Method will start giving padding from the start. Image
10.2. padEnd():-
This Method will start giving padding from the End.
Example:- Image
4. Extracting String Characters
There are 3 methods for extracting string characters:

4.1. charAt(position):-

The charAt() method returns the character at a specified index (position) in a string:

Example:- Image
4.2. charCodeAt(position):-
String charCodeAt()
The charCodeAt() method returns the unicode of the character at a specified index in a string:

The method returns a UTF-16 code (an integer between 0 and 65535).

Example:- Image
4.3. Property access [ ]:-
ECMAScript 5 (2009) allows property access [ ] on strings:

Example:- Image
5. String Search Methods.

5.1. String indexOf()
The indexOf() method returns the index of (the position of) the first occurrence of a specified text in a string:

Example:- Image
5.2. lastIndexOf();-

The lastIndexOf() method returns the index of the last occurrence of a specified text in a string:

Example:- Image
5.3. search();-

The search() method searches a string for a specified value and returns the position of the match:

Example; - Image
The two methods, indexOf() and search(), are equal?
The two methods are NOT equal. These are the differences:

- The search() method cannot take a second start position argument.
- The indexOf() method cannot take powerful search values (regular expressions).
5.4. match():-
The match() method searches a string for a match against a regular expression, and returns the matches, as an Array object.

Example 1:-
NOTE:- Perform a global, case-insensitive search for "ain": Image
5.5. includes():-
The includes() method returns true if a string contains a specified value.

Example;-

5.6. startsWith():-
The startsWith() method returns true if a string begins with a specified value, otherwise false:

Example;- ImageImage
5.7. endsWith()
The endsWith() method returns true if a string ends with a specified value, otherwise false:

Example;- Image
If you enjoyed reading this thread, please do the following:
1. Retweet the first tweet.
2. Follow me and enable notifications: @mujeeb0147.

Thank you for reading all the way through.

• • •

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

Keep Current with Mujeeb Ahmed

Mujeeb Ahmed 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 @hey_mujeebahmed

May 3
I don’t get why people aren’t using AI,It boosts productivity like nothing else.

Here are 8 AI tools to leverage AI and increase productivity

Bookmark now 🔖 Image
1. AiSOAP - #1 AI Medical Scribe with AI SOAP Notes

Try it free today! → 🔗

Trust me, it’s a game-changer. 💥

→ AiSOAP records, transcribes, and generates customized SOAP notes, saving you 95% of your charting time. Sounds too good to be true? It’s not. 🙌Try.aisoap.com
Fellou - The World’s First Agentic Browser

Try AI browser today! 100%Free 👉 aisecret.co/Fellou

Get Early Access → 🔥aisecret.co/Fellou-Invitat…

Fellou takes action — planning, researching, and executing tasks for you.

Say goodbye to passive browsing. Fellou doesn't just show you the web—it actively does tasks for you.

🖥️ Automates your research & workflows
📈 Generates insightful, visual reports
⚡ 3.1× faster than OpenAI DeepResearch
Read 12 tweets
Apr 17
ChatGPT Pro costs $200/month—too expensive!

Access ChatGPT-o1, DeepSeek-R1, Claude, Gemini, Llama, Grok, Midjourney, Ideogram, Flux Perplexity, Runway and Luma all in one place. Enjoy advanced AI models, image/video creation, and web search.

Here's how ↓ Image
Meet GlobalGPT @GlbGPT - Your Ultimate All-In-One AI Platform.

Access ChatGPT 4.1, Midjourney v7, Grok 3, Claude 3.7, DeepSeek, Gemini, Llama 4, Flux, Ideogram, Perplexity, Runway, Luma, and more—all in one platform.

Try it now👉 glbgpt.com
1. Chat with Top AI Models

• ChatGPT 4.1, Grok 3, Claude 3.7
• Llama 4, DeepSeek-R1, Gemini 2.0
• Perplexity, Mistral, MiniMax, Moonshot, QvQ
Read 9 tweets
Apr 17
I don’t get why people aren’t using AI, It boosts productivity like nothing else.

Here are 8 AI tools to leverage AI and increase productivity

Bookmark now🔖 Image
1. Introducing Intellectia - The Leading AI Investment Platform, Where AI Aligns with Your Ambitions!

DayTrading Center, which is its standout feature, Your Real-Time Edge for Smarter Trades.

→ Unlock daily trading opportunities with real-time event-driven insights & technical signals

→ Simplified, powerful tools for the intraday bottom and top signals—trade like a pro, effortlessly!
2. Mural

→ Mural is a digital workplace that facilitates visual collaboration, brainstorming, and ideation.

→ It's an excellent resource for remote teams trying to emulate the benefits of in-person seminars and meetings.

mural.co/mural-ai
Read 10 tweets
Apr 15
Think you’ve explored all the top AI tools?

Think again🤔

Here are 7 AI websites that will blow your mind↓ Image
1. Oncely - Top 1 Lifetime Deal Marketplace for AI Software

Join for Free 👉

→ A New Way of Buying AI Software, Pay once, Use forever.

→ The smartest way to leverage AI in your business and career before everyone else.

→ 60 days money-back guarantee on all deals.oncely.com/subscribe
2. Startpage

→ A privacy-first search engine that delivers Google results without tracking or storing your personal information.

startpage.com
Read 9 tweets
Apr 12
10 AI websites to finish a day’s work in just 1 hour

[Bookmark This 🔖] Image
1. Flot AI - Anywhere AI Assistant

Download for Free →

→ Flot is the all-in-one AI assistant that helps you write better, read faster, and remember information across any apps and websites.
→ Built-in the latest ChatGPT, Claude, Gemini, etc. Flot.ai
AiSOAP - #1 AI Medical Scribe with AI SOAP Notes

Try it free today! 🔗

Trust me, it’s a game-changer. 💥

→ AiSOAP records, transcribes, and generates customized SOAP notes, saving you 95% of your charting time. Sounds too good to be true? It’s not. 🙌Try.aisoap.com
Read 13 tweets
Apr 9
Google hides the best gems.

Here are 13 underrated AI websites you’ve never heard of—but should be using. Image
1. Alibaba Lens - The AI image search extension for seamless sourcing!

Find Wholesale Prices Instantly & Maximize Your Profit, It's free!

Visit aisecret.co/install-lens to add it to your browser today.

→ Join over 5 million savvy buyers who are using it to save money and increase profits.

• AI-powered Precision: Advanced image + text search delivers fast, accurate sourcing results
• Customizable Options: Discover verified suppliers supporting tailored customization solutions
• Seamless Integration: From product idea to fulfillment, streamline every step—right from your browser
2. AiSOAP - #1 AI Medical Scribe with AI SOAP Notes

AI Is Changing The Way Doctors Work

With AISOAP, doctors can quickly convert patient conversations into detailed SOAP notes in just seconds.

Try now →

This AI tool can reduce doctors' documentation time by an impressive 95%.try.aisoap.com/AIS
Read 15 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!

:(