<?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: Deeksha</title>
    <description>The latest articles on DEV Community by Deeksha (@deek9399).</description>
    <link>https://dev.to/deek9399</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%2F341954%2F72048a84-4c0d-430a-b5cc-c5199cf379f9.jpeg</url>
      <title>DEV Community: Deeksha</title>
      <link>https://dev.to/deek9399</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/deek9399"/>
    <language>en</language>
    <item>
      <title>Fixing my everyday errors!!</title>
      <dc:creator>Deeksha</dc:creator>
      <pubDate>Sat, 30 Oct 2021 16:59:33 +0000</pubDate>
      <link>https://dev.to/deek9399/fixing-my-everyday-errors-1bol</link>
      <guid>https://dev.to/deek9399/fixing-my-everyday-errors-1bol</guid>
      <description>&lt;h3&gt;
  
  
  1. How do I kill a process currently using a port on localhost?
&lt;/h3&gt;

&lt;p&gt;&lt;code&gt;npx kill-port 8001&lt;/code&gt;&lt;br&gt;
Expected output: Process on port 8001 killed &lt;/p&gt;
&lt;h3&gt;
  
  
  2. Using import in server.js
&lt;/h3&gt;

&lt;p&gt;Inside package.json add&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="nl"&gt;"type"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"module"&lt;/span&gt;&lt;span class="err"&gt;,&lt;/span&gt;&lt;span class="w"&gt;

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

&lt;/div&gt;



&lt;h3&gt;
  
  
  3. sh: react-scripts: command not found after running npm start
&lt;/h3&gt;

&lt;p&gt;run &lt;code&gt;npm install&lt;/code&gt; or &lt;code&gt;yarn add&lt;/code&gt;&lt;br&gt;
💡 &lt;a href="https://stackoverflow.com/questions/40546231/sh-react-scripts-command-not-found-after-running-npm-start" rel="noopener noreferrer"&gt;stack-overflow&lt;/a&gt; &lt;/p&gt;
&lt;h3&gt;
  
  
  4. axios baseURL
&lt;/h3&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// Set config defaults when creating the instance&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;instance&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;axios&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;create&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
  &lt;span class="na"&gt;baseURL&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;https://api.example.com&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;h3&gt;
  
  
  5. Heroku &lt;code&gt;error code = H10&lt;/code&gt;
&lt;/h3&gt;

&lt;p&gt;Heroku dynamically sets the PORT, which can be accessed with &lt;code&gt;process.env.PORT&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;port&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;process&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;env&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;PORT&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="mi"&gt;8001&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  6. If we get "Failed to load config "react-app" to extend from"
&lt;/h3&gt;

&lt;p&gt;&lt;code&gt;yarn add eslint-config-react-app&lt;/code&gt;&lt;br&gt;
💡&lt;a href="https://dev.to/ashleyo/comment/1c5p2"&gt;dev.to&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  7. Installing npm
&lt;/h3&gt;

&lt;p&gt;&lt;code&gt;sudo apt-get install npm&lt;br&gt;
&lt;/code&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  8. Installing n
&lt;/h3&gt;

&lt;p&gt;&lt;code&gt;sudo npm install n -g&lt;br&gt;
&lt;/code&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  9. Installing Node LTS version
&lt;/h3&gt;

&lt;p&gt;&lt;code&gt;sudo n lts&lt;/code&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  10. Checking node version
&lt;/h3&gt;

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

&lt;h3&gt;
  
  
  10. Installing java version 11
&lt;/h3&gt;

&lt;p&gt;&lt;code&gt;sudo apt install openjdk-11-jre-headless&lt;/code&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  11. Installing vs code
&lt;/h3&gt;

&lt;p&gt;11.1.&lt;code&gt;sudo apt install wget -y&lt;/code&gt;&lt;br&gt;
11.2&lt;code&gt;wget -O vscode.deb 'https://code.visualstudio.com/sha/download?build=stable&amp;amp;os=linux-deb-x64'&lt;/code&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  12. Installing Storybook
&lt;/h3&gt;

&lt;p&gt;&lt;code&gt;npx sb init&lt;/code&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  13. Clone a specific branch
&lt;/h3&gt;

