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

Dec 26
I have surfed the internet for 10 years.

Here are 10 insanely useful websites you probably didn't know existed!

10/10 would bookmark🔖 Image
1. CopyOwl.ai – Publish in-depth, research-backed articles that make you an authority in your niche.

👉 Try for Free → CopyOwl.ai

→ Write high-quality articles
→ Back them with credible sources
→ Post consistently to attract followers

“Work smarter, not harder. CopyOwl handles research and writing—you focus on influence.”
2. QuillBot / @TheQuillBot

→ Get better writing everywhere by bringing QuillBot to all your favourite websites.

quillbot.com
Read 12 tweets
Nov 25
Google Chrome has over 188,620 extensions.

However, these 10 will save you hundreds of hours!

Bookmark now 🔖 Image
1. Jam / @jamdotdev

It is a free browser extension that allows you to create the perfect bug report in just one click.

🔗 jam.dev
2. Grammarly / @Grammarly

Enhance your writing skills by instantly checking grammar, spelling, and style across emails, documents, and social media, ensuring clear and professional communication.
Read 12 tweets
Oct 30
I’m shocked that many people don’t use AI to create anything.

Here is a list of 10 AI tools that can create anything for you in mins. Image
1. Scribehow / @ScribeHow

→ With Scribe, you can quickly turn any process into a step-by-step guide.

→ This AI tool generates user-friendly guides, tutorials, SOPs, and walkthroughs in just minutes!

🔗 scribe.how/7q8t2s
2. Gamma/ @MeetGamma

→ Create stunning presentations and websites—no design or coding skills required!

Try Gamma for free: gamma.app
Read 12 tweets
Oct 21
12 remote jobs paying $80/hr, No Resume No Experience required Image
1. Gaggle:

→ Gaggle hires content reviewers to monitor online student activities and promote kid safety.

→ Pay ranges from $20 to $25 per hour.

→ Work include identifying potential challenges in K-12 student communications. Flexible scheduling with a minimum of 10 hours each week. Basic technological knowledge and an interest in kid safety are necessary.
2. Preply:

→ Preply is an online tutoring company that provides possibilities in more than 100 courses.

→ Set your own rates, with potential revenues of more than $40 per hour.

→ There is no need for specific qualification; simply be knowledgeable about your field. Create your profile, set your schedule, and begin tutoring in as few as 5 days.
Read 14 tweets
Oct 18
SMARTPHONES WITHOUT AI ARE NO LONGER SMART.

HERE ARE 10 AI APPS YOU NEED TO HAVE ON YOUR MOBILE Image
1. Otter / @otter_ai

→ OtterPilot™ enables AI-powered meetings. Get a meeting assistant that can record audio, take notes, automatically collect slides, and provide summaries.
2. Quizlet / @quizlet

→ This app can greatly assist you during exam revision. → This software can help you with test revision. It provides more than 30 million sets made by instructors and students worldwide.
Read 12 tweets
Oct 8
12 remote jobs paying $80/hr, No Resume No Experience required Image
1. Free Cash:

→ Free Cash offers flexible opportunities for earning extra income by completing simple tasks online.

→ Earnings can range from $10 to $30 per hour, depending on the tasks completed.

→ No prior experience is necessary, but users must create an account and verify their identity. This platform is ideal for individuals looking to earn money on their own schedule while engaging in straightforward activities.
2. Remotive

→ Remotive connects you to a wide range of remote job opportunities across various industries.

→ Earnings vary depending on the job role and company, but many positions offer competitive salaries.

→ No specific experience is required to browse, but most job listings will have their own qualifications. Perfect for individuals seeking remote work flexibility and access to global companies hiring for remote roles.
Read 14 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!

:(