<?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: kaustav karmakar</title>
    <description>The latest articles on DEV Community by kaustav karmakar (@kaustavkarmakar2).</description>
    <link>https://dev.to/kaustavkarmakar2</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%2F593226%2F8ffffbac-1513-4aa0-87b5-a87fc457aeb6.jpg</url>
      <title>DEV Community: kaustav karmakar</title>
      <link>https://dev.to/kaustavkarmakar2</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/kaustavkarmakar2"/>
    <language>en</language>
    <item>
      <title>Disable inspect element in Chrome</title>
      <dc:creator>kaustav karmakar</dc:creator>
      <pubDate>Mon, 27 Nov 2023 05:16:57 +0000</pubDate>
      <link>https://dev.to/kaustavkarmakar2/disable-inspect-element-in-chrome-1mod</link>
      <guid>https://dev.to/kaustavkarmakar2/disable-inspect-element-in-chrome-1mod</guid>
      <description>&lt;p&gt;Disable inspect element - DevTools in your Website&lt;/p&gt;

&lt;p&gt;devtools&lt;/p&gt;

&lt;p&gt;javascript&lt;/p&gt;

&lt;p&gt;html&lt;/p&gt;

&lt;p&gt;chrome&lt;br&gt;
A Website can build with simple HTML / CSS / Javascript. When you published, all source code can see with DevTools of Browser.&lt;/p&gt;

&lt;p&gt;What is DevTools?&lt;br&gt;
DevTools is a great tool in the hands of developers and designers for the need to making the development process more productive and debugging easy.&lt;/p&gt;

&lt;p&gt;With the Inspect Element on Chrome, you have more power than the traditional web users:&lt;/p&gt;

&lt;p&gt;View and change the DOM&lt;br&gt;
View and style CSS&lt;br&gt;
Debug Javascript&lt;br&gt;
Watch network activity&lt;br&gt;
Show Local Storage, Session Storage,...&lt;br&gt;
Optimize website performance&lt;br&gt;
etc...&lt;br&gt;
You can discover that the DevTools can be a serious boost to your productivity. But...&lt;/p&gt;

&lt;p&gt;With great power comes great responsibility&lt;br&gt;
— Tom Precious&lt;/p&gt;

&lt;p&gt;Why need disable Devtools?&lt;br&gt;
DevTools is powerful for Development, but is dangerous on production environment.&lt;br&gt;
Anyone can see your source code, which means it's not secure. With DevTools, hacker easily inspect, edit, modify your code.&lt;/p&gt;

&lt;p&gt;I was access to admin of website by change is_admin variable to true&lt;/p&gt;

&lt;p&gt;Besides, he can see when your website get API (Application Programming Interface) and steal API_KEY or exploit information.&lt;/p&gt;

&lt;p&gt;Solution&lt;br&gt;
DevTools can't closed completely. But you can make it inaccessible. Launching DevTools in the following ways:&lt;/p&gt;

&lt;p&gt;Right-click -&amp;gt; Inspect&lt;br&gt;
Ctrl + Shift + I (DevTools shortcut)&lt;br&gt;
F12 (DevTools shortcut)&lt;br&gt;
Ctrl + Shift + J (Open the Console panel)&lt;br&gt;
Ctrl + Shift + C (Open the Elements panel)&lt;br&gt;
Ctrl + U (View Source-code)&lt;/p&gt;

&lt;p&gt;// Disable Disable inspect element - DevTools in your Website&lt;/p&gt;

&lt;p&gt;devtools&lt;/p&gt;

&lt;p&gt;javascript&lt;/p&gt;

&lt;p&gt;html&lt;/p&gt;

&lt;p&gt;chrome&lt;br&gt;
A Website can build with simple HTML / CSS / Javascript. When you published, all source code can see with DevTools of Browser.&lt;/p&gt;

&lt;p&gt;What is DevTools?&lt;br&gt;
DevTools is a great tool in the hands of developers and designers for the need to making the development process more productive and debugging easy.&lt;/p&gt;

&lt;p&gt;With the Inspect Element on Chrome, you have more power than the traditional web users:&lt;/p&gt;

&lt;p&gt;View and change the DOM&lt;br&gt;
View and style CSS&lt;br&gt;
Debug Javascript&lt;br&gt;
Watch network activity&lt;br&gt;
Show Local Storage, Session Storage,...&lt;br&gt;
Optimize website performance&lt;br&gt;
etc...&lt;br&gt;
You can discover that the DevTools can be a serious boost to your productivity. But...&lt;/p&gt;

&lt;p&gt;With great power comes great responsibility&lt;br&gt;
— Tom Precious&lt;/p&gt;

&lt;p&gt;Why need disable Devtools?&lt;br&gt;
DevTools is powerful for Development, but is dangerous on production environment.&lt;br&gt;
Anyone can see your source code, which means it's not secure. With DevTools, hacker easily inspect, edit, modify your code.&lt;/p&gt;

&lt;p&gt;I was access to admin of website by change is_admin variable to true&lt;/p&gt;

&lt;p&gt;Besides, he can see when your website get API (Application Programming Interface) and steal API_KEY or exploit information.&lt;/p&gt;

&lt;p&gt;Solution&lt;br&gt;
DevTools can't closed completely. But you can make it inaccessible. Launching DevTools in the following ways:&lt;/p&gt;

&lt;p&gt;Right-click -&amp;gt; Inspect&lt;br&gt;
Ctrl + Shift + I (DevTools shortcut)&lt;br&gt;
F12 (DevTools shortcut)&lt;br&gt;
Ctrl + Shift + J (Open the Console panel)&lt;br&gt;
Ctrl + Shift + C (Open the Elements panel)&lt;br&gt;
Ctrl + U (View Source-code)&lt;/p&gt;

&lt;p&gt;// Disable right-click&lt;br&gt;
docum Disable inspect element - DevTools in your Website&lt;/p&gt;

&lt;p&gt;devtools&lt;/p&gt;

&lt;p&gt;javascript&lt;/p&gt;

&lt;p&gt;html&lt;/p&gt;

&lt;p&gt;chrome&lt;br&gt;
A Website can build with simple HTML / CSS / Javascript. When you published, all source code can see with DevTools of Browser.&lt;/p&gt;

&lt;p&gt;What is DevTools?&lt;br&gt;
DevTools is a great tool in the hands of developers and designers for the need to making the development process more productive and debugging easy.&lt;/p&gt;

&lt;p&gt;With the Inspect Element on Chrome, you have more power than the traditional web users:&lt;/p&gt;

&lt;p&gt;View and change the DOM&lt;br&gt;
View and style CSS&lt;br&gt;
Debug Javascript&lt;br&gt;
Watch network activity&lt;br&gt;
Show Local Storage, Session Storage,...&lt;br&gt;
Optimize website performance&lt;br&gt;
etc...&lt;br&gt;
You can discover that the DevTools can be a serious boost to your productivity. But...&lt;/p&gt;

&lt;p&gt;With great power comes great responsibility&lt;br&gt;
— Tom Precious&lt;/p&gt;

&lt;p&gt;Why need disable Devtools?&lt;br&gt;
DevTools is powerful for Development, but is dangerous on production environment.&lt;br&gt;
Anyone can see your source code, which means it's not secure. With DevTools, hacker easily inspect, edit, modify your code.&lt;/p&gt;