&lt;p&gt;&lt;code&gt;git clone -b &amp;lt;branchname&amp;gt; &amp;lt;remote-repo-url&amp;gt;&lt;br&gt;
&lt;/code&gt;&lt;br&gt;
💡 &lt;a href="https://www.freecodecamp.org/news/git-clone-branch-how-to-clone-a-specific-branch/" rel="noopener noreferrer"&gt;https://www.freecodecamp.org/news/git-clone-branch-how-to-clone-a-specific-branch/&lt;/a&gt;&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>codenewbie</category>
      <category>linux</category>
      <category>javascript</category>
    </item>
    <item>
      <title>Useful VS Code Extensions!!</title>
      <dc:creator>Deeksha</dc:creator>
      <pubDate>Wed, 11 Aug 2021 16:28:27 +0000</pubDate>
      <link>https://dev.to/deek9399/useful-vs-code-extensions-356a</link>
      <guid>https://dev.to/deek9399/useful-vs-code-extensions-356a</guid>
      <description>&lt;p&gt;VS Code extensions let you add languages, debuggers, and tools to your installation to support your development workflow. Few VS Code extensions that will make you a more productive developer are shared here. The extensions provided here are mostly for web developers, but some general-purpose extensions will benefit everyone, even a beginner as well.&lt;/p&gt;

&lt;h2&gt;
  
  
  Prettier
&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%2Fesbenp.gallerycdn.vsassets.io%2Fextensions%2Fesbenp%2Fprettier-vscode%2F8.1.0%2F1627313281382%2FMicrosoft.VisualStudio.Services.Icons.Default" 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%2Fesbenp.gallerycdn.vsassets.io%2Fextensions%2Fesbenp%2Fprettier-vscode%2F8.1.0%2F1627313281382%2FMicrosoft.VisualStudio.Services.Icons.Default" alt="Prettier logo image" width="128" height="128"&gt;&lt;/a&gt;&lt;br&gt;
Prettier is an opinionated code formatter that supports many languages. It removes all original styling* and ensures that all outputted code conforms to a consistent style.&lt;br&gt;
&lt;strong&gt;Remember:&lt;/strong&gt; In order to use prettier,  in settings add a &lt;strong&gt;✔&lt;/strong&gt; on the &lt;strong&gt;format on save&lt;/strong&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  GitLens
&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%2Feamodio.gallerycdn.vsassets.io%2Fextensions%2Feamodio%2Fgitlens%2F11.6.0%2F1626155623749%2FMicrosoft.VisualStudio.Services.Icons.Default" 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%2Feamodio.gallerycdn.vsassets.io%2Fextensions%2Feamodio%2Fgitlens%2F11.6.0%2F1626155623749%2FMicrosoft.VisualStudio.Services.Icons.Default" alt="GitLens logo image" width="128" height="128"&gt;&lt;/a&gt;&lt;br&gt;
GitLens supercharges the Git capabilities built into Visual Studio Code. It helps you to visualize code authorship at a glance via Git blame annotations and code lens, seamlessly navigate and explore Git repositories, gain valuable insights via powerful comparison commands, and so much more.&lt;br&gt;
GitLens simply helps you better understand code. Quickly glimpse into whom, why, and when a line or code block was changed. Jump back through history to gain further insights as to how and why the code evolved. Effortlessly explore the history and evolution of a codebase.&lt;/p&gt;

&lt;h2&gt;
  
  
  Current File Path
&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%2Fyoshinorin.gallerycdn.vsassets.io%2Fextensions%2Fyoshinorin%2Fcurrent-file-path%2F3.1.0%2F1613051157605%2FMicrosoft.VisualStudio.Services.Icons.Default" 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%2Fyoshinorin.gallerycdn.vsassets.io%2Fextensions%2Fyoshinorin%2Fcurrent-file-path%2F3.1.0%2F1613051157605%2FMicrosoft.VisualStudio.Services.Icons.Default" alt="Current File Path logo image" width="128" height="128"&gt;&lt;/a&gt;&lt;br&gt;
This extension displays a current file path from absolute (root directory) or workspace highest directory in StatusBar by Unix style or Windows style.&lt;/p&gt;

&lt;h2&gt;
  
  
  Bracket Pair Colorizer
&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%2Fcoenraads.gallerycdn.vsassets.io%2Fextensions%2Fcoenraads%2Fbracket-pair-colorizer%2F1.0.61%2F1542132753296%2FMicrosoft.VisualStudio.Services.Icons.Default" 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%2Fcoenraads.gallerycdn.vsassets.io%2Fextensions%2Fcoenraads%2Fbracket-pair-colorizer%2F1.0.61%2F1542132753296%2FMicrosoft.VisualStudio.Services.Icons.Default" alt="Bracket Pair Colorizer logo image" width="128" height="128"&gt;&lt;/a&gt;&lt;br&gt;
This extension allows matching brackets to be identified with colors. The user can define which characters to match, and which colors to use.&lt;br&gt;
It is a good tool for beginners. Many times in the early-stage most of the errors are due to missing brackets.&lt;/p&gt;

