<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Gulcan COSKUN</title>
    <description>The latest articles on DEV Community by Gulcan COSKUN (@gulcanc).</description>
    <link>https://dev.to/gulcanc</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F827284%2Fda9ee385-b89d-484c-82ea-48e309302408.jpg</url>
      <title>DEV Community: Gulcan COSKUN</title>
      <link>https://dev.to/gulcanc</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/gulcanc"/>
    <language>en</language>
    <item>
      <title>🔄 RECURSION IN JAVASCRIPT</title>
      <dc:creator>Gulcan COSKUN</dc:creator>
      <pubDate>Tue, 10 Jan 2023 11:53:55 +0000</pubDate>
      <link>https://dev.to/gulcanc/recursion-in-javascript-2ch4</link>
      <guid>https://dev.to/gulcanc/recursion-in-javascript-2ch4</guid>
      <description>&lt;p&gt;In this tutorial, we will learn the concept of recursion with two examples. In the first example, we will sum the numbers until the given one and in the second example, we will check if our string is a palindrome.&lt;/p&gt;

&lt;h2&gt;
  
  
  1. What is Recursion?
&lt;/h2&gt;

&lt;p&gt;Recursion is an effective technique for solving complex problems in Computer Science. &lt;/p&gt;

&lt;p&gt;Recursion invokes what we define. In an iterative function definition in the function body, we call the function we defined, that is, there is a recursion loop [1]. &lt;/p&gt;

&lt;p&gt;We can generate many recursive calls as needed. However, we must provide a certain state to end this iteration process. We can say that the function calls itself each time with a simpler version of the original problem [2].&lt;/p&gt;

&lt;h2&gt;
  
  
  2. Examples of recursive functions
&lt;/h2&gt;

&lt;p&gt;When we try to solve recursive problems, we often use a two-step process. The first step is to determine the base case, and the second is to determine the recursive case.&lt;/p&gt;

&lt;p&gt;We can solve the base case directly, which means we don't need to call the function or do anything else. The recursive case, however, can be solved by taking part of the problem and then recursively solving a sub-problem that is quite similar to the original problem.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2.1 Sum all numbers until the given one&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;In the first example, we will sum the numbers until the given one. In the figure below (Figure 2.1), we can see that the function S( ) itself is called inside the function, so this phenomenon is called "recursion", and the function which contains recursion is named a "recursive function".&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--G462Iqao--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/x2x7mpul4qboa59as64j.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--G462Iqao--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/x2x7mpul4qboa59as64j.png" alt="Image description" width="800" height="210"&gt;&lt;/a&gt;&lt;em&gt;Figure 2.1 Mathematical approach&lt;/em&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;function SumupTo(n) {
  if (n === 1) {
    //base case
    return 1;
  } else {
    // recursive case
    return n + SumupTo(n - 1);
  }
}

document.write(SumupTo(2));  // output = 3
document.write(SumupTo(3));  // output = 6
document.write(SumupTo(5));  // output = 15
document.write(SumupTo(10)); //output = 55

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;2.2 Check whether the string is palindrome or not&lt;/strong&gt;&lt;br&gt;
In the second example, we will learn to write a recursive function to check if a string is a palindrome. &lt;/p&gt;

&lt;p&gt;What is the string palindrome? This means that the original string and its inverse are equal (i.e., madam, dad, …). &lt;/p&gt;

