<?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: chayan999</title>
    <description>The latest articles on DEV Community by chayan999 (@chayan).</description>
    <link>https://dev.to/chayan</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%2F626392%2Fb6449495-2d44-4481-8c87-71b21b4931f3.png</url>
      <title>DEV Community: chayan999</title>
      <link>https://dev.to/chayan</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/chayan"/>
    <language>en</language>
    <item>
      <title>Top 11 things you should be know about  JavaScript</title>
      <dc:creator>chayan999</dc:creator>
      <pubDate>Tue, 11 May 2021 06:43:46 +0000</pubDate>
      <link>https://dev.to/chayan/top-11-things-you-should-be-know-about-javascript-1ei2</link>
      <guid>https://dev.to/chayan/top-11-things-you-should-be-know-about-javascript-1ei2</guid>
      <description>&lt;h2&gt;
  
  
  1.null vs undefined
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;undefined&lt;/strong&gt;&lt;br&gt;
&lt;code&gt;undefined&lt;/code&gt; means, value of the variable is not defined. JavaScript has a global variable undefined whose value is "undefined" and &lt;code&gt;typeof undefined&lt;/code&gt; is also "undefined". Remember, undefined is not a constant or a keyword. undefined is a type with exactly one value: undefined. Assigning a new value to it does not change the value of the type undefined.&lt;br&gt;
&lt;strong&gt;8 Ways to get Undefined:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A declared variable without assigning any value to it.&lt;/li&gt;
&lt;li&gt;Implicit returns of functions due to missing return statements.&lt;/li&gt;
&lt;li&gt;Return statements that do not explicitly return anything.&lt;/li&gt;
&lt;li&gt;Lookups of non-existent properties in an object.&lt;/li&gt;
&lt;li&gt;Function parameters that have not passed.&lt;/li&gt;
&lt;li&gt;Anything that has been set to the value of undefined.&lt;/li&gt;
&lt;li&gt;Any expression in the form of void(expression)&lt;/li&gt;
&lt;li&gt;The value of the global variable undefined&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;null&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;null&lt;/code&gt; means empty or non-existent value which is used by programmers to indicate “no value”. null is a primitive value and you can assign null to any variable. null is not an object, it is a primitive value. For example, you cannot add properties to it. Sometimes people wrongly assume that it is an object, because typeof null returns "object".&lt;/p&gt;
&lt;h2&gt;
  
  
  2.== Vs ===
&lt;/h2&gt;

&lt;p&gt;The simplest way of saying that, &lt;code&gt;==&lt;/code&gt; will not check types and &lt;code&gt;===&lt;/code&gt; will check whether both sides are of same type. So, &lt;code&gt;==&lt;/code&gt; pe to have both in same type and then do the comparison.&lt;br&gt;
&lt;code&gt;===&lt;/code&gt; compares the types and values. Hence, if both sides are not same type, answer is always false. For example, if you are comparing two strings, they must have identical character sets. For other primitives (number, boolean) must share the same value.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Rule for implicit coercion:&lt;/strong&gt; Comparison by using &lt;code&gt;==&lt;/code&gt; does implicit type conversion under the hood. And rules for implicit coercion are as follows-&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;If both operands are same type use &lt;code&gt;===&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;undefined &lt;code&gt;==&lt;/code&gt; null&lt;/li&gt;
&lt;li&gt;If one operands is string another is number, convert string to number&lt;/li&gt;
&lt;li&gt;If one is boolean and another is non-boolean, convert boolean to number and then perform comparison&lt;/li&gt;
&lt;li&gt;While comparing a string or number to an object, try to convert the object to a primitive type and then try some to compare&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;
  
  
  3.True False
&lt;/h2&gt;

&lt;p&gt;now I will discuss about which  are  true or false&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;'False&lt;/code&gt;' It is true  Because, it's a string. Only empty string is false&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;' '&lt;/code&gt; is true Because, it's not an empty string. There is a white space in it.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;{}&lt;/code&gt; is true. It's an object. An object without any property is an object will be true.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;[]&lt;/code&gt;This is also truthy. It's an array object (array is child of object) is truthy.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;''&lt;/code&gt; Only string are also false &lt;/li&gt;
&lt;li&gt;If any variable value Represent undefined value.  then this undefine its also false&lt;/li&gt;
&lt;li&gt;All Integer Value will be true but 0 is false.&lt;/li&gt;
&lt;li&gt;If any variable will be  undefine  by default this value will be false. &lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;
  
  
  4.This
&lt;/h2&gt;

&lt;p&gt;At the time of execution of every function, JavaScript sets a property to the function called this which refer to the current execution context. this is always refer to an object and depends on how function is called. There are different cases where the value of this changing.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;In the global context or inside a function this refers to the window object.&lt;/li&gt;
&lt;li&gt;While executing a function in the context of an object, the object becomes the value of this&lt;/li&gt;
&lt;li&gt;Inside a setTimeout function, the value of this is the window object.&lt;/li&gt;
&lt;li&gt;If you use a constructor (by using new keyword) to create an object, the value of this will refer to the newly created object.&lt;/li&gt;
&lt;li&gt;You can set the value of this to any arbitrary object by passing the object as the first parameter of bind, call or apply&lt;/li&gt;
&lt;li&gt;For dom event handler, value of this would be the element that fired the event&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;
  
  
  5. Scope
&lt;/h2&gt;

&lt;p&gt;Scope  is the accessibility of variables, functions, and objects in some particular part of your code during runtime. In other words, scope determines the visibility of variables and other resources in areas of your code.&lt;br&gt;
In the JavaScript language there are two types of scopes:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Global Scope&lt;/li&gt;
&lt;li&gt;Local Scope&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;
  
  
  6.Global Scope
