<?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>Forem: Esraa Refaat</title>
    <description>The latest articles on Forem by Esraa Refaat (@esraarefaat).</description>
    <link>https://forem.com/esraarefaat</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%2F652766%2Fa4211235-dd40-4182-9a89-4d40adde208c.jpg</url>
      <title>Forem: Esraa Refaat</title>
      <link>https://forem.com/esraarefaat</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/esraarefaat"/>
    <language>en</language>
    <item>
      <title>Javascript Questions</title>
      <dc:creator>Esraa Refaat</dc:creator>
      <pubDate>Fri, 25 Jun 2021 02:20:59 +0000</pubDate>
      <link>https://forem.com/esraarefaat/javascript-questions-54gj</link>
      <guid>https://forem.com/esraarefaat/javascript-questions-54gj</guid>
      <description>&lt;p&gt;Is this a pure function?&lt;/p&gt;

&lt;p&gt;function sum(a, b) {&lt;br&gt;
  return a + b;&lt;br&gt;
}&lt;/p&gt;

&lt;p&gt;A: Yes&lt;br&gt;
B: No&lt;/p&gt;

&lt;p&gt;Answer: A&lt;/p&gt;

&lt;p&gt;A pure function is a function that always returns the same result, if the same arguments are passed.&lt;/p&gt;

&lt;p&gt;The sum function always returns the same result. If we pass 1 and 2, it will always return 3 without side effects. If we pass 5 and 10, it will always return 15, and so on. This is the definition of a pure function.&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>beginners</category>
      <category>interview</category>
      <category>intermediate</category>
    </item>
    <item>
      <title>Javascript Questions</title>
      <dc:creator>Esraa Refaat</dc:creator>
      <pubDate>Wed, 23 Jun 2021 23:43:36 +0000</pubDate>
      <link>https://forem.com/esraarefaat/javascript-questions-2k3k</link>
      <guid>https://forem.com/esraarefaat/javascript-questions-2k3k</guid>
      <description>&lt;p&gt;let a = 3;&lt;br&gt;
let b = new Number(3);&lt;br&gt;
let c = 3;&lt;/p&gt;

&lt;p&gt;console.log(a == b);&lt;br&gt;
console.log(a === b);&lt;br&gt;
console.log(b === c);&lt;/p&gt;

&lt;p&gt;A: true false true&lt;br&gt;
B: false false true&lt;br&gt;
C: true false false&lt;br&gt;
D: false true true&lt;/p&gt;

&lt;p&gt;Answer: C&lt;/p&gt;

&lt;p&gt;new Number() is a built-in function constructor. Although it looks like a number, it's not really a number: it has a bunch of extra features and is an object.&lt;/p&gt;

&lt;p&gt;When we use the == operator, it only checks whether it has the same value. They both have the value of 3, so it returns true.&lt;/p&gt;

&lt;p&gt;However, when we use the === operator, both value and type should be the same. It's not: new Number() is not a number, it's an object. Both return false.&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>beginners</category>
      <category>interview</category>
      <category>intermediate</category>
    </item>
    <item>
      <title>Javascript operators (part 1)</title>
      <dc:creator>Esraa Refaat</dc:creator>
      <pubDate>Wed, 23 Jun 2021 01:55:00 +0000</pubDate>
      <link>https://forem.com/esraarefaat/javascript-operators-part-1-43pj</link>
      <guid>https://forem.com/esraarefaat/javascript-operators-part-1-43pj</guid>
      <description>&lt;p&gt;Operators in Javascript has three categories:&lt;/p&gt;

&lt;p&gt;1- unary operators &lt;br&gt;
One operand&lt;br&gt;
    X&lt;/p&gt;

&lt;p&gt;2- binary operators&lt;/p&gt;

&lt;p&gt;Two operands&lt;br&gt;
   X  Y&lt;/p&gt;

&lt;p&gt;3- ternary operators &lt;br&gt;
Three operands&lt;br&gt;
   X  Y  Z &lt;/p&gt;




&lt;p&gt;unary operators : &lt;br&gt;
increment&lt;br&gt;
X++&lt;br&gt;
decrement&lt;br&gt;
X--&lt;br&gt;
Keep in mind&lt;br&gt;
prefix ++X&lt;br&gt;
postfix X++&lt;/p&gt;

