{"id":64,"date":"2026-05-01T13:33:28","date_gmt":"2026-05-01T13:33:28","guid":{"rendered":"https:\/\/gigz.pk\/javascript\/?post_type=lesson&#038;p=64"},"modified":"2026-05-01T13:34:52","modified_gmt":"2026-05-01T13:34:52","slug":"64","status":"publish","type":"lesson","link":"https:\/\/gigz.pk\/javascript\/?lesson=64","title":{"rendered":"Strings"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">Introduction<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Strings in JavaScript are used to store and work with text. They are one of the most commonly used data types in web development and are essential for handling user input, displaying content, and processing data.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Understanding Strings<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">A string is a sequence of characters enclosed in single quotes, double quotes, or backticks. It can include letters, numbers, symbols, and spaces.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Example<br>let name = &#8220;Ali&#8221;<br>let message = &#8216;Welcome to JavaScript&#8217;<br>let greeting = <code>Hello User<\/code><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Creating Strings<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">You can create strings using different types of quotes. Backticks are especially useful because they allow multi line text and variable embedding.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Example<br>let text = <code>This is a string<\/code><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">String Length<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The length property returns the number of characters in a string.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Example<br>let word = &#8220;JavaScript&#8221;<br>console.log(word.length)<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Common String Methods<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">JavaScript provides built in methods to manipulate strings.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">toUpperCase converts text to uppercase<br>toLowerCase converts text to lowercase<br>trim removes extra spaces<br>slice extracts part of a string<br>replace replaces part of a string<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Example<br>let text = &#8221; hello world &#8220;<br>console.log(text.trim())<br>console.log(text.toUpperCase())<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">String Concatenation<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Strings can be combined using the plus operator or template literals.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Example<br>let firstName = &#8220;Ali&#8221;<br>let lastName = &#8220;Khan&#8221;<br>let fullName = firstName + &#8221; &#8221; + lastName<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Template Literals<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Template literals allow you to embed variables directly into strings using backticks.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Example<br>let name = &#8220;Sara&#8221;<br>let message = <code>Hello ${name}<\/code><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Escape Characters<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Escape characters allow you to include special symbols inside strings.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Example<br>let quote = &#8220;He said &#8220;Hello&#8221;&#8221;<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Common Uses of Strings<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Displaying messages on websites<br>Handling form inputs<br>Storing and processing text data<br>Creating dynamic content<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Conclusion<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Strings are a fundamental part of JavaScript. Learning how to create and manipulate strings helps you build dynamic and user friendly web applications.<\/p>\n\n\n<div class=\"yoast-breadcrumbs\"><span><span><a href=\"https:\/\/gigz.pk\/javascript\">Home<\/a><\/span> \u00bb <span class=\"breadcrumb_last\" aria-current=\"page\">JavaScript Fundamentals (Beginner Level) > Variables and Data Types > Strings<\/span><\/span><\/div>\n\n\n<div class=\"schema-faq wp-block-yoast-faq-block\"><div class=\"schema-faq-section\" id=\"faq-question-1777642150567\"><strong class=\"schema-faq-question\"><\/strong> <p class=\"schema-faq-answer\"><\/p> <\/div> <\/div>\n\n\n\n<div class=\"schema-faq wp-block-yoast-faq-block\"><div class=\"schema-faq-section\" id=\"faq-question-1777642150364\"><strong class=\"schema-faq-question\"><\/strong> <p class=\"schema-faq-answer\"><\/p> <\/div> <\/div>\n","protected":false},"menu_order":0,"template":"","class_list":["post-64","lesson","type-lesson","status-publish","hentry"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.6 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Strings - Learn JavaScript with GIGZ.PK<\/title>\n<meta name=\"description\" content=\"Learn JavaScript strings with examples. Understand string methods, concatenation, and text handling for web development.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/gigz.pk\/javascript\/?lesson=64\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Strings - Learn JavaScript with GIGZ.PK\" \/>\n<meta property=\"og:description\" content=\"Learn JavaScript strings with examples. Understand string methods, concatenation, and text handling for web development.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/gigz.pk\/javascript\/?lesson=64\" \/>\n<meta property=\"og:site_name\" content=\"Learn JavaScript with GIGZ.PK\" \/>\n<meta property=\"article:modified_time\" content=\"2026-05-01T13:34:52+00:00\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":[\"WebPage\",\"FAQPage\"],\"@id\":\"https:\\\/\\\/gigz.pk\\\/javascript\\\/?lesson=64\",\"url\":\"https:\\\/\\\/gigz.pk\\\/javascript\\\/?lesson=64\",\"name\":\"Strings - Learn JavaScript with GIGZ.PK\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/gigz.pk\\\/javascript\\\/#website\"},\"datePublished\":\"2026-05-01T13:33:28+00:00\",\"dateModified\":\"2026-05-01T13:34:52+00:00\",\"description\":\"Learn JavaScript strings with examples. Understand string methods, concatenation, and text handling for web development.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/gigz.pk\\\/javascript\\\/?lesson=64#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/gigz.pk\\\/javascript\\\/?lesson=64\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/gigz.pk\\\/javascript\\\/?lesson=64#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/gigz.pk\\\/javascript\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"JavaScript Fundamentals (Beginner Level) > Variables and Data Types > Strings\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/gigz.pk\\\/javascript\\\/#website\",\"url\":\"https:\\\/\\\/gigz.pk\\\/javascript\\\/\",\"name\":\"Learn JavaScript with GIGZ.PK\",\"description\":\"\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/gigz.pk\\\/javascript\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Strings - Learn JavaScript with GIGZ.PK","description":"Learn JavaScript strings with examples. Understand string methods, concatenation, and text handling for web development.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/gigz.pk\/javascript\/?lesson=64","og_locale":"en_US","og_type":"article","og_title":"Strings - Learn JavaScript with GIGZ.PK","og_description":"Learn JavaScript strings with examples. Understand string methods, concatenation, and text handling for web development.","og_url":"https:\/\/gigz.pk\/javascript\/?lesson=64","og_site_name":"Learn JavaScript with GIGZ.PK","article_modified_time":"2026-05-01T13:34:52+00:00","twitter_card":"summary_large_image","twitter_misc":{"Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":["WebPage","FAQPage"],"@id":"https:\/\/gigz.pk\/javascript\/?lesson=64","url":"https:\/\/gigz.pk\/javascript\/?lesson=64","name":"Strings - Learn JavaScript with GIGZ.PK","isPartOf":{"@id":"https:\/\/gigz.pk\/javascript\/#website"},"datePublished":"2026-05-01T13:33:28+00:00","dateModified":"2026-05-01T13:34:52+00:00","description":"Learn JavaScript strings with examples. Understand string methods, concatenation, and text handling for web development.","breadcrumb":{"@id":"https:\/\/gigz.pk\/javascript\/?lesson=64#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/gigz.pk\/javascript\/?lesson=64"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/gigz.pk\/javascript\/?lesson=64#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/gigz.pk\/javascript"},{"@type":"ListItem","position":2,"name":"JavaScript Fundamentals (Beginner Level) > Variables and Data Types > Strings"}]},{"@type":"WebSite","@id":"https:\/\/gigz.pk\/javascript\/#website","url":"https:\/\/gigz.pk\/javascript\/","name":"Learn JavaScript with GIGZ.PK","description":"","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/gigz.pk\/javascript\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"}]}},"_links":{"self":[{"href":"https:\/\/gigz.pk\/javascript\/index.php?rest_route=\/wp\/v2\/lesson\/64","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/gigz.pk\/javascript\/index.php?rest_route=\/wp\/v2\/lesson"}],"about":[{"href":"https:\/\/gigz.pk\/javascript\/index.php?rest_route=\/wp\/v2\/types\/lesson"}],"wp:attachment":[{"href":"https:\/\/gigz.pk\/javascript\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=64"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}