&lt;/h2&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// the scope is by default global
var name = 'Chayan';
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;Variables inside the Global scope can be accessed and altered in any other scope.&lt;br&gt;
&lt;/p&gt;

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

console.log(name); // logs Chayan

function logName() {
    console.log(name); // 'name' is accessible here and everywhere else
}

logName(); // logs Chayan
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  7.Local Scope
&lt;/h2&gt;

&lt;p&gt;Variables defined inside a function are in the local scope. And they have a different scope for every call of that function. This means that variables having the same name can be used in different functions. This is because those variables are bound to their respective functions, each having different scopes, and are not accessible in other functions.&lt;/p&gt;

&lt;h2&gt;
  
  
  8.Block Scope
&lt;/h2&gt;

&lt;p&gt;Block statements like if and switch conditions or for and while loops, unlike functions, don't create a new scope. Variables defined inside of a block statement will remain in the scope they were already in.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;if (true) {
    // this 'if' conditional block doesn't create a new scope
    var name = Chayan; // name is still in the global scope
}

console.log(name); // logs Chanyan
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  9.Difference between bind, call and apply
&lt;/h2&gt;

&lt;p&gt;The major cause of confusion between the call() and apply() methods is how to pass in the additional arguments besides this. And why do we have bind() anyway?&lt;br&gt;
So let’s learn how to easily tell the three apart.&lt;br&gt;
&lt;strong&gt;Apply()&lt;/strong&gt;&lt;br&gt;
&lt;code&gt;apply(this [, [arg1, arg2,...]])&lt;/code&gt;: Calls a function with a provided this value. Further arguments are provided as a single array.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Way to remember:&lt;/strong&gt; “Apply accepts arguments as an Array” or “AA”&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;strong&gt;Call()&lt;/strong&gt;&lt;br&gt;
&lt;code&gt;call(this [, arg1, arg2...])&lt;/code&gt;: Calls a function with a provided this. Further arguments are provided as a comma separated list&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Ways to remember:&lt;/strong&gt; “Call’s arguments are separated by commas” or “CC”.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;strong&gt;Bind()&lt;/strong&gt;&lt;br&gt;
&lt;code&gt;bind(this)&lt;/code&gt;: Returns a new function whose this value is bound to the provided value.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Ways to remember:&lt;/strong&gt; bind() is the only method out of the three that returns a new function altogether. It does not call the function.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h2&gt;
  
  
  10.JavaScript Closure
&lt;/h2&gt;

&lt;p&gt;Closure is one of important concept in JavaScript. It is widely discussed and still confused concept. Let's understand what the closure is.&lt;br&gt;
Closure means that an inner function always has access to the vars and parameters of its outer function, even after the outer function has returned. Inner function can access variables and parameters of an outer function. Consider the following example.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;function OuterFunction() { 
var outerVariable = 1;
 function InnerFunction() { 
alert(outerVariable); 
} 
InnerFunction();
 }
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In the example, InnerFunction() can access outerVariable.&lt;br&gt;
Now, as per the definition above, InnerFunction() can access outerVariable even if it will be executed separately. Consider the following example.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt; function OuterFunction() {
 var outerVariable = 100;
 function InnerFunction() {
 alert(outerVariable);
 }
 return InnerFunction;
 }
 var innerFunc = OuterFunction(); 
innerFunc(); // 100
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In the above example, &lt;code&gt;return InnerFunction;&lt;/code&gt; returns InnerFunction from OuterFunction when you call OuterFunction(). A variable &lt;code&gt;innerFunc&lt;/code&gt; reference the InnerFunction() only, not the OuterFunction(). So now, when you call innerFunc(), it can still access &lt;code&gt;outerVariable&lt;/code&gt; which is declared in OuterFunction(). This is called Closure.&lt;/p&gt;

&lt;h2&gt;
  
  
  11.Encapsulation
&lt;/h2&gt;

&lt;p&gt;Encapsulation means information hiding. It’s about hiding as much as possible of the object’s internal parts and exposing a minimal public interface.&lt;br&gt;
The simplest and most elegant way to create encapsulation in JavaScript is using closures. A closure can be created as a function with private state. When creating many closures sharing the same private state, we create an object.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Top  tips and tricks about react 
</title>
      <dc:creator>chayan999</dc:creator>
      <pubDate>Sun, 09 May 2021 19:35:22 +0000</pubDate>
      <link>https://dev.to/chayan/top-tips-and-tricks-about-react-11pe</link>
      <guid>https://dev.to/chayan/top-tips-and-tricks-about-react-11pe</guid>
      <description>&lt;h2&gt;
  
  
  React Hooks
&lt;/h2&gt;

&lt;p&gt;Hooks are the new feature introduced in the React 16.8 version. It allows you to use state and other React features without writing a class. Hooks are the functions which "hook into" React state and lifecycle features from function components. It does not work inside classes.&lt;br&gt;
Hooks are backward-compatible, which means it does not contain any breaking changes. Also, it does not replace your knowledge of React concepts.&lt;/p&gt;
&lt;h2&gt;
  
  
  When to use a Hooks
&lt;/h2&gt;

&lt;p&gt;If you write a function component, and then you want to add some state to it, previously you do this by converting it to a class. But, now you can do it by using a Hook inside the existing function component.&lt;br&gt;
If you write a function component, and then you want to add some state to it, previously you do this by converting it to a class. But, now you can do it by using a Hook inside the existing function component.&lt;/p&gt;
&lt;h2&gt;
  
  
  Rules of Hooks
