Skip to content
geeksforgeeks
  • Tutorials
    • Python
    • Java
    • Data Structures & Algorithms
    • ML & Data Science
    • Interview Corner
    • Programming Languages
    • Web Development
    • CS Subjects
    • DevOps And Linux
    • School Learning
    • Practice Coding Problems
  • Courses
    • DSA to Development
    • Get IBM Certification
    • Newly Launched!
      • Master Django Framework
      • Become AWS Certified
    • For Working Professionals
      • Interview 101: DSA & System Design
      • Data Science Training Program
      • JAVA Backend Development (Live)
      • DevOps Engineering (LIVE)
      • Data Structures & Algorithms in Python
    • For Students
      • Placement Preparation Course
      • Data Science (Live)
      • Data Structure & Algorithm-Self Paced (C++/JAVA)
      • Master Competitive Programming (Live)
      • Full Stack Development with React & Node JS (Live)
    • Full Stack Development
    • Data Science Program
    • All Courses
  • JS Tutorial
  • JS Exercise
  • JS Interview Questions
  • JS Array
  • JS String
  • JS Object
  • JS Operator
  • JS Date
  • JS Error
  • JS Projects
  • JS Set
  • JS Map
  • JS RegExp
  • JS Math
  • JS Number
  • JS Boolean
  • JS Examples
  • JS Free JS Course
  • JS A to Z Guide
  • JS Formatter
Open In App

JavaScript String Exercise

Last Updated : 07 Apr, 2025
Comments
Improve
Suggest changes
Like Article
Like
Report

JavaScript string is a primitive data type and is used for storing and manipulating a sequence of characters. It can contain zero or more characters within single or double quotes. This article contains a wide collection of JavaScript Programming examples based on String.

JavaScript
let s = "GeeksforGeeks" console.log(s); console.log(typeof s); 

Output

GeeksforGeeks
string

Easy Questions

The Easy level includes articles that cover fundamental operations and straightforward tasks with JavaScript arrays.

  • Length of JS String
  • Reverse a string in JS
  • Remove a character from a string in JS
  • Delete the first character from JS String
  • Remove Text from a String in JS
  • Iterate Over String Characters in JS
  • Sort a string in JS
  • Check if String Has Only Alphabets in JS
  • Capitalize the First Letter in JS
  • Convert Comma-Separated String to Array in JS
  • Get Last Character in JS String
  • String strip in JavaScript
  • Replace Multiple Spaces with Single Space in JS
  • Number to String Conversion in JS
  • Add characters to a string in JS
  • Count String Occurrences in JS
  • Find Index of Character in JS
  • JavaScript string formatting
  • Byte Array to String Conversion in JS
  • Count Each Character’s Occurrence in JS
  • Insert String at Specific Index in JS
  • Remove All Line Breaks from String in JS
  • Get Last N Characters in JS
  • Check String Equality in JS
  • Substring check in JavaScript
  • Count Words in String using JS
  • String to array conversion in JavaScript
  • Vowel Count in JS String
  • Case-Insensitive Comparison in JS
  • String to Boolean Conversion in JS
  • Get First Word in JS String
  • Get First and Last Character in JS
  • Check for Whitespace in JS
  • Character Array from String in JS
  • Replace Multiple Characters in JS
  • Replace Forward Slash Globally in JS String
  • Modify Textarea Content in JS
  • Alphabetically Sort String in JS
  • Find Unique Characters in String using JS
  • Strip Non-Numeric Characters in JS
  • Count Each Letter in String in JS
  • Sort Array of Strings in JS
  • Check if String Starts With Another in JS
  • Vowel or Consonant Check in JS
  • Get First Three Characters of string in JS
  • Slice vs Substring in JS
  • Single vs Double Quotes in JS
  • Check Repeated Characters in String using JS
  • Float to String Conversion in JS
  • Keep First N Characters in String in JS
  • Split string into array of words in JS
  • Check for Digit in String in JS
  • Check character is vowel or not in JS
  • Remove Last Character from string using JS
  • Substr vs Substring in JS
  • Compare Two Strings in JS
  • Count Character Occurrence in JS
  • Multiline String to Array Conversion in JS
  • Compare Two Strings in JS
  • Get Nth Occurrence of Character of String in JS
  • Swap Characters in String using JS
  • Find smallest and largest word in a string using JS
  • Concatenate Strings in JS
  • Char to String Conversion in JS
  • Check if Character is Digit using JS
  • Generate String of Specific Length in JS
  • Add Prefix and Suffix to String in JS
  • Access Characters in String using JS
  • Convert String to Roman Numerals in JS
  • Case-Insensitive Alphabetical Sort in JS
  • Count Alphabets in String using JS
  • First Occurrence of Substring in JS
  • Check String Start Pattern in JS
  • Pad String to Specified Length using JS
  • Reverse a string in place using JS
  • Get string length Property in JS
  • Count Alphabets in JS
  • Float to String Conversion in JS