&lt;p&gt;I was access to admin of website by change is_admin variable to true&lt;/p&gt;

&lt;p&gt;Besides, he can see when your website get API (Application Programming Interface) and steal API_KEY or exploit information.&lt;/p&gt;

&lt;p&gt;Solution&lt;br&gt;
DevTools can't closed completely. But you can make it inaccessible. Launching DevTools in the following ways:&lt;/p&gt;

&lt;p&gt;Right-click -&amp;gt; Inspect&lt;br&gt;
Ctrl + Shift + I (DevTools shortcut)&lt;br&gt;
F12 (DevTools shortcut)&lt;br&gt;
Ctrl + Shift + J (Open the Console panel)&lt;br&gt;
Ctrl + Shift + C (Open the Elements panel)&lt;br&gt;
Ctrl + U (View Source-code)&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// Disable right-click
document.addEventListener('contextmenu', (e) =&amp;gt; e.preventDefault());

function ctrlShiftKey(e, keyCode) {
  return e.ctrlKey &amp;amp;&amp;amp; e.shiftKey &amp;amp;&amp;amp; e.keyCode === keyCode.charCodeAt(0);
}

document.onkeydown = (e) =&amp;gt; {
  // Disable F12, Ctrl + Shift + I, Ctrl + Shift + J, Ctrl + U
  if (
    event.keyCode === 123 ||
    ctrlShiftKey(e, 'I') ||
    ctrlShiftKey(e, 'J') ||
    ctrlShiftKey(e, 'C') ||
    (e.ctrlKey &amp;amp;&amp;amp; e.keyCode === 'U'.charCodeAt(0))
  )
    return false;
};
document.addEventListener('contextmenu', (e) =&amp;gt; e.preventDefault());

function ctrlShiftKey(e, keyCode) {
  return e.ctrlKey &amp;amp;&amp;amp; e.shiftKey &amp;amp;&amp;amp; e.keyCode === keyCode.charCodeAt(0);
}

document.onkeydown = (e) =&amp;gt; {
  // Disable F12, Ctrl + Shift + I, Ctrl + Shift + J, Ctrl + U
  if (
    event.keyCode === 123 ||
    ctrlShiftKey(e, 'I') ||
    ctrlShiftKey(e, 'J') ||
    ctrlShiftKey(e, 'C') ||
    (e.ctrlKey &amp;amp;&amp;amp; e.keyCode === 'U'.charCodeAt(0))
  )
    return false;
}; right-click
document.addEventListener('contextmenu', (e) =&amp;gt; e.preventDefault());

function ctrlShiftKey(e, keyCode) {
  return e.ctrlKey &amp;amp;&amp;amp; e.shiftKey &amp;amp;&amp;amp; e.keyCode === keyCode.charCodeAt(0);
}

document.onkeydown = (e) =&amp;gt; {
  // Disable F12, Ctrl + Shift + I, Ctrl + Shift + J, Ctrl + U
  if (
    event.keyCode === 123 ||
    ctrlShiftKey(e, 'I') ||
    ctrlShiftKey(e, 'J') ||
    ctrlShiftKey(e, 'C') ||
    (e.ctrlKey &amp;amp;&amp;amp; e.keyCode === 'U'.charCodeAt(0))
  )
    return false;
};

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

&lt;/div&gt;



</description>
      <category>webdev</category>
      <category>javascript</category>
      <category>programming</category>
      <category>react</category>
    </item>
    <item>
      <title>Learn and programming mind of developer</title>
      <dc:creator>kaustav karmakar</dc:creator>
      <pubDate>Tue, 28 Feb 2023 18:49:00 +0000</pubDate>
      <link>https://dev.to/kaustavkarmakar2/learn-and-programming-mind-of-developer-3k52</link>
      <guid>https://dev.to/kaustavkarmakar2/learn-and-programming-mind-of-developer-3k52</guid>
      <description>&lt;p&gt;Learning oops principles.&lt;br&gt;
Learning basic sysntax of any language.&lt;br&gt;
Understanding the basics principles of the language you skilled at and worked mostly. &lt;br&gt;
Understanding the principles of architecture and coding principles of SOLID principles.&lt;br&gt;
Understanding the naming of variables and structures the code in smaller reusable blocks.&lt;br&gt;
Basic understanding of data structures such as sorting,arrays ,objects and binary search, linked list .Pick one language and worked for years in one language you picked . Core principles of writing clean code and naming variables naming should be prority . Playing of arrays and objects and solving problems will improve your understanding of how coding principles works. Deep understanding of private and public methods of class or functions .&lt;br&gt;
Developing a understanding of principles of OOPS concepts.&lt;br&gt;
Learn to google if you are stuck in something and take help from stack overflow or join free communities in facebook . Understanding the basics of es6 syntax and why it is introduced instead of regular javascript.Concept of local and global variables and also the problems solved with the help of closures. Debugging issues more than writing code so that it can help your understand of basic structure of the system which you are building.&lt;br&gt;
Solving puzzles and solving complex problems which can make you think like what you are building for so long.&lt;br&gt;
Reading principles of solving problems of senerios which can give you abilities to solve problems.&lt;br&gt;
Reading principles of javascript and clear all the possible solutions to solve the problem.&lt;br&gt;
Writing reusable code to maintain and manage for long run.&lt;br&gt;
Make a habit of learning for at least 1 hour a day.&lt;br&gt;
Learning from past mistakes and experiences will be the best thing to learn from,yet i preferred reading books instead of traditional courses in online.&lt;br&gt;
Well it all depends on the person to person,resources can be anywhere but understanding the process of learning is very important for one’s life.&lt;br&gt;
Cheers,live long and stay healthy and strong.&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>typescript</category>
      <category>algorithms</category>
      <category>webdev</category>
    </item>
    <item>
      <title>Reducing time complexity using a map</title>
      <dc:creator>kaustav karmakar</dc:creator>
      <pubDate>Fri, 06 Jan 2023 17:17:13 +0000</pubDate>
      <link>https://dev.to/kaustavkarmakar2/reducing-time-complexity-using-a-map-4opb</link>
      <guid>https://dev.to/kaustavkarmakar2/reducing-time-complexity-using-a-map-4opb</guid>
      <description>&lt;p&gt;Reducing time&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--nO6HKJrD--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/t66atuz2z8n5mczs0w0q.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--nO6HKJrD--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/t66atuz2z8n5mczs0w0q.jpeg" alt="Image description" width="880" height="880"&gt;&lt;/a&gt; complexity using a Map.&lt;/p&gt;

&lt;p&gt;Map in JavaScript&lt;br&gt;
In this article, we would be discussing Map object provided by ES6. Map is a collection of elements where each element is stored as a Key, value pair. Map object can hold both objects and primitive values as either key or value. When we iterate over the map object it returns the key, value pair in the same order as inserted.&lt;/p&gt;