&lt;/h2&gt;

&lt;p&gt;Hooks are similar to JavaScript functions, but you need to follow these two rules when using them. Hooks rule ensures that all the stateful logic in a component is visible in its source code. These rules are:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Only call Hooks at the top level
Do not call Hooks inside loops, conditions, or nested functions. Hooks should always be used at the top level of the React functions. This rule ensures that Hooks are called in the same order each time a components renders.&lt;/li&gt;
&lt;li&gt;Only call Hooks from React functions
You cannot call Hooks from regular JavaScript functions. Instead, you can call Hooks from React function components. Hooks can also be called from custom Hooks.
##Hooks State
Hook state is the new way of declaring a state in React app. Hook uses useState() functional component for setting and retrieving state. Let us understand Hook state with the following example.
&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import React, { useState } from 'react';  

function CountApp() {  
// Declare a new state variable, which we'll call "count"  
  const [count, setCount] = useState(0);  

  return (  
    &amp;lt;div&amp;gt;  
      &amp;lt;p&amp;gt;You clicked {count} times&amp;lt;/p&amp;gt;  
      &amp;lt;button onClick={() =&amp;gt; setCount(count + 1)}&amp;gt;  
        Click me  
      &amp;lt;/button&amp;gt;  
    &amp;lt;/div&amp;gt;  
  );  
}  
export default CountApp;  
import React, { useState } from 'react';  

function CountApp() {  
  // Declare a new state variable, which we'll call "count"  
  const [count, setCount] = useState(0);  

  return (  
    &amp;lt;div&amp;gt;  
      &amp;lt;p&amp;gt;You clicked {count} times&amp;lt;/p&amp;gt;  
      &amp;lt;button onClick={() =&amp;gt; setCount(count + 1)}&amp;gt;  
        Click me  
      &amp;lt;/button&amp;gt;  
    &amp;lt;/div&amp;gt;  
  );  
}  
export default CountApp;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;h2&gt;
  
  
  Hooks Effect
&lt;/h2&gt;

&lt;p&gt;The Effect Hook allows us to perform side effects (an action) in the function components. It does not use components lifecycle methods which are available in class components. In other words, Effects Hooks are equivalent to componentDidMount(), componentDidUpdate(), and componentWillUnmount() lifecycle methods.&lt;br&gt;
Side effects have common features which the most web applications need to perform, such as:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Updating the DOM,&lt;/li&gt;
&lt;li&gt;Fetching and consuming data from a server API,&lt;/li&gt;
&lt;li&gt;Setting up a subscription, etc.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;
  
  
  JavaScript DOM Nodes
&lt;/h2&gt;

&lt;p&gt;The Document Object Model, or DOM for short, is a platform and language independent model to represent the HTML or XML documents. It defines the logical structure of the documents and the way in which they can be accessed and manipulated by an application program.&lt;br&gt;
In the DOM, all parts of the document, such as elements, attributes, text, etc. are organized in a hierarchical tree-like structure; similar to a family tree in real life that consists of parents and children. In DOM terminology these individual parts of the document are known as nodes.&lt;br&gt;
The Document Object Model that represents HTML document is referred to as HTML DOM. Similarly, the DOM that represents the XML document is referred to as XML DOM.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Tip: The Document Object Model or DOM is, in fact, basically a representation of the various components of the browser and the current Web document (HTML or XML) that can be accessed or manipulated using a scripting language such as JavaScript.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h2&gt;
  
  
  Using Default Props
&lt;/h2&gt;

&lt;p&gt;React supports the notion of defaultProps which you can think of as default function arguments. When you create an element and you did not include a prop with a default then React will substitute that prop with its corresponding value from defaultProps. Flow supports this notion as well. To type default props add a static defaultProps property to your class.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;class Button extends React.Component {
  // ...
}

Button.defaultProps = {
  color: 'red'
};
If props.color is not provided, it will be set by default to 'red':
render() {
    return &amp;lt;Button /&amp;gt; ; // props.color will be set to red
  }
If props.color is set to null, it will remain null:
 render() {
    return &amp;lt;Button color={null} /&amp;gt; ; // props.color will remain null
  }
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Optimizing Performance
&lt;/h2&gt;

&lt;p&gt;Performance is an important aspect when building webpages and applications. You need to understand how long your users interact with your app, how often they leave, and the response time as well.&lt;br&gt;
The first 10 seconds are vital to determine if a user will leave or continue interacting with your web pages. You must clearly speed up the page, bring value within these 10 seconds, and get the user’s attention to spend more time on your page.&lt;br&gt;
This is where optimizing your page and speeding up the response time becomes important to maintain a good user experience. Node.js is known to produce super-fast performing and scalable web applications. Node.js uses event-driven architecture and non-blocking (asynchronous) tasks that run on a single thread. &lt;/p&gt;