Medium Questions

The Medium level includes articles that delve deeper into working with JavaScript strings, exploring more advanced operations and methods

  • Hash a String in JS
  • Extract number from a string in JS
  • Validate JSON String in JS
  • Convert Image to Base64 in JS
  • String to Date Conversion in JS
  • JS RegExp(Regular Expression)
  • Remove Non-Alphanumeric Characters using JS
  • Remove Non-ASCII Characters using JS
  • Title Case Conversion in JS
  • Convert Object to String in JS
  • Create String with Multiple Spaces in JS
  • Palindrome Check in JS
  • Replace Multiple Strings in JS
  • Remove Punctuation from String in JS
  • Convert User Input to RegExp in JS
  • Remove occurrences of character in a string using JS
  • URLify String (Spaces to %20) using JS
  • Count number of alphabets using JS
  • Replace Dots in JS String
  • Count Specific Character Occurrence in JS
  • Use Quotes in String in JS
  • Truncate String with Ellipsis in JS
  • Extract Emails from String using JS
  • Extract URLs from String in JS
  • String to Binary Conversion in JS
  • Character Order Pattern Check in JS
  • Check if String is Pangram using JS
  • Replace Words with RegEx in JS
  • Most Frequent Word in String using JS
  • Add Two Binary Strings in JS
  • Find index of Last Occurrence of Substring using JS
  • Capitalize First letter of Each Sentence in JS
  • Permutation Check for Strings using JS
  • Truncate string to a certain length using JS
  • Toggle Character Case in String using JS
  • Print Alphabetical Character Frequency using JS
  • Remove consecutive duplicate characters using JS
  • Recursive Palindrome Check in JS
  • Anagram Check for Strings using JS
  • Match Character with Options in JS
  • Check Isomorphic Strings using JS
  • Print all subsequences of a string using JS
  • Find second most repeated word using JS
  • Mask Characters Except Last using JS
  • Check if String is Made of Repeating Substring in JS
  • Extract strings with a digit using JS
  • Find kth non-repeating character using JS
  • Find Strings Matching Pattern in Dictionary using JS
  • Find Second Most Repeated Word in Sequence using JS
  • Check Equal Character Frequency using JS
  • Check if String Can Split into Four Distinct Parts using JS
  • Count distinct subsequences using JS
  • Count Equal Pairs in String using JS
  • Add Multiple Binary Strings using JS
  • Count Distinct Occurrences as Subsequence in JS
  • Count Flips for Alternate Binary string using JS
  • Check Single Flip for Same Bits using JS
  • Min Flips for Uniform Characters using JS
  • Perfect reversible string in JS
  • Count Alphabet Characters using JS
  • Float to String Conversion using JS
  • String to Binary Conversion using JS

Hard Questions

