<?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: Rafi-Genon</title>
    <description>The latest articles on DEV Community by Rafi-Genon (@rafi21).</description>
    <link>https://dev.to/rafi21</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%2F627689%2F9ea47734-77da-4e80-90c9-75ded966bbff.png</url>
      <title>DEV Community: Rafi-Genon</title>
      <link>https://dev.to/rafi21</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/rafi21"/>
    <language>en</language>
    <item>
      <title>Top 10 JavaScript Interview Questions And Answers.</title>
      <dc:creator>Rafi-Genon</dc:creator>
      <pubDate>Sat, 08 May 2021 08:51:19 +0000</pubDate>
      <link>https://dev.to/rafi21/top-10-javascript-interview-questions-and-answers-2k55</link>
      <guid>https://dev.to/rafi21/top-10-javascript-interview-questions-and-answers-2k55</guid>
      <description>&lt;h2&gt;
  
  
  1. Truthy &amp;amp; Falsy Values
&lt;/h2&gt;

&lt;p&gt;When a value is counted in the context of Boolean then which values show true we consider them as truthy and which show false we consider them as falsy value there are some example of falsy value (false, 0, -0, "", undefined, NaN)&lt;/p&gt;

&lt;h2&gt;
  
  
  2. Null Vs Undefined
&lt;/h2&gt;

&lt;p&gt;When we define a variable but don't assign any value in it then javascript shows us undefined on the other hand, Null is assigned null means empty and explicitly means nothing&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;var abc;
console.log(abc);
// undefined

var xyz = null;
console.log(xyz);
// null
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  3. Double Equals (==) vs Triple Equals (===)
&lt;/h2&gt;

&lt;p&gt;Double Equals (==) check only value. It converts the type of value to match each other. on the other hand, Triple Equals (===) match both value and type.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const num = 1234 
const stringNum = '1234'  

console.log(num == stringNum) //true
console.log(num === stringNum)  //false
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  4. Have a look at the difference between bind, call, apply
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;apply():&lt;/strong&gt; method call a function and pass all the arguments in a array&lt;br&gt;
&lt;strong&gt;call():&lt;/strong&gt; method passes all the arguments with comma&lt;br&gt;
&lt;strong&gt;bind():&lt;/strong&gt; returns a new function, allowing you to pass in an array and any number of arguments.&lt;/p&gt;
&lt;h2&gt;
  
  
  5. How JS code executes
&lt;/h2&gt;

&lt;p&gt;Everything in JavaScript happens inside an "Execution Context”. When a code stared execution the execution context is created. &lt;br&gt;
first of all Creation Phase or Memory Creation &amp;amp; after Code Execution Phase. In Creation Phase, JS create global variable for all diclared variable &amp;amp; after Execution Phase JS follow Call stack  system&lt;/p&gt;
&lt;h2&gt;
  
  
  6. What is an API
&lt;/h2&gt;

&lt;p&gt;Full form of API is Application Programming Interface. API allow two application to communicate  each other. API delivers our request to the provider &amp;amp; provider response back to us.&lt;/p&gt;
&lt;h2&gt;
  
  
  7. Reverse a string
&lt;/h2&gt;

&lt;p&gt;To reverse a string we will use three method these are split(), reverse(),join()&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;function reverseString(str) {
    // Step 1. Use the split() method to return a new array
    var splitString = str.split(""); // var splitString = "hello".split("");
    // ["h", "e", "l", "l", "o"]

    // Step 2. Use the reverse() method to reverse the new created array
    var reverseArray = splitString.reverse(); // var reverseArray = ["h", "e", "l", "l", "o"].reverse();
    // ["o", "l", "l", "e", "h"]

    // Step 3. Use the join() method to join all elements of the array into a string
    var joinArray = reverseArray.join(""); // var joinArray = ["o", "l", "l", "e", "h"].join("");
    // "olleh"

    //Step 4. Return the reversed string
    return joinArray; // "olleh"
}

reverseString("hello");
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  8. Count the number of words in a string
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;var speech = "I am Rafi"
var count =0;
for(var i = 0; i&amp;lt; speech.length; i++){
    var char = speech[i];
    if(char === " "){
   count ++
  }
}
// expected count is 3
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  9. is comming soon
&lt;/h2&gt;

</description>
    </item>
  </channel>
</rss>