&lt;p&gt;now I will highlight some point about optimising performance&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Asynchronous&lt;/li&gt;
&lt;li&gt;Synchronous&lt;/li&gt;
&lt;li&gt;Query Optimization&lt;/li&gt;
&lt;li&gt;Caching&lt;/li&gt;
&lt;li&gt;Go Session Free&lt;/li&gt;
&lt;li&gt;Script Tracing and Logging&lt;/li&gt;
&lt;li&gt;Client-side Rendering&lt;/li&gt;
&lt;li&gt;Avoid Memory Leaks&lt;/li&gt;
&lt;li&gt;Keeping your Code Light and Compact
## State Management
One of the biggest and most common problems in is state management. like me are constantly focused on keeping the state object in sync with its view and the DOM representation. Users can interact with the application in many ways and it’s a big task to provide a clean transition from one state to another.
State exists in every application, even those made with plain JavaScript. It's not a concept specific to JS libraries; it's necessary to understand for any app you intend to make. Libraries use this concept of state within your applications for your own benefit.
## React’s tree reconciliation
Reconciliation is the process through which React updates the DOM. When a component’s state changes, React has to calculate if it is necessary to update the DOM. It does this by creating a virtual DOM and comparing it with the current DOM. In this context, the virtual DOM will contain the new state of the component.
Let’s build a simple component that adds two numbers. The numbers will be entered in an input field.
&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;class App extends React.Component {

  state = {
    result: '',
    entry1: '',
    entry2: ''
  }

  handleEntry1 = (event) =&amp;gt; {
    this.setState({entry1: event.target.value})
  }

    handleEntry2 = (event) =&amp;gt; {
    this.setState({entry2: event.target.value})
  }

  handleAddition = (event) =&amp;gt; {
    const firstInt = parseInt(this.state.entry1)
    const secondInt = parseInt(this.state.entry2)
    this.setState({result: firstInt + secondInt })
  }

  render() {
    const { entry1, entry2, result } = this.state
    return(
 &amp;lt;div&amp;gt;  
        &amp;lt;div&amp;gt;
          Result: { result }
        &amp;lt;/div&amp;gt;
        &amp;lt;span&amp;gt;&amp;lt;input type='text' onChange={this.handleEntry1} /&amp;gt;&amp;lt;/span&amp;gt;
        &amp;lt;br /&amp;gt;
        &amp;lt;br /&amp;gt;
        &amp;lt;span&amp;gt;&amp;lt;input type='text' onChange={this.handleEntry2} /&amp;gt;&amp;lt;/span&amp;gt;
        &amp;lt;div&amp;gt;
          &amp;lt;button onClick={this.handleAddition} type='submit'&amp;gt;Add&amp;lt;/button&amp;gt;
        &amp;lt;/div&amp;gt;
      &amp;lt;/div&amp;gt;
    )
  }
}