&lt;h2&gt;
  
  
  Emmet
&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%2Fcliffding.gallerycdn.vsassets.io%2Fextensions%2Fcliffding%2Fvisualstudioemmet2013%2F1.2%2F1482139612109%2FMicrosoft.VisualStudio.Services.Icons.Default" 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%2Fcliffding.gallerycdn.vsassets.io%2Fextensions%2Fcliffding%2Fvisualstudioemmet2013%2F1.2%2F1482139612109%2FMicrosoft.VisualStudio.Services.Icons.Default" alt="Emmet logo image" width="64" height="64"&gt;&lt;/a&gt;&lt;br&gt;
Emmet is a web-developer’s toolkit that can greatly improve your HTML &amp;amp; CSS workflow.&lt;br&gt;
Emmet takes the snippets idea to a whole new level: you can type CSS-like expressions that can be dynamically parsed, and produce output depending on what you type in the abbreviation. Emmet is developed and optimized for web-developers whose workflow depends on HTML/XML and CSS, but can be used with programming languages too.&lt;/p&gt;

&lt;h2&gt;
  
  
  Live Share
&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%2Fms-vsliveshare.gallerycdn.vsassets.io%2Fextensions%2Fms-vsliveshare%2Fvsliveshare-pack%2F0.4.0%2F1591125099437%2FMicrosoft.VisualStudio.Services.Icons.Default" 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%2Fms-vsliveshare.gallerycdn.vsassets.io%2Fextensions%2Fms-vsliveshare%2Fvsliveshare-pack%2F0.4.0%2F1591125099437%2FMicrosoft.VisualStudio.Services.Icons.Default" alt="Live Share logo image" width="128" height="128"&gt;&lt;/a&gt;&lt;br&gt;
Live share enables you to collaboratively edit and debug with others in real-time, regardless of the programming languages you are using or app types you are building. You can instantly and securely share your current project, start a joint debugging session, share terminal instances, forward localhost web apps, have voice calls, and more!&lt;br&gt;
Unlike traditional pair programming, Visual Studio Live Share allows developers to work together while retaining their personal editor preferences, as well as having their own cursor.&lt;/p&gt;

&lt;h2&gt;
  
  
  ES7 React/Redux/GraphQL/React-Native snippets
&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%2Fencrypted-tbn0.gstatic.com%2Fimages%3Fq%3Dtbn%3AANd9GcRNCIyeIngFtjnb39rUhEBu4oXATGjeVJXzJQ%26usqp%3DCAU" 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%2Fencrypted-tbn0.gstatic.com%2Fimages%3Fq%3Dtbn%3AANd9GcRNCIyeIngFtjnb39rUhEBu4oXATGjeVJXzJQ%26usqp%3DCAU" alt="logo" width="225" height="225"&gt;&lt;/a&gt;&lt;br&gt;
This extension provides you with JavaScript and React/Redux snippets in ES7 with Babel plugin features for VS Code. It gets you quickly up and running with the codes and components that you need simply just by typing few letters.&lt;/p&gt;

&lt;h2&gt;
  
  
  Tabnine
&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%2Fencrypted-tbn0.gstatic.com%2Fimages%3Fq%3Dtbn%3AANd9GcQiizXvUxQQfbA8T34226K3nx4vq9csEN3zzg%26usqp%3DCAU" 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%2Fencrypted-tbn0.gstatic.com%2Fimages%3Fq%3Dtbn%3AANd9GcQiizXvUxQQfbA8T34226K3nx4vq9csEN3zzg%26usqp%3DCAU" alt="Tabnine logo image" width="300" height="168"&gt;&lt;/a&gt;&lt;br&gt;
Tabnine studies publicly shared code and use A.I deep learning algorithms that provide us with the ability to predict your next coding needs and suggest one-click code completion.​&lt;br&gt;
Tabnine works with all major programming languages including JavaScript, Python, TypeScript, PHP, C/C++, HTML/CSS, Go, Java, Ruby, C#, Rust, SQL, Bash, Kotlin, Julia, Lua, OCaml, Perl, Haskell, and React.​&lt;br&gt;
&lt;strong&gt;Remember:&lt;/strong&gt; Use Tabnine only when you have completely understood a language. It is supposed to save your development time not hinder your learning.&lt;/p&gt;

&lt;h2&gt;
  
  
  NOTE:
&lt;/h2&gt;