&lt;p&gt;Map (using Binary Search Tree)      &lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;O(log(n))
**** Implemented using Binary Search Tree****
For more reference 
&lt;a href="https://adrianmejia.com/data-structures-time-complexity-for-beginners-arrays-hashmaps-linked-lists-stacks-queues-tutorial/"&gt;&lt;/a&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;I sometimes see this kind situation:&lt;br&gt;
We are looping through an array, and for each element of this array, we are looking into another array to find some data related to this element (or sometimes several other arrays to find more data).&lt;br&gt;
Example&lt;br&gt;
Let’s say we have an array of animals, and an array of cat.&lt;br&gt;
Each animals has a favourite cat. For each animals , we know his favourite cat because each animals has an attribute which is the id of his favourite cat.&lt;br&gt;
Let’s say we want to print in the console, for each animals , his name and the name of his favourite cat.&lt;br&gt;
The common implementation&lt;br&gt;
Usually, common implementations for this problem looks something like that.&lt;br&gt;
Using the method find on the cats array, or an alternative, in order to loop for each animals through the cat array to find the cat we are looking for.&lt;br&gt;
It’s clear, simple, and it works. So that’s nice.&lt;br&gt;
But if we check at the time complexity, it’s not that nice:&lt;br&gt;
we loop through the N animals&lt;br&gt;
and for each animals we loop through the M cats to find his favourite cat&lt;br&gt;
So the time complexity is O(N*M).&lt;br&gt;
And the space complexity is O(N+M) because we have N+M elements to store in memory.&lt;br&gt;
We can do better&lt;br&gt;
By using a Map instead of an array to store the cats, we are going to reduce the time complexity to O(N), without increasing the space complexity. Why ? Because accessing a value with the get method of a Map (in practice) is constant in time (O(1)).&lt;br&gt;
First, we create a Map from the cats array, by setting the id as key and the cat as value.&lt;br&gt;
Then, we replace the find on the cats array by a get on catsMap, and we are good to go.&lt;br&gt;
Conclusion &lt;br&gt;
Using javascript in built function is always a better choice since it is a higher order function. Instead of using for loop for iteration.&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>javascript</category>
      <category>programming</category>
      <category>typescript</category>
    </item>
    <item>
      <title>Destructuring Assignment is a Typescript</title>
      <dc:creator>kaustav karmakar</dc:creator>
      <pubDate>Thu, 15 Dec 2022 16:36:25 +0000</pubDate>
      <link>https://dev.to/kaustavkarmakar2/destructuring-assignment-is-a-typescript-l83</link>
      <guid>https://dev.to/kaustavkarmakar2/destructuring-assignment-is-a-typescript-l83</guid>
      <description>&lt;p&gt;Destructuring&lt;br&gt;
TypeScript supports the following forms of Destructuring (literally named after de-structuring i.e. breaking up the structure):&lt;br&gt;
1.&lt;br&gt;
Object Destructuring&lt;br&gt;
2.&lt;br&gt;
Array Destructuring&lt;br&gt;
It is easy to think of destructuring as an inverse of structuring. The method of structuring in JavaScript is the object literal:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;var foo = {
    bar: {
        ba
s: 123
    }
};
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Without the awesome structuring support built into JavaScript, creating new objects on the fly would indeed be very cumbersome. Destructuring brings the same level of convenience to getting data out of a structure.&lt;br&gt;
Object Destructuring&lt;br&gt;
Destructuring is useful because it allows you to do in a single line, what would otherwise require multiple lines. Consider the following case:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;var rect = { x: 0, y: 10, width: 15, height: 20 };
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;​&lt;br&gt;
// Destructuring assignment&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;var {x, y, width, height} = rect;
console.log(x, y, width, height); // 0,10,15,20
​
rect.x = 10;
({x, y, width, height} = rect); // assign to existing variables using outer parentheses
console.log(x, y, width, height); // 10,10,15,20
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Here in the absence of destructuring you would have to pick off x,y,width,height one by one from rect.&lt;br&gt;
To assign an extracted variable to a new variable name you can do the following:&lt;br&gt;
// structure&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const obj = {"some property": "some value"};
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;​&lt;br&gt;
// destructure&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const {"some property": someProperty} = obj;
console.log(someProperty === "some value"); // true
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Additionally you can get deep data out of a structure using destructuring. This is shown in 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;var foo = { bar: { bas: 123 } };
var {bar: {bas}} = foo; // 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Effectively&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;var bas = foo.bar.bas;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Object Destructuring with rest&lt;br&gt;
You can pick up any number of elements from an object and get an object of the remaining elements using object destructuring with rest.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;var {w, x, ...remaining} = {w: 1, x: 2, y: 3, z: 4};
console.log(w, x, remaining); // 1, 2, {y:3,z:4}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;A common use case is also to ignore certain properties. For example:&lt;br&gt;
// Example function&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;function goto(point2D: {x: number, y: number}) {
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;// Imagine some code that might break&lt;br&gt;
  // if you pass in an object&lt;br&gt;
  // with more items than desired&lt;br&gt;
}&lt;br&gt;
// Some point you get from somewhere&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const point3D = {x: 1, y: 2, z: 3};
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;/** A nifty use of rest to remove extra properties */&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const { z, ...point2D } = point3D;
goto(point2D);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Array Destructuring&lt;br&gt;
A common programming question: "How to swap two variables without using a third one?". The TypeScript solution:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;var x = 1, y = 2;
[x, y] = [y, x];
console.log(x, y); // 2,1
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Note that array destructuring is effectively the compiler doing the [0], [1], ... and so on for you. There is no guarantee that these values will exist.&lt;br&gt;
Array Destructuring with rest&lt;br&gt;
You can pick up any number of elements from an array and get an array of the remaining elements using array destructuring with rest.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;var [x, y, ...remaining] = [1, 2, 3, 4];
console.log(x, y, remaining); // 1, 2, [3,4]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Array Destructuring with ignores&lt;br&gt;
You can ignore any index by simply leaving its location empty i.e. , , in the left hand side of the assignment. For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;var [x, , ...remaining] = [1, 2, 3, 4];
console.log(x, remaining); // 1, [3,4]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;JS Generation&lt;br&gt;
The JavaScript generation for non ES6 targets simply involves creating temporary variables, just like you would have to do yourself without native language support for destructuring e.g.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;var x = 1, y = 2;
[x, y] = [y, x];
console.log(x, y); // 2,1
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;​&lt;br&gt;
// becomes //&lt;br&gt;
​&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;var x = 1, y = 2;
_a = [y,x], x = _a[0], y = _a[1];
console.log(x, y);
var _a;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Summary&lt;br&gt;
Destructuring can make your code more readable and maintainable by reducing the line count and making the intent clear. Array destructuring can allow you to use arrays as though they were tuples&lt;br&gt;
Please give a like and follow,if you like my work&lt;/p&gt;

</description>
      <category>destructuring</category>
      <category>javascript</category>
      <category>typescript</category>
      <category>webdev</category>
    </item>
    <item>
      <title>Taking Interviewing candidates</title>
      <dc:creator>kaustav karmakar</dc:creator>
      <pubDate>Tue, 09 Aug 2022 10:07:00 +0000</pubDate>
      <link>https://dev.to/kaustavkarmakar2/taking-interview-expereience-4koe</link>
      <guid>https://dev.to/kaustavkarmakar2/taking-interview-expereience-4koe</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;When interviewing for a certain position. I found it a little like this.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;ul&gt;