ReactDOM.render(&amp;lt;App /&amp;gt;, document.getElementById("root"));
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;First, we’ll need to set up the initial state for the fields, then update the state when a number is entered. The component will look 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;render() {
    const { entry1, entry2, result } = this.state
    return(
      &amp;lt;div&amp;gt;  
        &amp;lt;div&amp;gt;
          &amp;lt;p&amp;gt;Entry 1: { entry1 }&amp;lt;/p&amp;gt;
          &amp;lt;p&amp;gt;Entry 2: { entry2 }&amp;lt;/p&amp;gt;
          &amp;lt;p&amp;gt;Result: { result }&amp;lt;/p&amp;gt;
        &amp;lt;/div&amp;gt;
        &amp;lt;br /&amp;gt;
        &amp;lt;div&amp;gt;
          &amp;lt;span&amp;gt;Entry 1: &amp;lt;/span&amp;gt;
          &amp;lt;input type='text' onChange={this.handleEntry1} /&amp;gt;
        &amp;lt;/div&amp;gt;
        &amp;lt;br /&amp;gt;
        &amp;lt;div&amp;gt;
          &amp;lt;span&amp;gt;Entry 2: &amp;lt;/span&amp;gt;
  &amp;lt;input type='text' onChange={this.handleEntry2} /&amp;gt;
        &amp;lt;/div&amp;gt;lass App extends React.Component {

  state = {
    result: '',
    entry1: '',
    entry2: ''
  }

  handleEntry1 = (event) =&amp;gt; {
    this.setState({entry1: event.target.value})
  }

  handleEntry2 = (event) =&amp;gt; {
    this.setState({entry2: event.target.value})
  }

  handleAddition = (event) =&amp;gt; {
    const firstInt = parseInt(this.state.entry1)
    const secondInt = parseInt(this.state.entry2)
    this.setState({result: firstInt + secondInt })
  }

        &amp;lt;div&amp;gt;
          &amp;lt;button onClick={this.handleAddition} type='submit'&amp;gt;Add&amp;lt;/button&amp;gt;
        &amp;lt;/div&amp;gt;
      &amp;lt;/div&amp;gt;
    )
  }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;When an entry is made in the first input field, React creates a new tree. The new tree which is the virtual DOM will contain the new state for entry1. Then, React compares the virtual DOM with the old DOM and, from the comparison, it figures out the difference between both DOMs and makes an update to only the part that is different. A new tree is created each time the state of App component changes — when a value is entered in either of the inputs field, or when the button is clicked.&lt;/p&gt;

&lt;h2&gt;
  
  
  ReactDOM.render
&lt;/h2&gt;

&lt;p&gt;The render method can be called the primary gateway between React and the DOM.&lt;br&gt;
Let’s say you have defined a React element (), as well as a DOM node to act as a container for that element (div with the ID of “container”). Now, you can use ReactDOM.render to render the element within that container using the syntax given below:&lt;br&gt;
&lt;code&gt;ReactDOM.render(&amp;lt;Calculator /&amp;gt;, document.querySelector("#container"))&lt;br&gt;
&lt;/code&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;🔹 Note: If the Calculator component has already been mounted in the div element, calling this again will simply update the DOM based on the difference between the components.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;strong&gt;Parameters:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;React element&lt;/li&gt;
&lt;li&gt;Selected DOM Node&lt;/li&gt;
&lt;li&gt;Callback function (optional)&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; ReactDOM.render requires a React element as the first argument. React elements are generated through React.createElement. Therefore, you may use that syntax or simply invoke a JSX interpretation of the component to get the parameters in the correct format for the arguments. Using React.createElement, our code can be modified to look like this:&lt;br&gt;
&lt;code&gt;ReactDOM.render(React.createElement(Calculator), document.querySelector("#container"))&lt;br&gt;
&lt;/code&gt;&lt;/p&gt;
&lt;/blockquote&gt;

</description>
    </item>
    <item>
      <title>10 think about JavaScript you should be know</title>
      <dc:creator>chayan999</dc:creator>
      <pubDate>Sat, 08 May 2021 14:18:46 +0000</pubDate>
      <link>https://dev.to/chayan/10-think-about-javascript-you-should-be-know-47b6</link>
      <guid>https://dev.to/chayan/10-think-about-javascript-you-should-be-know-47b6</guid>
      <description>&lt;p&gt;Hello programmer's today   I will discuss   about 10 things  that are needed in your daily programming. So let's go talked about that.&lt;br&gt;
 &lt;strong&gt;Error handling&lt;/strong&gt;&lt;br&gt;
  Error is  part of programming life.   Sometimes  we are going to board and upsert for this error.&lt;br&gt;
Now I will share with you how to  handle JavaScript  errors.&lt;br&gt;
Error handling, "try...catch"&lt;br&gt;
A try / catch block is basically used to handle errors in JavaScript. You use this when you don't want an error in your script to break your code.&lt;br&gt;
While this might look like something you can easily do with an if statement, try/catch gives you a lot of benefits beyond what an if/else statement can do, some of which you will see below.&lt;br&gt;
try{&lt;br&gt;
&lt;code&gt;//...&lt;br&gt;
}catch(e){&lt;br&gt;
//...&lt;br&gt;
}&lt;/code&gt;&lt;br&gt;
A try statement lets you test a block of code for errors.&lt;br&gt;
A catch statement lets you handle that error. For example:&lt;br&gt;
&lt;code&gt;try{ &lt;br&gt;
getData() // getData is not defined &lt;br&gt;
}catch(error){&lt;br&gt;
alert(error)&lt;br&gt;
}&lt;/code&gt;&lt;br&gt;
This is basically how a try/catch works. You put your code in the try block, and see if there is an error, JavaScript gives the catch statement control and it just does whatever you say. In this case, it alerts you to the error.&lt;br&gt;
After you coding you get any error, try these things.  It will help you.Code quality&lt;br&gt;
Code quality e is an important thing in programming life. You write a  code in a project.  in the future   rewrite the   code by other developers. If they do not understand what you are coding  . It will be very uncomfortable to them.&lt;br&gt;
Now I will is talked about how to you maintain your  code quality. &lt;br&gt;
Block scored declarations&lt;br&gt;
Since the inception of the language, JavaScript developers have used &lt;code&gt;var&lt;/code&gt; to declare variables. The keyword var has its quirks, the most problematic of those being the scope of the variables created by using it.&lt;br&gt;
&lt;code&gt;var x = 10&lt;br&gt;
if (true) {&lt;br&gt;
  var x = 15     // inner declaration overrides declaration in parent scope&lt;br&gt;
  console.log(x) // prints 15&lt;br&gt;
}&lt;br&gt;
console.log(x)   // prints 15&lt;/code&gt;&lt;br&gt;
Since variables defined with var are not block-scoped, redefining them in a narrower scope affects the value of the outer scope.&lt;br&gt;
Arrow functions&lt;br&gt;
Arrow functions are another very important feature introduced recently to JavaScript. They come bearing many advantages. First and foremost, they make the functional aspects of JavaScript beautiful to look at and simpler to write.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;let x = [1, 2, 3, 4]&lt;br&gt;
x.map(val =&amp;gt; val * 2)                // [2, 4, 6, 8]&lt;br&gt;
x.filter(val =&amp;gt; val % 2 == 0)        // [2, 4]&lt;br&gt;
x.reduce((acc, val) =&amp;gt; acc + val, 0) // 10&lt;/code&gt;&lt;br&gt;
In all of the above examples the arrow functions, named after the distinctive arrow =&amp;gt;, replace traditional functions with a concise syntax.&lt;br&gt;
 Optional chaining&lt;br&gt;
Imagine a deeply nested data structure like this person object here. Consider you wanted to access the first and last name of this person. You would write this in JavaScript like so:&lt;br&gt;
&lt;code&gt;person = {&lt;br&gt;
  name: {&lt;br&gt;
    first: 'Jony',&lt;br&gt;
    last: 'Day',&lt;br&gt;
  },&lt;br&gt;
  age: 42&lt;br&gt;
}&lt;br&gt;
person.name.first // Jony&lt;br&gt;
person.name.last  // Day&lt;/code&gt;&lt;br&gt;
&lt;strong&gt;Null-ish coalescing&lt;/strong&gt;&lt;br&gt;
Before introducing the null-ish coalescing operator, JavaScript developers used the OR operator || to fall back to a default value if the input was absent. This came with a significant caveat that even legitimate but falsy values would result in a fallback to the defaults.&lt;br&gt;
&lt;code&gt;function print(val) {&lt;br&gt;
    return val ?? 'Missing'&lt;br&gt;
}&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;print(undefined) // 'Missing'&lt;/code&gt;&lt;br&gt;
&lt;code&gt;print(null)      // 'Missing'&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;print(0)         // 0&lt;/code&gt;&lt;br&gt;
&lt;code&gt;print('')        // ''&lt;/code&gt;&lt;br&gt;
&lt;code&gt;print(false)     // false&lt;/code&gt;&lt;br&gt;
&lt;code&gt;print(NaN)       // NaN&lt;/code&gt;&lt;br&gt;
&lt;strong&gt;Logical assignment&lt;/strong&gt;&lt;br&gt;
Let’s say you want to assign a value to a variable if and only if the value is currently null-ish. A logical way to write this would be like so:&lt;br&gt;
&lt;code&gt;if (x === null || x == undefined) {&lt;br&gt;
    x = y&lt;br&gt;
}&lt;/code&gt;&lt;br&gt;
If you knew about how short-circuiting works, you might want to replace those 3 lines of code with a more succinct version using the null-ish coalescing operator.&lt;br&gt;
&lt;code&gt;x ?? (x = y) // x = y if x is nullish, else no effect&lt;/code&gt;&lt;br&gt;
&lt;strong&gt;Coding Style&lt;/strong&gt;&lt;br&gt;
&lt;strong&gt;Naming&lt;/strong&gt;&lt;br&gt;
Use camelCase for object keys (i.e. "selectors").&lt;br&gt;
Why? We access these keys as properties on the styles object in the component, so it is most convenient to use camelCase.&lt;br&gt;
&lt;code&gt;// bad&lt;br&gt;
{&lt;br&gt;
  'bangladesh-district': {&lt;br&gt;
    display: 'none',&lt;br&gt;
  },&lt;br&gt;
}&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;// good&lt;br&gt;
{&lt;br&gt;
  bangladeshDistrict: {&lt;br&gt;
    display: 'none',&lt;br&gt;
  },&lt;br&gt;
}&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Ordering&lt;/strong&gt;&lt;br&gt;
Define styles after the component.&lt;br&gt;
We use a higher-order component to theme our styles, which is naturally used after the component definition. Passing the styles object directly to this function reduces indirection.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;// bad&lt;br&gt;
const styles = {&lt;br&gt;
  container: {&lt;br&gt;
    display: 'inline-block',&lt;br&gt;
  },&lt;br&gt;
};&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;function MyComponent({ styles }) {&lt;br&gt;
return (&lt;br&gt;
    &amp;lt;div {...css(styles.container)}&amp;gt;&lt;br&gt;
      Never doubt that a small group of thoughtful, committed citizens can&lt;br&gt;
      change the world. Indeed, it’s the only thing that ever has.&lt;br&gt;
    &amp;lt;/div&amp;gt;&lt;br&gt;
  );&lt;br&gt;
}&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;export default withStyles(() =&amp;gt; styles)(MyComponent);&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;// good&lt;br&gt;
function MyComponent({ styles }) {&lt;br&gt;
  return (&lt;br&gt;
    &amp;lt;div {...css(styles.container)}&amp;gt;&lt;br&gt;
      Never doubt that a small group of thoughtful, committed citizens can&lt;br&gt;
      change the world. Indeed, it’s the only thing that ever has.&lt;br&gt;
    &amp;lt;/div&amp;gt;&lt;br&gt;
  );&lt;br&gt;
}&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;export default withStyles(() =&amp;gt; ({&lt;br&gt;
  container: {&lt;br&gt;
    display: 'inline-block',&lt;br&gt;
  },&lt;br&gt;
}))(MyComponent);&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Nesting&lt;/strong&gt;&lt;br&gt;
Leave a blank line between adjacent blocks at the same indentation level.&lt;br&gt;
&lt;code&gt;// bad&lt;/code&gt;&lt;br&gt;
&lt;code&gt;{&lt;br&gt;
  bigBang: {&lt;br&gt;
    display: 'inline-block',&lt;br&gt;
    '::before': {&lt;br&gt;
      content: "''",&lt;br&gt;
    },&lt;br&gt;
  },&lt;br&gt;
  universe: {&lt;br&gt;
    border: 'none',&lt;br&gt;
  },&lt;br&gt;
}&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;`// good&lt;br&gt;
{&lt;br&gt;
  bigBang: {&lt;br&gt;
    display: 'inline-block',&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;'::before': {
  content: "''",
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;},&lt;br&gt;
  },`&lt;/p&gt;

&lt;p&gt;&lt;code&gt;universe: {&lt;br&gt;
    border: 'none',&lt;br&gt;
  },&lt;br&gt;
}&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Inline&lt;/strong&gt;&lt;br&gt;
Use inline styles for styles that have a high cardinality (e.g. uses the value of a prop) and not for styles that have a low cardinality.&lt;br&gt;
Generating themed stylesheets can be expensive, so they are best for discrete sets of styles.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;// bad&lt;br&gt;
export default function MyComponent({ spacing }) {&lt;br&gt;
  return (&lt;br&gt;
    &amp;lt;div style={{ display: 'table', margin: spacing }} /&amp;gt;&lt;br&gt;
  );&lt;br&gt;
}&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;// good&lt;br&gt;
function MyComponent({ styles, spacing }) {&lt;br&gt;
  return (&lt;br&gt;
    &amp;lt;div {...css(styles.periodic, { margin: spacing })} /&amp;gt;&lt;br&gt;
  );&lt;br&gt;
}&lt;/code&gt;&lt;br&gt;
&lt;code&gt;export default withStyles(() =&amp;gt; ({&lt;br&gt;
  periodic: {&lt;br&gt;
    display: 'table',&lt;br&gt;
  },&lt;br&gt;
}))(MyComponent);&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Comments&lt;/strong&gt;&lt;br&gt;
Have you ever written a script or a program in the past only to look at it six months later with no idea what's going on in the code? You probably forgot to do what all programmers tend to forget to do: write comments!&lt;br&gt;
When writing code you may have some complex logic that is confusing, this is a perfect opportunity to include some comments in the code that will explain what is going on. Not only will this help you remember it later on, but if you someone else views your code, they will also be able to understand the code (hopefully)!&lt;br&gt;
Another great thing about comments is the ability for comments to remove bits of code from execution when you are debugging your scripts. This lesson will teach you how to create two types of comments in JavaScript: single line comments and multi-line comments.&lt;br&gt;
&lt;strong&gt;creating single line comments&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;// This is a single line JavaScript comment&lt;br&gt;
//document.write("You can't see this!");&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;creating multi-line comments&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;&amp;lt;!--&lt;br&gt;
document.write("I have multi-line comments!");&lt;br&gt;
/*document.write("You can't see this!");&lt;br&gt;
document.write("You can't see this!");&lt;br&gt;
document.write("You can't see this!");&lt;br&gt;
document.write("You can't see this!");&lt;br&gt;
document.write("You can't see this!");&lt;br&gt;
document.write("You can't see this!");&lt;br&gt;
document.write("You can't see this!");*/&lt;br&gt;
//--&amp;gt;&lt;/code&gt;&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Top 10 basic things about JavaScript</title>
      <dc:creator>chayan999</dc:creator>
      <pubDate>Thu, 06 May 2021 15:00:50 +0000</pubDate>
      <link>https://dev.to/chayan/top-10-basic-things-about-javascript-5hgl</link>
      <guid>https://dev.to/chayan/top-10-basic-things-about-javascript-5hgl</guid>
      <description>&lt;p&gt;1.Variables&lt;br&gt;