&lt;p&gt;Firstly, we will determine the base case.  We can easily say that if the length of the string is only one, it must be a palindrome. If the length is zero, it also must be a palindrome. So, if the string length is less than 2, we will return true.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;function isPalindrom(string) {
  if (string.length &amp;lt; 2) {
    // base case
    return true;
  }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We are now in the recursive case, so we will check if the first and last letters are the same. We will use another if … else statement inside the else statement. If the first and last letters are not equal, we will return false.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;function isPalindrom(string) {
  if (string.length &amp;lt; 2) {
    // base case
    return true;
  } else {
    // recursive case
    if (string[0] !== string[string.length - 1]) {
      return false;
    }
  }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Otherwise, if the first and last letters are equal, we will call the function again. We have already checked the first and last letters, so we do not need to check them again. We can remove these letters using the slice() method. &lt;/p&gt;

&lt;p&gt;The slice() method extracts a part of a string and returns the extracted one. For easy understanding, we can give a simple example of the slice() method. As we can see in the example below, we have removed the first and last letters.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;let myStr = "Hello";
console.log(myStr.slice(1, -1)); // output = ell
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now we can get back to our recursive function. Our code will be like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;function isPalindrom(string) {
  if (string.length &amp;lt; 2) {
    // base case
    return true;
  } else {
    // recursive case
    if (string[0] !== string[string.length - 1]) {
      return false;
    } else {
      return isPalindrom(string.slice(1, -1));
    }
  }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Finally, our code is ready to check whether our strings are palindrome or not.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;function isPalindrom(string) {
  if (string.length &amp;lt; 2) {
    // base case
    return true;
  } else {
    // recursive case
    if (string[0] !== string[string.length - 1]) {
      return false;
    } else {
      return isPalindrom(string.slice(1, -1));
    }
  }
}

document.write(isPalindrom("dad")); // output: true
document.write(isPalindrom("gulcan")); // output: false
document.write(isPalindrom("madam")); // output: true
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  3. Conclusion
&lt;/h2&gt;

&lt;p&gt;In this tutorial, we first learned what recursion and recursive functions are. Then we tried to add the numbers until the given one by using the recursive function. We also checked if our strings are palindrome using recursion concept.&lt;/p&gt;

&lt;p&gt;These are simple algorithms to understand the concept of recursion, we can solve other algorithms using recursive functions.&lt;/p&gt;

&lt;p&gt;👋🏼 Happy learning … &lt;/p&gt;

&lt;p&gt;You can reach out to me through &lt;a href="https://www.linkedin.com/in/gulcan-coskun/"&gt;LinkedIn&lt;/a&gt; and &lt;a href="https://www.linkedin.com/in/gulcan-coskun/"&gt;Medium&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  4. References
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://www.coursera.org/videos/principles-of-computing-2/ccrwD"&gt; Course from Coursera "Principles of Computing"&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://www.geeksforgeeks.org/introduction-to-recursion-data-structure-and-algorithm-tutorials/"&gt;Geeks for geeks&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>recursive</category>
      <category>recursion</category>
      <category>javascript</category>
      <category>algorithms</category>
    </item>
    <item>
      <title>🔐 ROT13 DECRYPTION ALGORITHM IN JAVASCRIPT</title>
      <dc:creator>Gulcan COSKUN</dc:creator>
      <pubDate>Wed, 28 Dec 2022 21:16:23 +0000</pubDate>
      <link>https://dev.to/gulcanc/rot13-decryption-algorithm-in-javascript-2c59</link>
      <guid>https://dev.to/gulcanc/rot13-decryption-algorithm-in-javascript-2c59</guid>
      <description>&lt;p&gt;In this tutorial, we will break the ROT13 encryption algorithm and convert it to text.&lt;/p&gt;

&lt;h2&gt;
  
  
  1. What is encryption?
&lt;/h2&gt;

&lt;p&gt;Encryption is used to translate information into a special code to hide its real meaning [1].&lt;/p&gt;

&lt;h2&gt;
  
  
  2. What is decryption?
&lt;/h2&gt;

&lt;p&gt;The decryption process is used to decode a hidden message, which is carried out by the message receiver [1].&lt;/p&gt;

&lt;h2&gt;
  
  
  3. ROT13 Cipher (Rotate By 13 Places)
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F392boawiywim9cuale5l.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F392boawiywim9cuale5l.png" alt="Image description"&gt;&lt;/a&gt;&lt;em&gt;Figure 3.1 ROT13 cipher&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;One of the common encryption methods is the ROT13 cipher, which is a simple monoalphabetic cipher with a private key in which letters of the alphabet are shifted by 13 digits [2]. In other words, M becomes Z, A becomes N, etc. &lt;/p&gt;

&lt;p&gt;There are 26 letters in the basic Latin alphabet, so we can say that ROT13 is its own reverse. Therefore, the same process can be used for encoding and decoding [3].&lt;/p&gt;

&lt;h2&gt;
  
  
  4. Algorithme
&lt;/h2&gt;

&lt;h3&gt;
  
  
  4.1 First step
&lt;/h3&gt;

&lt;p&gt;Assume that we have a sentence "TBBQ ZBEAVAT". In this sentence, each letter corresponds to a character code. In the first step, we will convert the letters into character codes.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;4.1.1 JavaScript Spring split() Method&lt;/strong&gt;&lt;br&gt;
First of all, we will write a function in which we will create a new variable called "newString" and we will turn it into an array. In this step, we will use the JavaScript string split() method, which is used to split the given string into an array of strings by separating it into substrings [5]. We can see the result in the console (Figure 4.1) as follows:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

function transformToROTI13(stringToTransform) {
  // ⭐️ 1) Create a new variable and convert it to an array

  const newString = stringToTransform.split("");

  return newString;
}

console.log(transformToROTI13("TBBQ ZBEAVAT"));


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fm3tydeclbldf5vuuopg7.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fm3tydeclbldf5vuuopg7.png" alt="Image description"&gt;&lt;/a&gt;&lt;em&gt;Figure 4.1 The result of the split() method&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;4.1.2 JavaScript String charCodeAt() method&lt;/strong&gt;&lt;br&gt;
This method returns a UTF-16 value (a 16-bit integer between 0 and 65535) which is the Unicode value for a character at a specific position in a string [6]. The place must be between 0 and string.length-1. If the position is out of the range, the charCodeAt() method will return a particular, not-a-number value printed as NaN. We can see the result in the console.&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

let str = "TBBQ ZBEAVAT";

console.log(str.length); // ⭐️ output 12
console.log(str.charCodeAt(0)); // ⭐️ output 84
console.log(str.charCodeAt(1)); // ⭐️ output 66
console.log(str.charCodeAt(13)); // ⭐️ output NaN


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;4.1.3 JavaScript Array map() Method&lt;/strong&gt;&lt;br&gt;
The map() method is used to iterate over an array and use a callback function to modify its elements. Then the callback function is executed on each of the elements of the array [7]. Thus, our code will look like the following:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

function transformToROTI13(stringToTransform) {
  // ⭐️ 1) Create a new variable and convert it to an array

  const newString = stringToTransform.split("").map((character) =&amp;gt; {
    const code = character.charCodeAt(character);
    console.log(code);
  });

  return newString;
}

transformToROTI13("TBBQ ZBEAVAT");


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fc5dyikb6tqw9cbqa4by0.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fc5dyikb6tqw9cbqa4by0.png" alt="Image description"&gt;&lt;/a&gt;&lt;em&gt;Figure 4.2 Output of the code in the console&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;4.1.4 ASCII Table&lt;/strong&gt;&lt;br&gt;
ASCII, The American Standard Code for Information Interchange is a character encoding standard for text files in computers and other devices. Each symbol in the character set can be represented by a decimal value [8]. In this example, we will use uppercase letters, so the ASCII value of uppercase letters A to Z is between 65 and 90.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fuzgmu811laho2zqajv9k.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fuzgmu811laho2zqajv9k.png" alt="Image description"&gt;&lt;/a&gt;&lt;em&gt;Figure 4.3 ASCII Alphabet Characters&lt;/em&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  4.2 Second step
&lt;/h3&gt;

&lt;p&gt;First of all, we need to make sure that our character code is between 65 and  90. The value in the middle of my list is 78 and that corresponds to the letter N. If the character code is less than 78, we will move forward by 13 characters. If the character code is greater than 78, we will move backward by 13 characters.&lt;/p&gt;

&lt;p&gt;For example:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

Character code of B is 66, it is less than 78, so we add 13 
result: 66 + 13 = 79

Check it in the Figure 4.3. We can see that 79 corresponds to letter O. 
So we can verify it using the Figure 3.1 which shows that B corresponds to O. 


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;4.2.1 JavaScript String.fromCharCode() Method&lt;/strong&gt;&lt;br&gt;
Previously we got integers between 65 and 90 for each letter using the charCodeAt() method. Now we will use the String.fromCharCode() method to return the string constructed from the specified array of UTF-16 code units.&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

function transformToROTI13(stringToTransform) {
  // ⭐️ 1) Create a new variable and convert it to an array

  const newString = stringToTransform.split("").map((character) =&amp;gt; {
    const code = character.charCodeAt(character);
    console.log(code);

    // ⭐️ 2) Check the character code is between 65 and 90
    // Return an unconverted character if it is out of range
    if (code &amp;lt; 65 || code &amp;gt; 90) {
      return String.fromCharCode(code);
      // ⭐️ 3) If the character code is less than 78, move forward 13 characters
    } else if (code &amp;lt; 78) {
      return String.fromCharCode(code + 13);
    }
    // ⭐️ 4) If the character code is less than 78, come back 13 characters
    else {
      return String.fromCharCode(code - 13);
    }
  });

  return newString;
}
transformToROTI13("TBBQ ZBEAVAT");


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F1s26o7baryxue1lunt8d.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F1s26o7baryxue1lunt8d.png" alt="Image description"&gt;&lt;/a&gt;&lt;em&gt;Figure 4.4 The result of the letters in the console&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;4.2.2 JavaScript Array join() method&lt;/strong&gt;&lt;br&gt;
In the final step, we will use the join() method to create and return a new string by concatenating all of the elements in the array. &lt;/p&gt;

&lt;p&gt;Here is our final code, which is easily understandable and readable:&lt;/p&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

&lt;p&gt;function transformToROTI13(stringToTransform) {&lt;br&gt;
  return stringToTransform&lt;br&gt;
    .split("")&lt;br&gt;
    .map((character) =&amp;gt; {&lt;br&gt;
      const code = character.charCodeAt(character);&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;  if (code &amp;amp;lt; 65 || code &amp;amp;gt; 90) {
    return String.fromCharCode(code);
  } else if (code &amp;amp;lt; 78) {
    return String.fromCharCode(code + 13);
  } else {
    return String.fromCharCode(code - 13);
  }
})
.join("");
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;p&gt;}&lt;/p&gt;

&lt;p&gt;console.log(transformToROTI13("TBBQ ZBEAVAT")); // GOOD MORNING&lt;br&gt;
console.log(transformToROTI13("THYPNA PBFXHA")); // GULCAN COSKUN&lt;/p&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;h2&gt;
&lt;br&gt;
  &lt;br&gt;
  

&lt;ol&gt;
&lt;li&gt;Conclusion
&lt;/li&gt;
&lt;/ol&gt;
&lt;/h2&gt;


&lt;p&gt;In this tutorial, we learned not only how to apply the ROT13 Algorithm but also how to apply some basic JavaScript methods like map(), split(), join(), String.fromCharCode(), and charCodeAt() for decrypting ROT13 Algorithm.&lt;/p&gt;

&lt;p&gt;Happy learning …&lt;/p&gt;

&lt;p&gt;You can reach out to me through &lt;a href="https://www.linkedin.com/in/gulcan-coskun/" rel="noopener noreferrer"&gt;LinkedIn&lt;/a&gt; and &lt;a href="https://medium.com/@gulcancoskun.a" rel="noopener noreferrer"&gt;Medium&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  6. References
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;&lt;a href="https://www.techtarget.com/searchsecurity/definition/encryption" rel="noopener noreferrer"&gt;TechTarget&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://practicalcryptography.com/ciphers/rot13-cipher/" rel="noopener noreferrer"&gt;Practical cryptography&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://medium.com/r/?url=https%3A%2F%2Fwiki.alquds.edu%2F%3Fquery%3DRot13" rel="noopener noreferrer"&gt;Wikipedia&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://openclassrooms.com/fr/courses/6045521-preparez-vous-aux-tests-techniques-pour-devenir-developpeur" rel="noopener noreferrer"&gt;OpenClassrooms online course&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.geeksforgeeks.org/javascript-string-prototype-split-function/" rel="noopener noreferrer"&gt;GeeksforGeeks&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://medium.com/r/?url=https%3A%2F%2Fdeveloper.mozilla.org%2Fen-US%2Fdocs%2FWeb%2FJavaScript%2FReference%2FGlobal_Objects%2FString%2FcharCodeAt" rel="noopener noreferrer"&gt;MDN Web Docs&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://medium.com/r/?url=https%3A%2F%2Fwww.javascripttutorial.net%2Fjavascript-array-foreach%2F" rel="noopener noreferrer"&gt;JavaScript Tutorial&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://ascii.cl/" rel="noopener noreferrer"&gt;ASCII&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.techonthenet.com/js/string_charcodeat.php" rel="noopener noreferrer"&gt;TechOnTheNet&lt;/a&gt;&lt;/li&gt;
&lt;/ol&gt;

</description>
      <category>rot13</category>
      <category>algorithms</category>
      <category>charcodeat</category>
      <category>javascript</category>
    </item>
    <item>
      <title>🚀Firebase to Deploy ReactJS &amp; VueJS Apps for Free</title>
      <dc:creator>Gulcan COSKUN</dc:creator>
      <pubDate>Sun, 25 Dec 2022 21:43:05 +0000</pubDate>
      <link>https://dev.to/gulcanc/firebase-to-deploy-reactjs-vuejs-apps-for-free-13ld</link>
      <guid>https://dev.to/gulcanc/firebase-to-deploy-reactjs-vuejs-apps-for-free-13ld</guid>
      <description>&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fq8qjj20dzvid3urnep19.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fq8qjj20dzvid3urnep19.png" alt="Image description" width="720" height="556"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In this tutorial, we will see an easy way how to deploy our javascript framework applications using Firebase Hosting.&lt;/p&gt;

&lt;h2&gt;
  
  
  1. What is Application Deployment?
&lt;/h2&gt;

&lt;p&gt;Application deployment is a process of installing, configuring, updating, and enabling one application available for use.&lt;/p&gt;

&lt;h2&gt;
  
  
  2. Firebase Hosting
&lt;/h2&gt;

&lt;p&gt;Firebase is an app development platform that helps us build and grow apps. We can deploy our JavaScript framework apps quickly and for free with Firebase.&lt;/p&gt;

&lt;h2&gt;
  
  
  3. Creating Deployable Resources
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F9ble5qxxoz8ptdzdl6xu.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F9ble5qxxoz8ptdzdl6xu.png" alt="_Figure 3.1 Deployable resources_" width="800" height="616"&gt;&lt;/a&gt; &lt;em&gt;Figure 3.1 Deployable resources&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Assume that we have created a project, and we want to upload it into a static host. If we have a very simple project that contains HTML, CSS, and JavaScript files without any project setup, then we can take these files and upload them to a server. If we have a complex project (created with Vue CLI or anything like that), we have a few more steps to do. We first need to transform our code to regular JavaScript in a way that the browser will be able to understand it.&lt;/p&gt;

&lt;h2&gt;
  
  
  4. Steps to Deploy our App to Firebase Hosting
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;4.1 Building our project&lt;/strong&gt;&lt;br&gt;
In our Vue.js or React.js project, we have several files or components. These individual files need to be merged or combined. This is one of the biggest benefits of the build script. In the package.json file, we can find all the scripts that can be executable (Figure 4.1).&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fbkejo6ts66hqciij3und.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fbkejo6ts66hqciij3und.png" alt="Image description" width="720" height="540"&gt;&lt;/a&gt;&lt;em&gt;Figure 4.1 Scripts in a package.json file&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;In the terminal, we go to our project folder and run this command:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;npm run build&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;This command converts the code such that the browser can understand and optimize it to make it as small and efficient as possible. Once this process is finished, we will find a different folder in our project folder. This folder can be automatically named “dist”, “public”, or “build”. It will contain the index.html file, the javascript folder, and the CSS folder, all minified and optimized to take up space as little as possible (Figure 4.2).&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Frao5vljrw7mbt4jcuveu.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Frao5vljrw7mbt4jcuveu.png" alt="Image description" width="720" height="403"&gt;&lt;/a&gt;&lt;em&gt;Figure 4.2 Created build folder&lt;/em&gt;&lt;/p&gt;




&lt;p&gt;&lt;strong&gt;4.2 Creating A Firebase Hosting Account&lt;/strong&gt;&lt;br&gt;
We have to go to Firebase Hosting and create our account.&lt;/p&gt;




&lt;p&gt;&lt;strong&gt;4.3 Adding our project for hosting&lt;/strong&gt;&lt;br&gt;
Once we have created an account on Firebase Hosting, we click on Get Started and then add our project with a specific name (Figure 4.3). We click on the continue button and we will see that our project is ready for the next steps (Figure 4.4).&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fe11qzk9082u3ibhi10wk.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fe11qzk9082u3ibhi10wk.png" alt="Image description" width="720" height="569"&gt;&lt;/a&gt;&lt;em&gt;Figure 4.3 Add your project&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F76mzfp3hp36wkx3nhm2f.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F76mzfp3hp36wkx3nhm2f.png" alt="Image description" width="720" height="414"&gt;&lt;/a&gt;&lt;em&gt;Figure 4.4 Create your project&lt;/em&gt;&lt;/p&gt;




&lt;p&gt;&lt;strong&gt;4.4 Build and hosting&lt;/strong&gt;&lt;br&gt;
After our project is successfully added with a specific name, we will see the build menu on the left (Figure 4.5). Click on “Hosting” under this menu and then click on “Get started” (Figure 4.6). Afterward, we see that we need to install an extra tool. In the next step, we will learn the extra tool.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fy2daspy8batfcgvj4sh3.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fy2daspy8batfcgvj4sh3.png" alt="Image description" width="720" height="423"&gt;&lt;/a&gt;&lt;em&gt;Figure 4.5 Build menu&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fpseq8x45gm8ura23xbfd.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fpseq8x45gm8ura23xbfd.png" alt="Image description" width="720" height="349"&gt;&lt;/a&gt;&lt;em&gt;Figure 4.6 Hosting with Get started&lt;/em&gt;&lt;/p&gt;




&lt;p&gt;&lt;strong&gt;4.5 Set up Firebase Hosting&lt;/strong&gt;&lt;br&gt;
&lt;strong&gt;&lt;em&gt;4.5.1 Install Firebase CLI&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;We will run the following command in our terminal, it will install the required extra tool on our machine provided by Firebase.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;npm install -g firebase-tools&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Once the installation is finished, we can do a Firebase version check to make sure that everything is working properly.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;firebase --version&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;4.5.2 Firebase Login and Init&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;In the next step, we need to log in by running “firebase login” in the terminal. This should open up a tab in a browser and allow us to log in.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;firebase login&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F7zei33gdsw7hzmxandx9.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F7zei33gdsw7hzmxandx9.png" alt="Image description" width="720" height="393"&gt;&lt;/a&gt;&lt;em&gt;Figure 4.7 Firebase login and init&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Next, we need to run “firebase init”, this will ask us a couple of questions.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;firebase init&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;First, it asks us which part of firebase we want to manage with this command line interface. Since we want to host our project, we need to select “hosting ” with arrow keys and press space to mark it, and then press enter (Figure 4.8).&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fexqg3rm12q350gkwl7dy.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fexqg3rm12q350gkwl7dy.png" alt="Image description" width="720" height="113"&gt;&lt;/a&gt;&lt;em&gt;Figure 4.8 Firebase features&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;The next question is whether we want to create a new project or use an existing one. Since we already have created a project, we select “use the existing one”. This will list all available projects and we can scroll through with the arrows, then we select the project that we have just created and click enter (Figure 4.9).&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fot8tznnsp99qkwkw2ubi.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fot8tznnsp99qkwkw2ubi.png" alt="Image description" width="720" height="291"&gt;&lt;/a&gt;&lt;em&gt;Figure 4.9 Select an existing project&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;The following question asks us what our public directory should be. It is a very important step because this is the directory where the files to be uploaded are located (To remember that, we can read again 4.1 Building our project section). In my case, it is the “build” folder, but depending on your project, it can be “dist”, “build ” or “public ” folders, so check your folder name and type the name of your folder, and press enter (Figure 4.10).&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F8n31xofp8qpqetx5uiyq.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F8n31xofp8qpqetx5uiyq.png" alt="Image description" width="720" height="442"&gt;&lt;/a&gt;&lt;em&gt;Figure 4.10 Public directory&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;For the following steps, you can answer the next three questions as shown in Figure 4.11.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fxftb6636d74yc4qetncj.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fxftb6636d74yc4qetncj.png" alt="Image description" width="720" height="183"&gt;&lt;/a&gt;&lt;em&gt;Figure 4.11 Set up questions&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;4.5.3 Firebase Deploy&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Ready to deploy our web application? This is the last step, we run the following command in our terminal.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;firebase deploy&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Awesome! Now we can visit the generated URL and share our project seamlessly!&lt;/p&gt;

&lt;h2&gt;
  
  
  5. Conclusion
&lt;/h2&gt;

&lt;p&gt;In this article, we have learned how to deploy an application with Firebase hosting service. It doesn’t matter with which framework we developed the project, we just need to pay attention to our public directory folder name. Thus, we can easily use Firebase hosting service for our applications. Also, it is free!&lt;/p&gt;

&lt;p&gt;As an example, you can have a look at &lt;a href="https://gcoskun-react-app.web.app/" rel="noopener noreferrer"&gt;my last React project&lt;/a&gt; that I deployed with Firebase hosting service.&lt;/p&gt;

&lt;p&gt;Happy learning …&lt;/p&gt;

&lt;p&gt;You can reach out to me through &lt;a href="https://www.linkedin.com/in/gulcan-coskun" rel="noopener noreferrer"&gt;LinkedIn&lt;/a&gt; and &lt;a href="https://medium.com/@gulcancoskun.a" rel="noopener noreferrer"&gt;Medium&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  6. References
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;&lt;a href="https://www.udemy.com/course/vuejs-2-the-complete-guide/" rel="noopener noreferrer"&gt;Udemy VueJS Course&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://firebase.google.com/docs/web/setup" rel="noopener noreferrer"&gt;Firebase Tutorials&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://blog.logrocket.com/everything-you-need-know-about-react-scripts/" rel="noopener noreferrer"&gt;https://blog.logrocket.com/everything-you-need-know-about-react-scripts/&lt;/a&gt;&lt;/li&gt;
&lt;/ol&gt;

</description>
      <category>beginners</category>
      <category>programming</category>
      <category>kotlin</category>
      <category>community</category>
    </item>
  </channel>
</rss>