&lt;li&gt;For a leader to succeed, they have to be able to hire the right people for their team. Nothing is more important.&lt;/li&gt;
&lt;li&gt;And while leaders are told to recruit the right people, they have never been taught how to recruit the right people. That is why most leaders spend 10% of their time recruiting, and 90% of their time making up for recruiting mistakes.&lt;/li&gt;
&lt;li&gt;The result of this is huge inefficiencies, unhappy people, and results below what is possible for leaders to achieve, not to mention very expensive and disruptive processes for the organization when the wrong people are hired.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Billionaire John Caldwell once said, “If I’m lucky, I only get recruiting wrong 70% of the time”. But how is it that we accept being wrong so much of the time?&lt;br&gt;
When your job hinges on how well you talk to people, you learn a lot about how to have great conversations – and most of us don’t converse very well. A great conversation requires a balance between talking and listening. This balance is important because bad communication leads to bad relationships, at home, at work, and everywhere.&lt;br&gt;
Try learning more about your jobs learn from youtube,udemy, and Udacity.&lt;br&gt;
When we look over a resume it is only qualified to do not what your job is.&lt;br&gt;
Happiness in a job is what you do to be you become.&lt;br&gt;
Chase your dreams not to be what to do it for your leaving.&lt;br&gt;
"Career satisfaction doesn't come from what you do. It comes from who you get to be while doing it"&lt;br&gt;
*&lt;em&gt;- Key points to success *&lt;/em&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Reduce Stress&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Prepare more &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Practise online practice interview&lt;br&gt;
All the best Prepare the best and land your dream job.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>inspration</category>
      <category>webdev</category>
      <category>programming</category>
      <category>career</category>
    </item>
    <item>
      <title>Web3.js with javascript</title>
      <dc:creator>kaustav karmakar</dc:creator>
      <pubDate>Tue, 19 Apr 2022 14:41:37 +0000</pubDate>
      <link>https://dev.to/kaustavkarmakar2/web3js-with-javascript-26n1</link>
      <guid>https://dev.to/kaustavkarmakar2/web3js-with-javascript-26n1</guid>
      <description>&lt;p&gt;The Support of my programm is done from Web3.js&lt;a href="https://web3js.readthedocs.io/en/v1.7.3/"&gt;&lt;/a&gt; documentations&lt;br&gt;
Course Overview&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Web3.js
** web3.js is a collection of libraries that allow you to interact with a local or remote ethereum node using HTTP, IPC or WebSocket.**
2.** Modules**&lt;/li&gt;
&lt;li&gt;Uses we can transfer ether in the wallet&lt;/li&gt;
&lt;li&gt;We can fetch the account balance 
3.Web3.js in chrome console
4.We generate ABI and ByteCode using Web3.js in our smart contract
5.Compilation of Web3.js
6.Deployement of Smart Contract
*&lt;em&gt;Web3.js Prerequisites *&lt;/em&gt;
&lt;/li&gt;
&lt;li&gt;Blockchain&lt;/li&gt;
&lt;li&gt;Basic understanding of Blockchain&lt;/li&gt;
&lt;li&gt;Ethereum&lt;/li&gt;
&lt;li&gt;Basic understanding of Ethereum&lt;/li&gt;
&lt;li&gt;Solidity&lt;/li&gt;
&lt;li&gt;Basic idea about Solidity&lt;/li&gt;
&lt;li&gt;JavaScript&lt;/li&gt;
&lt;li&gt;Basic understanding of JavaScript
&lt;strong&gt;Software Requirement&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Node js&lt;/li&gt;
&lt;li&gt;Ganache&lt;/li&gt;
&lt;li&gt;Vs Code&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;What is Web3.js&lt;/strong&gt;?&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Suppose we have a application and we want to connect our application with blockchain(Smart Contract),then we can use Web3.js in our applications to connect to the blockchain(Smart Contract).&lt;/li&gt;
&lt;li&gt;It acts as a interface between your peer world(application) and blockchain (Smart Contract).&lt;/li&gt;
&lt;li&gt;Web3.js is nothing but the interactions between our application and Smart Contract in Blockchain
&lt;strong&gt;Web3.js&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Installation of Web3.js&lt;/li&gt;
&lt;li&gt;Import of Web3.js&lt;/li&gt;
&lt;li&gt;To connect with Ganache&lt;/li&gt;
&lt;li&gt;To get the balance of an account&lt;/li&gt;
&lt;li&gt;to convert wei into ether&lt;/li&gt;
&lt;li&gt;&lt;p&gt;to transfer ether from one account to another account&lt;br&gt;
&lt;strong&gt;Steps to proceed&lt;/strong&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;node --v&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;npm init -y&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;npm install --save web3&lt;br&gt;
&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;let Web3 = require('web3');
//to check web3 is import or not 
console.log(" Web3", Web3);
//Now we will create a object named web3
let web3=new Web3(new Web3.providers.HttpProvider("Please give ganache url");
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--SFNPJyBH--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/52dw7astofoes37rds1m.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--SFNPJyBH--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/52dw7astofoes37rds1m.png" alt="Image description" width="880" height="437"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;Now we can control the Ganache&lt;/em&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Now we will check how we can fetch the balance of Ganache of our account
&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;web3.eth.getBalance("id of account").then(console.log);
//you will get the balance of the account 
//you need to have a little understanding of javascript
//then can also acts as a Promise
//if we want to get the balance 
web3.eth.getBalance("id of account").then(function(result){
console.log(web3.utils.fromWei(reults,"ether"));});
});
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;&lt;strong&gt;How can we transfer ether from one account to another account?&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;web3.eth.sendTransactions({from:" id of account where money need to be transfer",to:"id of account where money need to be sent",value:web3.utils.toWei("Amount to be transfer","ether")});
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Main Source all the resources is &lt;a href="https://web3js.readthedocs.io/en/v1.7.3/"&gt;click here&lt;/a&gt;&lt;br&gt;
Thank You for Reading&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>blockchain</category>
      <category>web3</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>Some concept in javascript .</title>
      <dc:creator>kaustav karmakar</dc:creator>
      <pubDate>Tue, 19 Apr 2022 09:57:36 +0000</pubDate>
      <link>https://dev.to/kaustavkarmakar2/some-concept-in-javascript--3ikc</link>
      <guid>https://dev.to/kaustavkarmakar2/some-concept-in-javascript--3ikc</guid>
      <description>&lt;p&gt;1)What is deep copy and shallow copy in javascript?&lt;br&gt;