Top 10 basic things about JavaScript&lt;br&gt;
JavaScript is declared using three keywords for variables.&lt;br&gt;
 they are let, const, or var.&lt;br&gt;
let/var&lt;br&gt;
The let keyword is used to declare variables in JavaScript. The var keyword can also be used to declare variables, but the key difference between them lies in their scopes. var is function scoped while let is block scoped&lt;br&gt;
Consider the example below:&lt;br&gt;
var&lt;br&gt;
function func() {&lt;br&gt;
  // a is known here but not defined.&lt;br&gt;
  console.log('value of x here: ', x)&lt;br&gt;
  {&lt;br&gt;
    var a = 10;&lt;br&gt;
    a = a + 5;&lt;br&gt;
  }&lt;br&gt;
  // a is still known here and has a value.&lt;br&gt;
  console.log('value of x after for block: ', x)&lt;br&gt;
}&lt;br&gt;
// a is NOT known here.&lt;br&gt;
func()&lt;br&gt;
let &lt;br&gt;
let apple = "yellow"&lt;/p&gt;

&lt;p&gt;if (apple === "yellow"){&lt;br&gt;
  let apple = "red"&lt;br&gt;
  console.log(apple)&lt;br&gt;
}&lt;br&gt;
console.log(apple)&lt;br&gt;
Using let&lt;/p&gt;

