<?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: Lokesh_Choudhary</title>
    <description>The latest articles on DEV Community by Lokesh_Choudhary (@lokeshchoudharylc).</description>
    <link>https://dev.to/lokeshchoudharylc</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%2F692749%2Fcc8d503d-b84b-444e-ba4e-3cff10934194.jpeg</url>
      <title>DEV Community: Lokesh_Choudhary</title>
      <link>https://dev.to/lokeshchoudharylc</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/lokeshchoudharylc"/>
    <language>en</language>
    <item>
      <title>How To Remove a Property From a JavaScript Objects 👨‍🎓🤓.</title>
      <dc:creator>Lokesh_Choudhary</dc:creator>
      <pubDate>Wed, 23 Feb 2022 02:21:20 +0000</pubDate>
      <link>https://dev.to/lokeshchoudharylc/how-to-remove-a-property-from-a-javascript-objects--e76</link>
      <guid>https://dev.to/lokeshchoudharylc/how-to-remove-a-property-from-a-javascript-objects--e76</guid>
      <description>&lt;h2&gt;
  
  
  What is a Object in JavaScript:
&lt;/h2&gt;

&lt;h6&gt;
  
  
  &lt;em&gt;Definition by MDN&lt;/em&gt;
&lt;/h6&gt;

&lt;p&gt;*Objects in JavaScript, just as in many other programming languages, can be compared to objects in real life. The concept of objects in JavaScript can be understood with real life, tangible objects.&lt;/p&gt;

&lt;p&gt;In JavaScript, an object is a standalone entity, with properties and type. Compare it with a cup, for example. A cup is an object, with properties. A cup has a color, a design, weight, a material it is made of, etc. The same way, JavaScript objects can have properties, which define their characteristics.*&lt;/p&gt;

&lt;h4&gt;
  
  
  Source: &lt;a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Working_with_Objects"&gt;link here&lt;/a&gt;
&lt;/h4&gt;

&lt;h3&gt;
  
  
  How to delete a property in a object:-
&lt;/h3&gt;

&lt;h4&gt;
  
  
  1. Using the &lt;strong&gt;delete&lt;/strong&gt; operator:-
&lt;/h4&gt;

&lt;p&gt;It is a special operation that removes a property from an object.&lt;/p&gt;

&lt;p&gt;And before I talk about how it is used , Did you know there are two ways to access a object property :-&lt;/p&gt;

&lt;h5&gt;
  
  
  1.
&lt;/h5&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const obj = {name:'cool'};
console.log(obj.name);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h5&gt;
  
  
  2.
&lt;/h5&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const obj = {name:'cool'};
console.log(obj[name]);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now using the &lt;strong&gt;delete&lt;/strong&gt; operator:&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 = {name:'cool', age:20};
delete obj.name;
or
delete obj[name]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;em&gt;delete operator is mutable , just a fancy of saying that it modify the object permanently.&lt;/em&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  2. Using destructuring:-
&lt;/h4&gt;

&lt;p&gt;Destructuring in Javscript is used to unpack values or properties from Arrays or objects.&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 = {name:'cool', age:20};
const {name, age} = obj;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Same way to delete/remove use the syntax:-&lt;/p&gt;

&lt;p&gt;const {prop,...restObj} = obj;&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 = {name:'cool', age:20 , class:A};
const {name, ...remainingProp} = obj;
console.log(name);
console.log(remainingProp);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This way to do this immutable that means the original object remains same as before but still we get access to single property and other remaining properties , in this case &lt;strong&gt;name&lt;/strong&gt; is not present in the &lt;strong&gt;remainingProp&lt;/strong&gt;.&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>beginners</category>
      <category>programming</category>
    </item>
    <item>
      <title>JavaScript Promises The Easy Way👨‍🎓🤓.</title>
      <dc:creator>Lokesh_Choudhary</dc:creator>
      <pubDate>Thu, 26 Aug 2021 05:55:03 +0000</pubDate>
      <link>https://dev.to/lokeshchoudharylc/javascript-promises-the-easy-way-41a5</link>
      <guid>https://dev.to/lokeshchoudharylc/javascript-promises-the-easy-way-41a5</guid>
      <description>&lt;h1&gt;
  
  
  What is a Promise in JavaScript:
&lt;/h1&gt;

&lt;h6&gt;
  
  
  &lt;em&gt;Definition by MDN:&lt;/em&gt;
&lt;/h6&gt;

&lt;p&gt;&lt;em&gt;A Promise is a proxy for a value not necessarily known when the promise is created. It allows you to associate handlers with an asynchronous action's eventual success value or failure reason. This lets asynchronous methods return values like synchronous methods: instead of immediately returning the final value, the asynchronous method returns a promise to supply the value at some point in the future.&lt;/em&gt;&lt;/p&gt;

&lt;h6&gt;
  
  
  Source(MDN): &lt;a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise" rel="noopener noreferrer"&gt;Link Here&lt;/a&gt;
&lt;/h6&gt;

&lt;h4&gt;
  
  
  Thanks for reading, I hope now you now understand everything.
&lt;/h4&gt;

&lt;p&gt;What, No? Didn't Understand.&lt;/p&gt;

&lt;p&gt;No problem that why I am here writing this beautiful article for you.&lt;/p&gt;

&lt;h3&gt;
  
  
  The literal meaning of a promise.
&lt;/h3&gt;

&lt;p&gt;&lt;em&gt;Your parents promised you to buy a new computer, but on a condition that you have to get good grades in school&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;In our real life this is a meaning of a Promise, So it highly depends that you could get a new computer or couldn't if you didn't get good grades in school and even if you did well in exams until the results come the promise from your parent will be in a pending state.  &lt;/p&gt;

&lt;p&gt;Just like that in JavaScript Programming a Promise has three states:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Pending:&lt;br&gt;
&lt;em&gt;You will either get new computer or not.&lt;/em&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Fulfilled/Resolved:&lt;br&gt;
&lt;em&gt;You will get a new computer for sure.&lt;/em&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Rejected:&lt;br&gt;
&lt;em&gt;Sorry, you will not get a new computer.&lt;/em&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  Now enough for the example lets get started with some coding🤩💻.
&lt;/h4&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fielny44dfj5w2t1cydw7.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fielny44dfj5w2t1cydw7.png" alt="code"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;So what is happening is this code example is that, I have assigned a boolean value &lt;code&gt;goodGrades&lt;/code&gt; and also in some real world cases this could be a external fetch request you are making to get some data or any other function for which you are not sure to get a result that's why you use a Promise.&lt;/p&gt;

&lt;p&gt;If &lt;code&gt;goodGrades&lt;/code&gt; is true you the Promise will resolve or otherwise if false the Promise will reject and give the specified Error (reason).&lt;/p&gt;

&lt;p&gt;Also you can chain a Promise with &lt;code&gt;then()&lt;/code&gt; and &lt;code&gt;catch()&lt;/code&gt; or put in a &lt;code&gt;try catch&lt;/code&gt; block.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;So this is the most basic way I could found to explain JavaScript Promises.&lt;/strong&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Thanks for reading.
&lt;/h3&gt;

&lt;p&gt;This is my first post here, feedbacks are appreciated.&lt;/p&gt;

&lt;p&gt;And also about what topic should I write next?&lt;br&gt;
More on JavaScript?&lt;br&gt;
Backend with NodeJs/ExpressJs?&lt;br&gt;
Databases?&lt;br&gt;
Or Anything else.&lt;/p&gt;

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