&lt;p&gt;binary operators :&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;arthimatic operators :
X+Y
X-Y
X*Y
X/Y
X%Y&lt;/li&gt;
&lt;li&gt;&lt;p&gt;assignment operators :&lt;br&gt;
X+=y ➡️ X=X+Y&lt;br&gt;
(-=)(*=)(+=)(/=)(%=)&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;comparison operators :&lt;br&gt;
(==) ( &amp;gt; ) ( &amp;lt; )&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>javascript</category>
      <category>beginners</category>
    </item>
    <item>
      <title>Javascript Questions</title>
      <dc:creator>Esraa Refaat</dc:creator>
      <pubDate>Tue, 22 Jun 2021 14:33:46 +0000</pubDate>
      <link>https://forem.com/esraarefaat/javascript-questions-c52</link>
      <guid>https://forem.com/esraarefaat/javascript-questions-c52</guid>
      <description>&lt;p&gt;What's the output?&lt;/p&gt;

&lt;p&gt;let c = { greeting: 'Hey!' };&lt;br&gt;
let d;&lt;/p&gt;

&lt;p&gt;d = c;&lt;br&gt;
c.greeting = 'Hello';&lt;br&gt;
console.log(d.greeting);&lt;/p&gt;

&lt;p&gt;A: Hello&lt;br&gt;
B: Hey!&lt;br&gt;
C: undefined&lt;br&gt;
D: ReferenceError&lt;br&gt;
E: TypeError&lt;/p&gt;

&lt;p&gt;Answer: A&lt;/p&gt;

&lt;p&gt;In JavaScript, all objects interact by reference when setting them equal to each other.&lt;/p&gt;

&lt;p&gt;First, variable c holds a value to an object. Later, we assign d with the same reference that c has to the object.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fwla17c2fu02lsck8w1hi.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fwla17c2fu02lsck8w1hi.jpg" alt="Alt Text" width="720" height="558"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;When you change one object, you change all of them.&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>beginners</category>
      <category>interview</category>
      <category>intermediate</category>
    </item>
    <item>
      <title>Javascript Questions</title>
      <dc:creator>Esraa Refaat</dc:creator>
      <pubDate>Mon, 21 Jun 2021 13:05:48 +0000</pubDate>
      <link>https://forem.com/esraarefaat/javascript-questions-11n8</link>
      <guid>https://forem.com/esraarefaat/javascript-questions-11n8</guid>
      <description>&lt;p&gt;💡 for (var i = 0; i &amp;lt; 3; i++) &lt;br&gt;
      {&lt;br&gt;
    setTimeout(() =&amp;gt; &lt;br&gt;
    console.log(i), 1);&lt;br&gt;
      }&lt;/p&gt;

&lt;p&gt;for (let i = 0; i &amp;lt; 3; i++) {&lt;br&gt;
  setTimeout(() =&amp;gt; console.log(i), 1);&lt;br&gt;
}&lt;/p&gt;

&lt;p&gt;A: 0 1 2 and 0 1 2&lt;br&gt;
B: 0 1 2 and 3 3 3&lt;br&gt;
C: 3 3 3 and 0 1 2&lt;/p&gt;

&lt;p&gt;Answer: C&lt;br&gt;
Because of the event queue in JavaScript, the setTimeout callback function is called after the loop has been executed. Since the variable i in the first loop was declared using the var keyword, this value was global. During the loop, we incremented the value of i by 1 each time, using the unary operator ++. By the time the setTimeout callback function was invoked, i was equal to 3 in the first example.&lt;/p&gt;

&lt;p&gt;In the second loop, the variable i was declared using the let keyword: variables declared with the let (and const) keyword are block-scoped (a block is anything between { }). During each iteration, i will have a new value, and each value is scoped inside the loop.&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>beginners</category>
      <category>intermediate</category>
    </item>
    <item>
      <title>Javascript variables and data types</title>
      <dc:creator>Esraa Refaat</dc:creator>
      <pubDate>Mon, 21 Jun 2021 02:54:19 +0000</pubDate>
      <link>https://forem.com/esraarefaat/javascript-variables-and-data-types-1pbh</link>
      <guid>https://forem.com/esraarefaat/javascript-variables-and-data-types-1pbh</guid>
      <description>&lt;p&gt;Variable: containers that hold values&lt;br&gt;
var x = 10 ;&lt;br&gt;
var x is variable &lt;br&gt;
10 is value&lt;br&gt;
variable is loosely typed&lt;br&gt;
Js data types are :&lt;br&gt;
1-undefined&lt;br&gt;
2-number&lt;br&gt;
3-string&lt;br&gt;
4-boolean&lt;br&gt;
5-null&lt;br&gt;
Any variable has undefined data type as initial value until you assign value to it &lt;/p&gt;

&lt;p&gt;You can know the type of the variable by using typeof&lt;br&gt;
console.log(typeof x)&lt;/p&gt;

</description>
      <category>beginners</category>
      <category>javascript</category>
    </item>
  </channel>
</rss>