&lt;p&gt;apple is declared as "yellow" and redeclared as "blue" . Inside the if block. However, as the output shows, the apple declared inside the if block has scope within that block only. Outside this block, the original apple variable set to "yellow" is available.&lt;/p&gt;

&lt;p&gt;Using var&lt;br&gt;
Conversely, in the code that uses var, redeclaration of apple to "bred" inside the if block, also changes the apple declared  to "red". This is because variables declared with var are defined globally, regardless of block scope.&lt;/p&gt;

&lt;p&gt;2.Operators&lt;br&gt;
 +, -, *, / and % In JavaScript this symbol is no is operator.  It has a unique Work function.  In general this operator work function  is similar to general math.   In some cases  this operator places different roles. &lt;br&gt;
You can use ++ and -- to increment and decrement respectively. These can be used as a prefix or postfix operators.&lt;br&gt;
The + operator also does string concatenation:&lt;br&gt;
'hello' + ' world'; // "hello world"&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Multiply two numeric operands.
/ Divide left operand by right operand.
% Modulus operator. Returns remainder of two operands.
++ Increment operator. Increase operand value by one.
-- Decrement operator. Decrease value by one.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;JavaScript also have Comparison Operators&lt;br&gt;
Example&lt;br&gt;
== Compares the equality of two operands without considering type.&lt;br&gt;
=== compares equality of two operands with type.&lt;br&gt;
 != Compares inequality of two operands.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Checks whether left side value is greater than right side value. If yes then returns true otherwise false.&lt;br&gt;
&amp;lt; hecks whether left operand is less than right operand. If yes then returns true otherwise false.&lt;br&gt;
= Checks whether left operand is greater than or equal to right operand. If yes then returns true otherwise false.&lt;br&gt;
&amp;lt;= Checks whether left operand is less than or equal to right operand. If yes then returns true otherwise false.&lt;br&gt;
3.Objects&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Object is a non-primitive data type in JavaScript. It is like any other variable, the only difference is that an object holds multiple values in terms of properties and methods. Properties can hold values of primitive data types and methods are functions.&lt;br&gt;
In JavaScript, an object is a standalone entity because there is no class in JavaScript. However, you can achieve class like functionality using functions. We will learn how to treat a function as a class in the advance JavaScript section.&lt;br&gt;
In JavaScript, an object can be created in two ways:&lt;br&gt;
Object literal&lt;br&gt;
Object constructor&lt;/p&gt;