&lt;strong&gt;Shallow copy&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;When a refference variable is copied to new refference variable using the assignment operator,a shallow copy of the referenced object is created.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;A reference variable mainly stores the address of the object it refers to.&lt;br&gt;
&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;```  SHALLOW COPY---------------------------------------&lt;br&gt;
const a = { x: 0, y: { z: 0 } };&lt;br&gt;
const b = {...a}; // or const b = Object.assign({}, a);&lt;/p&gt;

&lt;p&gt;b.x = 1; // doesn't update a.x&lt;br&gt;
b.y.z = 1; // also updates a.y.z```&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;Deep copy&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Unlike the shallow copy, deep copy makes a copy of all the members of the old object, allocates separate memory location for the new object and then assigns the copied members to the new object.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;In this way, both the objects are independent of each other and in case of any modification to either one the other is not affected.&lt;br&gt;
&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;```// DEEP COPY---------------------------------------&lt;br&gt;
const a = { x: 0, y: { z: 0 } };&lt;br&gt;
const b = JSON.parse(JSON.stringify(a)); &lt;/p&gt;

&lt;p&gt;b.y.z = 1; // doesn't update a.y.z```&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;2)Concept of spread and rest operators.&lt;br&gt;
&lt;em&gt;JavaScript uses three dots (...) for both the rest and spread operators. But these two operators are not the same.&lt;/em&gt;&lt;br&gt;
Spread Syntax&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;```function sum(x, y, z) {&lt;br&gt;
  return x + y + z;&lt;br&gt;
}&lt;/p&gt;

&lt;p&gt;const numbers = [1, 2, 3];&lt;/p&gt;

&lt;p&gt;console.log(sum(...numbers));&lt;br&gt;
// expected output: 6```&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;Rest Syntax&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;```function sumAll(...args) { // args is the name for the array&lt;br&gt;
  let sum = 0;&lt;/p&gt;

&lt;p&gt;for (let arg of args) sum += arg;&lt;/p&gt;

&lt;p&gt;return sum;&lt;br&gt;
}&lt;/p&gt;

&lt;p&gt;alert( sumAll(1) ); // 1&lt;br&gt;
alert( sumAll(1, 2) ); // 3&lt;br&gt;
alert( sumAll(1, 2, 3) ); // 6```&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;3)Use of window object and document object.&lt;br&gt;
&lt;strong&gt;Window Object&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The window object is a global object that has the properties pertaining to the current DOM document, which is what's in the tab of a browser.
window.open(); &amp;gt; Opens a new browser window
window.scrollTo(); &amp;gt; Scrolls the document to the specified coordinates
For more refference ,&lt;a href="https://www.w3schools.com/jsref/obj_window.asp"&gt;click here
&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Document object&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;The document object is the root node of the HTML document.
2.The document object is a property of the window object.
3.The document object is accessed with:&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;code&gt;window.document or just document&lt;/code&gt;&lt;br&gt;
For more refference ,&lt;a href="https://www.w3schools.com/jsref/dom_obj_document.asp"&gt;click here&lt;/a&gt;&lt;br&gt;
4)Find the set of unique element in the array?&lt;br&gt;
For example [1,1,2,3,4,4,77] should be [1,2,3,4,77]&lt;br&gt;
&lt;code&gt;let arrayElement=[1,1,2,3,4,4,77]&lt;br&gt;
let uniqueElement=[...new Set(arrayElement)]&lt;br&gt;
console.log("_uniqueElement",uniqueElement)&lt;/code&gt;&lt;br&gt;
5)What is IIFE(Immediately Invoked Function Expression)?&lt;br&gt;
&lt;strong&gt;IIFE (Immediately Invoked Function Expression) is a JavaScript function that runs as soon as it is defined. The signature of it would be as below,&lt;/strong&gt;&lt;br&gt;
&lt;code&gt;(function () {&lt;br&gt;
  // logic here&lt;br&gt;
})();&lt;/code&gt;&lt;br&gt;
6)What is the difference between == and === operators?&lt;br&gt;
JavaScript provides both strict(===, !==) and type-converting(==, !=) equality comparison. The strict operators take type of variable in consideration, while non-strict operators make type correction/conversion based upon values of variables. The strict operators follow the below conditions for different types,&lt;/p&gt;

&lt;p&gt;Two strings are strictly equal when they have the same sequence of characters, same length, and same characters in corresponding positions.&lt;br&gt;
Two numbers are strictly equal when they are numerically equal. i.e, Having the same number value. There are two special cases in this,&lt;br&gt;
NaN is not equal to anything, including NaN.&lt;br&gt;
Positive and negative zeros are equal to one another.&lt;br&gt;
Two Boolean operands are strictly equal if both are true or both are false.&lt;br&gt;
Two objects are strictly equal if they refer to the same Object.&lt;br&gt;
Null and Undefined types are not equal with ===, but equal with ==. i.e, null===undefined --&amp;gt; false but null==undefined --&amp;gt; true&lt;br&gt;
Some of the example which covers the above cases,&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;&lt;code&gt;0 == false   // true&lt;br&gt;
0 === false  // false&lt;br&gt;
1 == "1"     // true&lt;br&gt;
1 === "1"    // false&lt;br&gt;
null == undefined // true&lt;br&gt;
null === undefined // false&lt;br&gt;
'0' == false // true&lt;br&gt;
'0' === false // false&lt;br&gt;
[]==[] or []===[] //false, refer different objects in memory&lt;br&gt;
{}=={} or {}==={} //false, refer different objects in memory&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;7)What is web storage?&lt;br&gt;
**Web storage is an API that provides a mechanism by which browsers can store key/value pairs locally within the user's browser, in a much more intuitive fashion than using cookies. The web storage provides two mechanisms for storing data on the client.&lt;/p&gt;

&lt;p&gt;Local storage: It stores data for current origin with no expiration date.&lt;br&gt;
Session storage: It stores data for one session and the data is lost when the browser tab is closed.**&lt;br&gt;
8)What is a Cookie?&lt;br&gt;
**A cookie is a piece of data that is stored on your computer to be accessed by your browser. Cookies are saved as key/value pairs. &lt;br&gt;
It can be deleted by setting the expire date in the cookie&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;&lt;code&gt;document.cookie =&lt;br&gt;
  "username=; expires=Fri, 07 Jun 2019 00:00:00 UTC; path=/;";&lt;/code&gt;&lt;br&gt;
&lt;br&gt;
**&lt;br&gt;
9)Why do you need web storage?&lt;br&gt;
&lt;strong&gt;Web storage is more secure, and large amounts of data can be stored locally, without affecting website performance. Also, the information is never transferred to the server. Hence this is a more recommended approach than Cookies.&lt;/strong&gt;&lt;br&gt;
10)What are Web Workers?&lt;br&gt;
&lt;strong&gt;A web worker, as defined by the World Wide Web Consortium and the Web Hypertext Application Technology Working Group, is a JavaScript script executed from an HTML page that runs in the background, independently of scripts that may also have been executed from the same HTML page.&lt;/strong&gt;&lt;br&gt;
&lt;code&gt;const myWorker = new Worker("worker.js");&lt;br&gt;
  myWorker.postMessage() // sending data &lt;br&gt;
  onmessage=(e)=&amp;gt;{e.data} // listenig to message event and capture data&lt;/code&gt;&lt;br&gt;
11)What are the restrictions of web workers on DOM?&lt;br&gt;
WebWorkers don't have access to below javascript objects since they are defined in an external files&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Window object&lt;/li&gt;
&lt;li&gt;Document object&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Parent object&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Last but not least collected all the information after &lt;a href="https://www.w3schools.com/"&gt;https://www.w3schools.com/&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;and &lt;a href="https://developer.mozilla.org/"&gt;https://developer.mozilla.org/&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Keep learning and keep following me.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Peace&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

</description>
      <category>javascript</category>
      <category>webdev</category>
      <category>programming</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>Design Principles React</title>
      <dc:creator>kaustav karmakar</dc:creator>
      <pubDate>Thu, 08 Apr 2021 08:16:53 +0000</pubDate>
      <link>https://dev.to/kaustavkarmakar2/design-principles-react-3e8j</link>
      <guid>https://dev.to/kaustavkarmakar2/design-principles-react-3e8j</guid>
      <description>&lt;h1&gt;
  
  
  Thinking in React
&lt;/h1&gt;