The Hard level includes articles that cover more intricate and less common tasks

  • Find lexicographically next string using JS
  • Print All Permutations of String in JS
  • Divide Large Number in String Form using JS
  • Longest Common Subsequence in JS
  • Word Search in 2D Grid using JS
  • Decode Encoded String Recursively using JS
  • Check for Palindromic Rotation using JS
  • Find kth non-repeating character using JS
  • Generate Strings with Spaces using JS
  • Find lexicographically next string using JS
  • Generate binary strings from given pattern using JS
  • Count strings with consecutive 1s in JS
  • Find binary representation of next number using JS
  • Reverse Only Consonants without affecting other character in JS
  • Minimum Manipulations to make two string Anagram using JS
  • Find ith index character in a binary string iteration using JS
  • Add minimum characters at front to make string palindrome in JS
  • JavaScript print shortest path to print a string on screen
  • Longest Balanced Subsequence Length using JS
  • Valid IP Address Format Check using JS
  • Convert user input string into regular expression using JS
  • Extract email addresses from a string using JS
  • Mirror Characters in String using JS
  • Find index of first occurrence of a substring using JS
  • Truncate a string to a certain length using JS
  • Print all permutations of given string using JS
  • Print all strings that can be made by placing spaces using JS
  • Print all subsequences of a string in JS
  • Print frequency of each character in alphabetical order using JS
  • Recursive Palindrome Check using JS
  • Longest Balanced Subsequence Length using JS
  • Recursive String Decode (Count-Substring) using JS
  • Find index of last occurrence of a substring using JS
  • Find kth non-repeating character using JS

We have a complete list of Javascript String functions, to check those please go through this JavaScript String Complete Reference article.

We have created an article of JavaScript Examples, and added list of questions based on Array, Object, Function, ..., etc. Please visit this JavaScript Examples to get complete questions based articles list of JavaScript.

We have created a complete JavaScript Tutorial to help both beginners and experienced professionals. Please check this JavaScript Tutorial to get the complete content from basic syntax and data types to advanced topics such as object-oriented programming and DOM manipulation.

Recent articles on JavaScript


V

vishalkumar2204
Improve
Article Tags :
  • JavaScript
  • Web Technologies
  • javascript-string

Similar Reads

    JavaScript Programs
    JavaScript Programs contains a list of articles based on programming. This article contains a wide collection of programming articles based on Numbers, Maths, Arrays, Strings, etc., that are mostly asked in interviews.Table of ContentJavaScript Basic ProgramsJavaScript Number ProgramsJavaScript Math
    13 min read
    JavaScript Array Examples
    JavaScript array is used to store multiple elements in a single variable. JavaScriptlet a = ["HTML", "CSS", "JS"] console.log(a)Output[ 'HTML', 'CSS', 'JS' ] Using New KeywordJavaScript// Declaring an array using Array Constructor let a = new Array(3) a[0] = "HTML" a[1] = "CSS" a[2] = "JS" console.l
    3 min read
    Javascript Map Programming Examples
    A Javascript map is a collection of elements where each element is stored as a Key, value pair. Map objects can hold both objects and primitive values as either key or value. When we iterate over the map object it returns the key, and value pair in the same order as inserted.Javascript Map Programmi
    3 min read
    JavaScript Math Programming Examples
    The JavaScript Math Object is used to perform mathematical operations on numbers. The Math object does not have a constructor. All properties and methods of Math are fixed/static. All properties and methods of Math are static and can be called by using Math as an object.JavaScript Math Programming E
    2 min read
    JavaScript Number Programming Examples
    Javascript Numbers are primitive data types. Unlike other programming languages, Both integers and floating-point values are represented by JavaScript's number type. The IEEE-754 format is the one that is technically used by the JavaScript number type. Here, you don’t need int, float, etc, to declar
    3 min read
    JavaScript Object Programming Examples
    JavaScript Object is the collection of properties and the property is in key, value pair format. These objects are quite different from JavaScript’s primitive data types (Number, String, Boolean, null, undefined, and symbol) in the sense that these primitive data types all store a single value each
    6 min read
    JavaScript Set Programming Examples
    In JavaScript, the Set is a built-in collection that allows you to store unique values of any type, Set can store any type of value whether primitive or objects. It provides methods for adding, removing, and querying elements in an efficient way.JavaScriptlet s = new Set(["a", "b", "c"]); console.lo
    1 min read
    JavaScript String Exercise
    JavaScript string is a primitive data type and is used for storing and manipulating a sequence of characters. It can contain zero or more characters within single or double quotes. This article contains a wide collection of JavaScript Programming examples based on String. JavaScriptlet s = "Geeksfor
    7 min read