&lt;p&gt;Object literal&lt;br&gt;
The object literal is a simple way of creating an object using { } brackets. You can include key-value pair in { }, where key would be property or method name and value will be value of property of any data type or a function. Use comma (,) to separate multiple key-value pairs.&lt;br&gt;
var persone= { name: ‘rahul, age: 24, class: 11};&lt;br&gt;
Object Constructor&lt;br&gt;
The second way to create an object is with Object Constructor using new keyword. You can attach properties and methods using dot notation. Optionally, you can also create properties using [ ] brackets and specifying property name as string.&lt;/p&gt;

&lt;p&gt;var person = new Object(); // Attach properties and methods to person object person.firstName = "Rahul"; &lt;br&gt;
person["lastName"] = "Gupta";&lt;br&gt;
 person.age = 25;&lt;/p&gt;

&lt;p&gt;4.Array&lt;br&gt;
An array is a special type of variable, which can store multiple values using special syntax. Every value is associated with numeric index starting with 0. The following figure illustrates how an array stores values.&lt;br&gt;
An array in JavaScript can be defined and initialized in two ways, array literal and Array constructor syntax.&lt;br&gt;
Array Literal&lt;br&gt;
Array literal syntax is simple. It takes a list of values separated by a comma and enclosed in square brackets.&lt;/p&gt;

&lt;p&gt;var  = [Abdur, Kamal, Dayal, Here];&lt;br&gt;
Array Constructor&lt;br&gt;
You can initialize an array with Array constructor syntax using new keyword.&lt;br&gt;
The Array constructor has following three forms.&lt;br&gt;
var arrayName = new Array();&lt;/p&gt;

&lt;p&gt;var arrayName = new Array(Number length);&lt;/p&gt;

&lt;p&gt;var arrayName = new Array(Abdur, Kamal, Dayal, Here);&lt;br&gt;
5.Functions&lt;br&gt;
JavaScript provides functions similar to most of the scripting and programming languages.&lt;br&gt;
In JavaScript, a function allows you to define a block of code, give it a name and then execute it as many times as you want.&lt;br&gt;
A JavaScript function can be defined using function keyword.&lt;br&gt;
The following example shows how to define and call a function in JavaScript.&lt;/p&gt;

&lt;p&gt;function ShowMessage() { &lt;br&gt;
alert("Hello World!"); &lt;br&gt;
} &lt;br&gt;
ShowMessage();&lt;br&gt;
Function Parameters&lt;br&gt;
A function can have one or more parameters, which will be supplied by the calling code and can be used inside a function. You can pass less or more arguments while calling a function. &lt;/p&gt;

&lt;p&gt;function ShowMessage(firstName, lastName) { &lt;br&gt;
alert("Hello " + firstName + " " + lastName); &lt;br&gt;
}&lt;br&gt;
 ShowMessage("Abdur", "Rahman");&lt;br&gt;
 ShowMessage("Jony", "Das");&lt;br&gt;
6.Anonymous Function&lt;br&gt;
JavaScript allows us to define a function without any name. This unnamed function is called anonymous function. Anonymous function must be assigned to a variable.&lt;br&gt;
Example: Anonymous Function&lt;br&gt;
var showMessage = function (){ &lt;br&gt;
alert("Hello World!"); &lt;br&gt;
}; &lt;br&gt;
showMessage(); &lt;br&gt;
var sayHello = function (firstName) {&lt;br&gt;
 alert("Hello " + firstName); &lt;br&gt;
};&lt;br&gt;
 showMessage(); &lt;br&gt;
sayHello("Rana");&lt;br&gt;
7.Recursive functions&lt;br&gt;
JavaScript allows you to call functions recursively. This is particularly useful for dealing with tree structures, such as those found in the browser DOM.&lt;br&gt;
function countChars(element) {&lt;br&gt;
  if (element.nodeType == 3) { // TEXT_NODE&lt;br&gt;
    return elememt.nodeValue.length;&lt;br&gt;
  }&lt;br&gt;
  var count = 0;&lt;br&gt;
  for (var i = 0, child; child = element.childNodes[i]; i++) {&lt;br&gt;
    count += countChars(child);&lt;br&gt;
  }&lt;br&gt;
  return count;&lt;br&gt;
}&lt;/p&gt;

&lt;p&gt;8.indexOf   in Arrays&lt;br&gt;
The indexOf method takes one argument which is the element. Then it returns the index of the first element it finds in the array which satisfies. This means that even if there are two matches in your array, indexOf will only return one result. The result is the first occurrence in the array.&lt;/p&gt;

&lt;p&gt;onst zoo = ['Monkey', 'Horse', 'Dog', 'Bear', 'Fox',  'Dog']; // Skyler just arrived!&lt;br&gt;
const spencersIndex = zoo.indexOf('Dog'); // === 2 same as before&lt;/p&gt;

&lt;p&gt;// We start searching after&lt;br&gt;
const skylersIndex = zoo.indexOf('dog', spencersIndex + 1);&lt;br&gt;
// skylersIndex === 5&lt;/p&gt;

&lt;p&gt;9.Math floor()&lt;br&gt;
In JavaScript, floor() is a function that is used to return the largest integer value that is less than or equal to a number. In other words, the floor() function rounds a number down and returns an integer value. Because the floor() function is a static function of the Math object, it must be invoked through the placeholder object called Math.&lt;br&gt;
Math.floor(number);&lt;br&gt;
console.log(Math.floor(32.65)); // 32&lt;/p&gt;

&lt;p&gt;10.Math ceil()&lt;br&gt;
In JavaScript, ceil() is a function that is used to return the smallest integer value that is greater than or equal to a number. In other words, the ceil() function rounds a number up and returns an integer value. Because the ceil() function is a static function of the Math object, it must be invoked through the placeholder object called Math.&lt;br&gt;
Math.ceil(number);&lt;/p&gt;

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