&lt;p&gt;Step 1: Break The UI Into A Component Hierarchy&lt;br&gt;
Step 2: Build A Static Version in React&lt;br&gt;
Step 3: Identify The Minimal (but complete) Representation Of UI State&lt;br&gt;
Step 4: Identify Where Your State Should Live&lt;br&gt;
Step 5: Add Inverse Data Flow&lt;/p&gt;
&lt;h1&gt;
  
  
  Composition
&lt;/h1&gt;

&lt;blockquote&gt;
&lt;p&gt;Components written by different people should work well together. &lt;br&gt;
It is important to us that you can add functionality to a component without causing rippling changes throughout the codebase.&lt;br&gt;
There is nothing “bad” about using state or lifecycle methods in components. &lt;br&gt;
It may enable more functional patterns in the future, but both local state and lifecycle methods will be a part of that model.&lt;br&gt;
Components are often described as “just functions” but in my view, they need to be more than that to be useful. &lt;br&gt;
In React, components describe any composable behavior, and this includes rendering, lifecycle, and state. &lt;/p&gt;
&lt;h1&gt;
  
  
  Common Abstraction
&lt;/h1&gt;

&lt;p&gt;&lt;a href="https://www.youtube.com/watch?v=4anAwXYqLG8"&gt;Resist adding features&lt;/a&gt;&lt;br&gt;
If React didn’t provide support for local state or lifecycle methods, people would create custom abstractions for them.&lt;br&gt;
When there are multiple abstractions competing, React can’t enforce or take advantage of the properties of either of them. It has to work with the lowest common denominator.&lt;/p&gt;
&lt;h1&gt;
  
  
  Escape Hatches
&lt;/h1&gt;

&lt;p&gt;React is pragmatic.&lt;br&gt;
If some pattern that is useful for building apps is hard to express in a declarative way, it will provide an imperative API for it. such as Refs and the DOM.&lt;/p&gt;
&lt;h1&gt;
  
  
  Stability
&lt;/h1&gt;

&lt;p&gt;Facebook has more than 50 thousand components using React. Many other companies, including Twitter and Airbnb, are also heavy users of React. This is why we are usually reluctant to change public APIs or behavior.&lt;br&gt;
However I think stability in the sense of “nothing changes” is overrated. It quickly turns into stagnation. Instead, I prefer the stability in the sense of “It is heavily used in production, and when something changes, there is a clear (and preferably automated) migration path.”&lt;/p&gt;
&lt;h1&gt;
  
  
  Interoperability
&lt;/h1&gt;

&lt;p&gt;React provides escape hatches to work with mutable models and tries to work well together with other UI libraries. &lt;br&gt;
You can wrap an existing imperative UI into a declarative component, and vice versa. This is crucial for gradual adoption.&lt;/p&gt;
&lt;h1&gt;
  
  
  Scheduling
&lt;/h1&gt;

&lt;p&gt;Even when your components are described as functions when you use React you don’t call them directly.&lt;br&gt;
Every component returns a description of what needs to be rendered, and that description may include both user-written components like  and platform-specific components like . It is up to React to “unroll”  at some point in the future and actually apply changes to the UI tree according to the render results of the components recursively.
&lt;/p&gt;
&lt;h1&gt;
  
  
  Debugging
&lt;/h1&gt;

&lt;p&gt;When something goes wrong, it is important that you have breadcrumbs to trace the mistake to its source in the codebase. In React, props and state are those breadcrumbs.&lt;br&gt;
If you see something wrong on the screen, you can open React DevTools, find the component responsible for rendering, and then see if the props and state are correct. If they are, you know that the problem is in the component’s render() function or some function that is called render(). The problem is isolated.&lt;br&gt;
If the state is wrong, you know that the problem is caused by one of the setState() calls in this file. This, too, is relatively simple to locate and fix because usually there are only a few setState() calls in a single file.&lt;br&gt;
If the props are wrong, you can traverse the tree up in the inspector, looking for the component that first “poisoned the well” bypassing bad props down.&lt;/p&gt;
&lt;h1&gt;
  
  
  Glossary of React Terms
&lt;/h1&gt;

&lt;p&gt;Single-page Application&lt;br&gt;
Compilers- Babel is the compiler most commonly used with React.&lt;br&gt;
Bundlers-Some bundlers commonly used in React applications include Webpack and Browserify.&lt;br&gt;
Package Managers-npm or yarn &lt;br&gt;
CDN-CDN stands for Content Delivery Network. CDNs deliver cached, static content from a network of servers across the globe.&lt;br&gt;
JSX-JSX is a syntax extension to JavaScript.JSX gets compiled to React.createElement() calls which return plain JavaScript objects called “React elements”. To get a basic introduction to JSX see the docs here and find a more in-depth tutorial on JSX here.&lt;br&gt;
&lt;/p&gt;

&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const name = 'Kaustav';
ReactDOM.render(
  &amp;lt;h1 className="hello"&amp;gt;My name is {name}!&amp;lt;/h1&amp;gt;,
  document.getElementById('root')
);
&lt;/code&gt;&lt;/pre&gt;



&lt;blockquote&gt;
&lt;p&gt;Elements-An element describes what you want to see on the screen. React elements are immutable.&lt;br&gt;
&lt;/p&gt;
&lt;/blockquote&gt;

&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const element = &amp;lt;h1&amp;gt;Hello, world&amp;lt;/h1&amp;gt;;
&lt;/code&gt;&lt;/pre&gt;



&lt;blockquote&gt;
&lt;h2&gt;
  
  
  Components
&lt;/h2&gt;

&lt;p&gt;React components are small, reusable pieces of code that return a React element to be rendered to the page. The simplest version of React component is a plain JavaScript function that returns a React element:&lt;br&gt;
&lt;/p&gt;
&lt;/blockquote&gt;

&lt;pre class="highlight plaintext"&gt;&lt;code&gt;function Welcome(props) {
  return &amp;lt;h1&amp;gt;Hello, {props.name}&amp;lt;/h1&amp;gt;;
}
or Components can also be ES6 classes:
class Welcome extends React.Component {
  render() {
    return &amp;lt;h1&amp;gt;Hello, {this.props.name}&amp;lt;/h1&amp;gt;;
  }
}
&lt;/code&gt;&lt;/pre&gt;



&lt;h1&gt;
  
  
  Controlled vs. Uncontrolled Components
&lt;/h1&gt;

&lt;h2&gt;
  
  
  React has two different approaches to dealing with form inputs.
&lt;/h2&gt;

&lt;blockquote&gt;
&lt;p&gt;An input form element whose value is controlled by React is called a controlled component. When a user enters data into a controlled component a change event handler is triggered and your code decides whether the input is valid (by re-rendering with the updated value). If you do not re-render then the form element will remain unchanged.&lt;br&gt;
An uncontrolled component works like form elements do outside of React. When a user inputs data into a form field (an input box, dropdown, etc) the updated information is reflected without React needing to do anything. However, this also means that you can’t force the field to have a certain value.&lt;/p&gt;
&lt;h2&gt;
  
  
  Keeping discussion about React community.
&lt;/h2&gt;
&lt;/blockquote&gt;


&lt;br&gt;
&lt;/blockquote&gt;