&lt;p&gt;Some of these will require minor changes in settings, refer to documentation, blogs, google search, youtube videos on how to set this up.&lt;br&gt;
If further guidance/help is needed reach out to me at &lt;a href="mailto:edudeek@gmail.com"&gt;edudeek@gmail.com&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Happy Learning!!
&lt;/h3&gt;

</description>
      <category>codenewbie</category>
      <category>extensions</category>
      <category>vscode</category>
    </item>
    <item>
      <title>Recursion with JavaScript</title>
      <dc:creator>Deeksha</dc:creator>
      <pubDate>Mon, 31 May 2021 15:30:34 +0000</pubDate>
      <link>https://dev.to/deek9399/recursion-with-javascript-4old</link>
      <guid>https://dev.to/deek9399/recursion-with-javascript-4old</guid>
      <description>&lt;h2&gt;
  
  
  &lt;strong&gt;Definition:&lt;/strong&gt; A process or a function that calls itself.
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Where is it used ???
&lt;/h3&gt;

&lt;p&gt;(Other than our own code)&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;JSON.parse / JSON.stringify inside JavaScript engine is often written recursively. &lt;/li&gt;
&lt;li&gt;document.getElementById and DOM traversal algorith are often written recursively.&lt;/li&gt;
&lt;li&gt;Recursion is also seen with more complex data structures.(Trees and Graphs)&lt;/li&gt;
&lt;li&gt;At times it is seen as a cleaner alternative to iteration.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Any time a function is invoked, it is placed on the top of call stack. When JavaScript sees the return keyword or whenever the function ends, compiler will remove it from stack. We are used to functions being pushed on the call stack and popped off when they are done. When we write recursive functions we keep pushing new functions onto call stack.&lt;/p&gt;

&lt;h3&gt;
  
  
  How recursive functions work?
&lt;/h3&gt;

&lt;p&gt;We invoke the same function with a different input until we reach the base case.&lt;br&gt;
&lt;strong&gt;Base Case:&lt;/strong&gt;It is the condition for which solution is provided. The solution for the bigger problem is expressed in terms of smaller problems.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;factorial&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;num&lt;/span&gt;&lt;span class="p"&gt;){&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;num&lt;/span&gt;&lt;span class="o"&gt;===&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="o"&gt;||&lt;/span&gt;&lt;span class="nx"&gt;num&lt;/span&gt;&lt;span class="o"&gt;===&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="c1"&gt;//Base Case&lt;/span&gt;
    &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="k"&gt;else&lt;/span&gt; &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;num&lt;/span&gt;&lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="nf"&gt;factorial&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;num&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Common recursion pitfalls
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Errors in the base case
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;factorial&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;num&lt;/span&gt;&lt;span class="p"&gt;){&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;num&lt;/span&gt;&lt;span class="o"&gt;===&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="o"&gt;||&lt;/span&gt;&lt;span class="nx"&gt;num&lt;/span&gt;&lt;span class="o"&gt;===&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="c1"&gt;//Base Case&lt;/span&gt;
    &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="k"&gt;else&lt;/span&gt; &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;num&lt;/span&gt;&lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="nf"&gt;factorial&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;num&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Forgetting to return or returning wrong thing
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;factorial&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;num&lt;/span&gt;&lt;span class="p"&gt;){&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;num&lt;/span&gt;&lt;span class="o"&gt;===&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="o"&gt;||&lt;/span&gt;&lt;span class="nx"&gt;num&lt;/span&gt;&lt;span class="o"&gt;===&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="c1"&gt;//Base Case&lt;/span&gt;
    &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;num&lt;/span&gt; &lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="k"&gt;else&lt;/span&gt; &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;num&lt;/span&gt;&lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="nf"&gt;factorial&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;num&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Instead of return using console.log for base case.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;factorial&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;num&lt;/span&gt;&lt;span class="p"&gt;){&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;num&lt;/span&gt;&lt;span class="o"&gt;===&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="o"&gt;||&lt;/span&gt;&lt;span class="nx"&gt;num&lt;/span&gt;&lt;span class="o"&gt;===&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="c1"&gt;//Base Case&lt;/span&gt;
    &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="k"&gt;else&lt;/span&gt; &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;num&lt;/span&gt;&lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="nf"&gt;factorial&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;num&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Maximum  call size stack exceeded / stack overflow.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;callMyself&lt;/span&gt;&lt;span class="p"&gt;(){&lt;/span&gt;
  &lt;span class="nf"&gt;callMyself&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="nf"&gt;callMyself&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Happy Learning!!
&lt;/h4&gt;

</description>
      <category>javascript</category>
      <category>recursion</category>
      <category>programming</category>
      <category>dsa</category>
    </item>
  </channel>
</rss>
