<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Panagiotis Thomaidis on Medium]]></title>
        <description><![CDATA[Stories by Panagiotis Thomaidis on Medium]]></description>
        <link>https://medium.com/@pthomaid?source=rss-2ac85447be46------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*b69TLqbQsMga2zFDq_HzSw.jpeg</url>
            <title>Stories by Panagiotis Thomaidis on Medium</title>
            <link>https://medium.com/@pthomaid?source=rss-2ac85447be46------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 28 Nov 2026 23:50:24 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@pthomaid/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Quick refresher on JavaScript strings]]></title>
            <link>https://medium.com/@pthomaid/quick-refresher-of-string-types-in-javascript-52469c7a16a4?source=rss-2ac85447be46------2</link>
            <guid isPermaLink="false">https://medium.com/p/52469c7a16a4</guid>
            <category><![CDATA[javascript-development]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[strings-in-javascript]]></category>
            <dc:creator><![CDATA[Panagiotis Thomaidis]]></dc:creator>
            <pubDate>Sat, 23 Nov 2024 16:14:34 GMT</pubDate>
            <atom:updated>2024-11-23T16:35:48.873Z</atom:updated>
            <content:encoded><![CDATA[<p>Strings are one of the most fundamental data types in JavaScript, used to represent text. Mastering how to work with strings effectively is crucial for any web developer. In this article, I made a quick list of the various types of strings and the most common operations on them.</p><p><strong>1. String Literals</strong><br>String literals are the most common way to define strings in JavaScript. They can be enclosed in single quotes (‘), double quotes (“), or backticks (`).</p><p><strong>Single Quotes</strong></p><pre>const singleQuoteString = &#39;Hello, world!&#39;</pre><p><strong>Double Quotes</strong></p><pre>const doubleQuoteString = &quot;Hello, world!&quot;</pre><p><strong>Template Literal</strong>s Template literals, enclosed in backticks, allow for multi-line strings and embedded expressions using <strong>${}</strong>.</p><pre>const name = &#39;Alice&#39;<br>const templateLiteralString = `Hello, ${name}! Welcome to JavaScript.`</pre><p><strong>2. String Objects</strong><br>Strings can also be created using the <strong>String constructor</strong>.</p><pre>const stringObject = new String(&#39;Hello, world!&#39;)</pre><p><strong>3. Escape Sequences</strong><br>JavaScript strings support special characters through escape sequences, which are prefixed with a backslash (\).</p><p><strong>Common Escape Sequences:</strong></p><pre>const newLineString = &#39;First line\nSecond line&#39;<br>const tabString = &#39;Column1\tColumn2&#39;<br>const quoteString = &#39;She said, &quot;Hello!&quot;&#39;</pre><p><strong>4. String Methods</strong><br>A few essential string manipulation operations are the following:</p><p><strong>length:</strong> Returns the length of the string.</p><pre>const str = &#39;Hello&#39;<br>console.log(str.length) // Output: 5</pre><p><strong>includes():</strong> Checks if the string contains a specified substring.</p><pre>const containsHello = str.includes(&#39;Hell&#39;)<br>console.log(containsHello) // Output: true</pre><p><strong>trim():</strong> Removes whitespace from both ends of the string.</p><pre>const spacedStr = &#39; Hello &#39;<br>console.log(spacedStr.trim()) // Output: &#39;Hello&#39;</pre><p><strong>5. Multiline Strings</strong><br>Template literals make it easy to create multi-line strings.</p><pre>const multiLineString = `This is a<br>multi-line string<br>using template literals.`</pre><p><strong>Conclusion</strong><br>Understanding the various types of strings and how to manipulate them in JavaScript is a foundational skill for web developers. Whether you’re working with simple string literals or utilizing more complex methods, mastering strings will enhance your ability to handle text in your applications efficiently.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TlZPdMGwSYUBLFqRu13g7Q.jpeg" /><figcaption><strong>Image by vectorjuice on Freepik</strong></figcaption></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=52469c7a16a4" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>