</description>
      <category>react</category>
      <category>javascript</category>
    </item>
    <item>
      <title>Microservices in node js</title>
      <dc:creator>kaustav karmakar</dc:creator>
      <pubDate>Tue, 16 Mar 2021 14:52:18 +0000</pubDate>
      <link>https://dev.to/kaustavkarmakar2/microservices-in-node-js-3oia</link>
      <guid>https://dev.to/kaustavkarmakar2/microservices-in-node-js-3oia</guid>
      <description>&lt;p&gt;1)What is microservices?&lt;br&gt;
Microservices are an architectural approach based on building an application as a collection of small services.&lt;br&gt;
2)Microservices architecture-Compared to its predecessor, the monolithic architecture, microservices are hands down more beneficial. You don’t need to stuff all software components and services in one big container and pack them tightly. With microservices, you can build an app with:&lt;/p&gt;



&lt;p&gt;greater flexibility,&lt;br&gt;
high scalability,&lt;br&gt;
continuous development, &lt;br&gt;
systematic data organization,&lt;br&gt;
time optimization, and&lt;br&gt;
reliability.&lt;/p&gt;



&lt;p&gt;Building JavaScript applications on microservices help you focus on developing monofunctional modules with clearly defined operations and precise interfaces. The application development process becomes more agile, and the challenges of continuous testing are mitigated. &lt;br&gt;
3)Key benefits of Node.js&lt;/p&gt;

&lt;p&gt;Single-threaded: With event looping, the server uses a non-blocking mechanism to respond.&lt;br&gt;
Super-fast: Codes are executed quickly on the V8 JavaScript Engine&lt;br&gt;
Event-driven: ‘Events of Node.js’ is a notification system that enables the application server to capture the response of the previous API call.&lt;br&gt;
Buffer-less: There is no buffering as data is simply released in chunks.&lt;br&gt;
Asynchronous: The non-blocking, non-synchronous Node.js libraries move to the next API and do not await the return data of the previous API.&lt;br&gt;
Highly-scalable: Servers can handle as many requests as coming their way&lt;br&gt;
Licensed: The program is authorized under a software license.&lt;br&gt;
4)The service registry&lt;br&gt;
The service registry is a database populated with information on how to dispatch requests to microservice instances. Interactions between the registry and other components can be divided into two groups, each with two subgroups:&lt;/p&gt;

&lt;p&gt;Interactions between microservices and the registry (registration)&lt;br&gt;
Self-registration&lt;br&gt;
Third-party registration&lt;br&gt;
Interactions between clients and the registry (discovery)&lt;br&gt;
Client-side discovery&lt;br&gt;
Server-side discovery&lt;br&gt;
Registration&lt;/p&gt;



&lt;p&gt;Most microservice-based architectures are in constant evolution. Services go up and down as development teams split, improve, deprecate and do their work. Whenever a service endpoint changes, the registry needs to know about the change. This is what registration is all about: who publishes or updates the information on how to reach each service.&lt;/p&gt;

&lt;p&gt;Self-registration forces microservices to interact with the registry by themselves. When a service goes up, it notifies the registry. The same thing happens when the service goes down. Whatever additional data is required by the registry must be provided by the service itself. If you have been following this series, you know that microservices are all about dealing with a single concern, so self-registration might seem like an anti-pattern. However, for simple architectures, self-registration might be the right choice.&lt;/p&gt;

&lt;p&gt;-Third-party registration - is normally used in the industry. In this case, there is a process or service that manages all other services. This process polls or checks in some way which microservice instances are running and it automatically updates the service registry. Additional data might be provided in the form of per-service config files (or policy), which the registration process uses to update the database. Third-party registration is commonplace in architectures that use tools such as Apache ZooKeeper or Netflix Eureka and other service managers.&lt;/p&gt;

&lt;p&gt;-Discovery-&lt;br&gt;
As you can imagine, discovery is the counterpart to registration from the point of view of clients. When a client wants to access a service, it must find out where the service is located (and other relevant information to perform the request).&lt;br&gt;
Client-side discovery forces clients to query a discovery service before performing the actual requests. As happens with self-registration, this requires clients to deal with additional concerns other than their main objective. The discovery service may or may not be located behind the API gateway. If it is not located behind the gateway, balancing, authentication and other cross-cutting concerns may need to be re-implemented for the discovery service. Additionally, each client needs to know the fixed endpoint (or endpoints) to contact the discovery service. These are all disadvantages. The one big advantage is not having to code the necessary logic in the gateway system. Study this carefully when picking your discovery method.&lt;br&gt;
Server-side discovery makes the API gateway handle the discovery of the right endpoint (or endpoints) for a request. This is normally used in bigger architectures. As all requests are directly sent to the gateway, all the benefits discussed in relation to it apply. The gateway may also implement discovery caching, so that many requests may have lower latencies. The logic behind cache invalidation is specific to an implementation.&lt;/p&gt;

&lt;p&gt;"Server-side discovery makes the API gateway handle the discovery of the right endpoint for a request."&lt;/p&gt;

&lt;p&gt;A registration library&lt;br&gt;
Here is the main logic of our library:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;module.exports.register = function(service, callback) {    
    if(!validateService(service)) {
        callback(new Error("Invalid service"));
    }

    findExisting(service.name, function(err, found) {
        if(found) {
            callback(new Error("Existing service"));
            return;
        }

        var dbService = new Service({
            name: service.name,
            url: service.url,
            endpoints: service.endpoints,
            authorizedRoles: service.authorizedRoles
        });

        dbService.save(function(err) {
            callback(err);
        });
    });
}

module.exports.unregister = function(name, callback) {
    findExisting(name, function(err, found) {
        if(!found) {
            callback(new Error("Service not found"));
            return;
        }

        found.remove(function(err) {
            callback(err);
        });
    });
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>node</category>
      <category>javascript</category>
    </item>
    <item>
      <title>How to learn React js to become a better developer</title>
      <dc:creator>kaustav karmakar</dc:creator>
      <pubDate>Tue, 16 Mar 2021 14:27:12 +0000</pubDate>
      <link>https://dev.to/kaustavkarmakar2/how-to-learn-react-js-to-become-a-better-developer-m54</link>
      <guid>https://dev.to/kaustavkarmakar2/how-to-learn-react-js-to-become-a-better-developer-m54</guid>
      <description>&lt;p&gt;1)What is &lt;code&gt;React&lt;/code&gt;?&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Component-Based&lt;br&gt;
Virtual Dom &lt;br&gt;
Runs on diffing algorithm &lt;br&gt;
It is a library.&lt;br&gt;
React makes it painless to create interactive UIs. Design simple views for each state in your application, and React will efficiently update and render just the right components when your data changes.&lt;br&gt;
2)What is virtual Dom?&lt;br&gt;
The virtual DOM (VDOM) is a programming concept where an ideal, or “virtual”, representation of a UI is kept in memory and synced with the “real” DOM by a library such as ReactDOM.&lt;/p&gt;
&lt;/blockquote&gt;

</description>
      <category>react</category>
      <category>javascript</category>
    </item>
    <item>
      <title>How to learn javascript to become a better developer.</title>
      <dc:creator>kaustav karmakar</dc:creator>
      <pubDate>Tue, 09 Mar 2021 17:54:23 +0000</pubDate>
      <link>https://dev.to/kaustavkarmakar2/how-to-learn-javascript-to-become-a-better-developer-1nen</link>
      <guid>https://dev.to/kaustavkarmakar2/how-to-learn-javascript-to-become-a-better-developer-1nen</guid>
      <description>&lt;p&gt;Prepare a bit of basic.&lt;/p&gt;