geeksforgeeks-footer-logo
Corporate & Communications Address:
A-143, 7th Floor, Sovereign Corporate Tower, Sector- 136, Noida, Uttar Pradesh (201305)
Registered Address:
K 061, Tower K, Gulshan Vivante Apartment, Sector 137, Noida, Gautam Buddh Nagar, Uttar Pradesh, 201305
GFG App on Play Store GFG App on App Store
Advertise with us
  • Company
  • About Us
  • Legal
  • Privacy Policy
  • In Media
  • Contact Us
  • Advertise with us
  • GFG Corporate Solution
  • Placement Training Program
  • Languages
  • Python
  • Java
  • C++
  • PHP
  • GoLang
  • SQL
  • R Language
  • Android Tutorial
  • Tutorials Archive
  • DSA
  • Data Structures
  • Algorithms
  • DSA for Beginners
  • Basic DSA Problems
  • DSA Roadmap
  • Top 100 DSA Interview Problems
  • DSA Roadmap by Sandeep Jain
  • All Cheat Sheets
  • Data Science & ML
  • Data Science With Python
  • Data Science For Beginner
  • Machine Learning
  • ML Maths
  • Data Visualisation
  • Pandas
  • NumPy
  • NLP
  • Deep Learning
  • Web Technologies
  • HTML
  • CSS
  • JavaScript
  • TypeScript
  • ReactJS
  • NextJS
  • Bootstrap
  • Web Design
  • Python Tutorial
  • Python Programming Examples
  • Python Projects
  • Python Tkinter
  • Python Web Scraping
  • OpenCV Tutorial
  • Python Interview Question
  • Django
  • Computer Science
  • Operating Systems
  • Computer Network
  • Database Management System
  • Software Engineering
  • Digital Logic Design
  • Engineering Maths
  • Software Development
  • Software Testing
  • DevOps
  • Git
  • Linux
  • AWS
  • Docker
  • Kubernetes
  • Azure
  • GCP
  • DevOps Roadmap
  • System Design
  • High Level Design
  • Low Level Design
  • UML Diagrams
  • Interview Guide
  • Design Patterns
  • OOAD
  • System Design Bootcamp
  • Interview Questions
  • Inteview Preparation
  • Competitive Programming
  • Top DS or Algo for CP
  • Company-Wise Recruitment Process
  • Company-Wise Preparation
  • Aptitude Preparation
  • Puzzles
  • School Subjects
  • Mathematics
  • Physics
  • Chemistry
  • Biology
  • Social Science
  • English Grammar
  • Commerce
  • World GK
  • GeeksforGeeks Videos
  • DSA
  • Python
  • Java
  • C++
  • Web Development
  • Data Science
  • CS Subjects
@GeeksforGeeks, Sanchhaya Education Private Limited, All rights reserved
We use cookies to ensure you have the best browsing experience on our website. By using our site, you acknowledge that you have read and understood our Cookie Policy & Privacy Policy
Lightbox
Improvement
Suggest Changes
Help us improve. Share your suggestions to enhance the article. Contribute your expertise and make a difference in the GeeksforGeeks portal.
geeksforgeeks-suggest-icon
Create Improvement
Enhance the article with your expertise. Contribute to the GeeksforGeeks community and help create better learning resources for all.
geeksforgeeks-improvement-icon
Suggest Changes
min 4 words, max Words Limit:1000

Thank You!

Your suggestions are valuable to us.

What kind of Experience do you want to share?

Interview Experiences
Admission Experiences
Career Journeys
Work Experiences
Campus Experiences
Competitive Exam Experiences