&lt;p&gt;1)Staring with let, const, and var difference. What is a variable in javascript?&lt;br&gt;
let, const is block scope where var is the global scope.&lt;br&gt;
let and var can be reassigned where const can't.&lt;code&gt;const&lt;/code&gt; is a signal that the identifier won't be reassigned.&lt;code&gt;let&lt;/code&gt; is a signal that the variable may be reassigned, such as a counter in a loop, or a value swap in an algorithm.&lt;code&gt;var&lt;/code&gt; variables can be updated and re-declared within its scope.&lt;br&gt;
Variable are of two types :&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Local scope- Local variables have Function scope. They can only be accessed from within the function.&lt;br&gt;
Global scope-A global variable has global scope. All scripts and functions on a web page can access it.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;2)How to write a function in javascript?&lt;br&gt;
A JavaScript function is defined with the function keyword, followed by a name, followed by parentheses ()&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;by using function key word say&lt;br&gt;
&lt;/p&gt;


&lt;/blockquote&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;function sayHello(){console.log("hi")};sayHello();
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;by useing fat arrow function also called arrow function like:&lt;br&gt;
&lt;/p&gt;
&lt;/blockquote&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const sayHello =()=&amp;gt;{console.log("hi")}; sayHello(); 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;What are generators in javascript?&lt;br&gt;
The function* declaration defines a generator function, which returns a Generator object.&lt;br&gt;
like:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;function* generatorSum(i){
      yield i;
      yield i+10
};
const gen = generatorSum(10);

console.log(gen.next().value);
// expected output: 10
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The Generator object is returned by a generator function and it conforms to both the iterable protocol and the iterator protocol.&lt;/p&gt;

&lt;p&gt;3)Concept of hoisting in javascript?&lt;br&gt;
 Hoisting is a property in which the variable is a move to the top of the current scope. Be careful that only declaration gets hoisted NOT the initializations.&lt;/p&gt;

&lt;p&gt;4)Concept of closure in javascript?&lt;br&gt;
A closure is a function having access to the parent scope, even after the parent is closed.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;function closureExample(i){
 return function cloureInnerVariable(y){
        return i+y;
 }
}
const value1=closureExample(1);
const value2=value1(2);
console.log("value of closure",value2);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;5)What is Curring in javascript?&lt;br&gt;
It is similar to closure.Currying is a transform that makes f(a,b,c) callable as f(a)(b)(c).&lt;br&gt;
like:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;function curringExample(w) {
  return function(h) {
    return function(l) {
      return w * h* l;
    }
  }
}

curringExample(4)(6)(3); // 72
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;6)What are prototypes in javascript?&lt;/p&gt;

&lt;p&gt;Ans: When it comes to inheritance, JavaScript only has one construct: objects. Each object has a private property that holds a link to another object called its prototype. That prototype object has a prototype of its own, and so on until an object is reached with null as its prototype. It can be using class or function.&lt;br&gt;
Like :&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;  function Animal (name, energy) {
    this.name = name
    this.energy = energy
  }

Animal.prototype.eat = function (amount) {
  console.log(`${this.name} is eating.`)
  this.energy += amount
}
or by using the extent keyword in class.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;7)Rest and spread operator in javascript?&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;A function can be called with any number of arguments, no matter how it is defined. It is called Rest operators.&lt;br&gt;
Like:&lt;br&gt;
&lt;/p&gt;
&lt;/blockquote&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;function sumAll(...args) { // args is the name for the array
  let sum = 0;

  for (let arg of args) sum += arg;

  return sum;
}

alert( sumAll(1) ); // 1
alert( sumAll(1, 2) ); // 3
alert( sumAll(1, 2, 3) ); // 6
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;Spread syntax to the rescue! It looks similar to rest parameters, also using ..., but does quite the opposite.&lt;br&gt;
&lt;/p&gt;
&lt;/blockquote&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;let arr = [3, 5, 1];
When ...arr is used in the function call, it “expands” an iterable object arr into the list of arguments.
let arr = [3, 5, 1];

alert( Math.max(...arr) ); // 5 (spread turns array into a list of arguments)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;8)Destructuring in javascript?&lt;br&gt;
The destructuring assignment syntax is a JavaScript expression that makes it possible to unpack values from arrays, or properties from objects, into distinct variables, such as&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Array :
let a, b, rest;
[a, b] = [10, 20];

console.log(a);
// expected output: 10

console.log(b);
// expected output: 20

[a, b, ...rest] = [10, 20, 30, 40, 50];

console.log(rest);
// expected output: Array [30,40,50]
Object 
const {a = 10, b = 5} = {a: 3};

console.log(a); // 3
console.log(b); // 5
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;9)Promise in javascript?&lt;br&gt;
Promises in JavaScript represent processes that are already happening, which can be chained with callback functions.&lt;br&gt;
Basically, promise is just an object, that gives us either success of async operation or failure of async operations&lt;br&gt;
1&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;var promise = new Promise(function(resolve, reject) {
  // do some long-running async thingâ€¦

  if (/* everything turned out fine */) {
    resolve("Stuff worked!");
  }
  else {
    reject(Error("It broke"));
  }
});

//usage
promise.then(
  function(result) { /* handle a successful result */ },
  function(error) { /* handle an error */ }
);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;10)Callback in javascript?&lt;br&gt;
 A callback is a function passed as an argument to another function.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;function greeting(name) {
  alert('Hello ' + name);
}

function processUserInput(callback) {
  var name = prompt('Please enter your name.');
  callback(name);
}

processUserInput(greeting);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;11) Callbackhell in javascript? &lt;br&gt;
A promise is a returned object from any asynchronous function, to which callback methods can be added based on the previous function's result. Promises use. This is a big issue caused by coding with complex nested callbacks. Here, each and every callback takes an argument that is a result of the previous callbacks. In this manner, The code structure looks like a pyramid, making it difficult to read and maintain. Also, if there is an error in one function, then all other functions get affected.&lt;br&gt;
To avoid callbackhell by using the promise or event queue.&lt;br&gt;
12)Follow a coding standard in javascript:&lt;br&gt;
By using proper documentation such as &amp;gt;&lt;a href="https://developers.google.com/apps-script/guides/docs"&gt;https://developers.google.com/apps-script/guides/docs&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;a href="https://developers.google.com/apps-script/guides/sheets/functions"&gt;https://developers.google.com/apps-script/guides/sheets/functions&lt;/a&gt;&lt;br&gt;
Name variable with a meaningful name. Use camel case All names start with a letter.&lt;br&gt;
try to use higher-order function instead of a long function.Higher-order functions are functions that operate on other functions, either by taking them as arguments or by returning them.&lt;br&gt;
Use of local scope and global scope should be taken care of when you are declaring a variable.&lt;br&gt;
Use of proper documentation is important to understand the flow of a developer .Use proper comment in code if are using any function.&lt;br&gt;
Code is the story with lots of operation and information about what you are doing.&lt;br&gt;
It is better you understand the way of logic you are using as a developer.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Thanks for Reading and understanding me to become a better developer.&lt;br&gt;
Kaustav Karmakar&lt;/p&gt;

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