<?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: Sushil Shrestha</title>
    <description>The latest articles on DEV Community by Sushil Shrestha (@shoesheill).</description>
    <link>https://dev.to/shoesheill</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%2F256767%2F716f945c-401c-459a-8672-6895b1c4eb1e.jpeg</url>
      <title>DEV Community: Sushil Shrestha</title>
      <link>https://dev.to/shoesheill</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/shoesheill"/>
    <language>en</language>
    <item>
      <title>Answer: Root element is missing</title>
      <dc:creator>Sushil Shrestha</dc:creator>
      <pubDate>Fri, 20 Dec 2019 05:12:21 +0000</pubDate>
      <link>https://dev.to/shoesheill/answer-root-element-is-missing-1ae7</link>
      <guid>https://dev.to/shoesheill/answer-root-element-is-missing-1ae7</guid>
      <description>&lt;div class="ltag__stackexchange--container"&gt;
  &lt;div class="ltag__stackexchange--title-container"&gt;
    
      &lt;div class="ltag__stackexchange--title"&gt;
        &lt;h1&gt;
          &lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--pTF_nE4a--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://practicaldev-herokuapp-com.freetls.fastly.net/assets/stackoverflow-logo-b42691ae545e4810b105ee957979a853a696085e67e43ee14c5699cf3e890fb4.svg" alt=""&gt;
            &lt;a href="https://stackoverflow.com/questions/10125810/root-element-is-missing/10125944#10125944" rel="noopener noreferrer"&gt;
              &lt;span class="title-flare"&gt;answer&lt;/span&gt; re:  Root element is missing
            &lt;/a&gt;
        &lt;/h1&gt;
        &lt;div class="ltag__stackexchange--post-metadata"&gt;
          &lt;span&gt;Apr 12 '12&lt;/span&gt;
        &lt;/div&gt;
      &lt;/div&gt;
      &lt;a class="ltag__stackexchange--score-container" href="https://stackoverflow.com/questions/10125810/root-element-is-missing/10125944#10125944" rel="noopener noreferrer"&gt;
        &lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--5MiFESHx--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://practicaldev-herokuapp-com.freetls.fastly.net/assets/stackexchange-arrow-up-eff2e2849e67d156181d258e38802c0b57fa011f74164a7f97675ca3b6ab756b.svg" alt=""&gt;
        &lt;div class="ltag__stackexchange--score-number"&gt;
          12
        &lt;/div&gt;
        &lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Rk_a5QFN--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://practicaldev-herokuapp-com.freetls.fastly.net/assets/stackexchange-arrow-down-4349fac0dd932d284fab7e4dd9846f19a3710558efde0d2dfd05897f3eeb9aba.svg" alt=""&gt;
      &lt;/a&gt;
    
  &lt;/div&gt;
  &lt;div class="ltag__stackexchange--body"&gt;
    
&lt;p&gt;Make sure you XML looks like this:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;&amp;lt;?xml version="1.0" encoding="utf-8"?&amp;gt;
&amp;lt;rootElement&amp;gt;
...
&amp;lt;/rootElement&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Also, a blank XML file will return the same Root elements is missing exception. Each XML file must have a root element / node which encloses all the other elements.&lt;/p&gt;

    
  &lt;/div&gt;
  &lt;div class="ltag__stackexchange--btn--container"&gt;
    
      &lt;a href="https://stackoverflow.com/questions/10125810/root-element-is-missing/10125944#10125944" rel="noopener noreferrer"&gt;Open Full Answer&lt;/a&gt;
    
  &lt;/div&gt;
&lt;/div&gt;


</description>
    </item>
    <item>
      <title>Answer: Using jQuery .append should add new li with the value from input field, but it only add empty li</title>
      <dc:creator>Sushil Shrestha</dc:creator>
      <pubDate>Thu, 19 Dec 2019 15:38:39 +0000</pubDate>
      <link>https://dev.to/shoesheill/answer-using-jquery-append-should-add-new-li-with-the-value-from-input-field-but-it-only-add-empty-li-3ja1</link>
      <guid>https://dev.to/shoesheill/answer-using-jquery-append-should-add-new-li-with-the-value-from-input-field-but-it-only-add-empty-li-3ja1</guid>
      <description>&lt;div class="ltag__stackexchange--container"&gt;
  &lt;div class="ltag__stackexchange--title-container"&gt;
    
      &lt;div class="ltag__stackexchange--title"&gt;
        &lt;h1&gt;
          &lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--pTF_nE4a--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://practicaldev-herokuapp-com.freetls.fastly.net/assets/stackoverflow-logo-b42691ae545e4810b105ee957979a853a696085e67e43ee14c5699cf3e890fb4.svg" alt=""&gt;
            &lt;a href="https://stackoverflow.com/questions/59153845/using-jquery-append-should-add-new-li-with-the-value-from-input-field-but-it-o/59154286#59154286" rel="noopener noreferrer"&gt;
              &lt;span class="title-flare"&gt;answer&lt;/span&gt; re:  Using jQuery .append should add new li with the value from input field, but it only add empty li
            &lt;/a&gt;
        &lt;/h1&gt;
        &lt;div class="ltag__stackexchange--post-metadata"&gt;
          &lt;span&gt;Dec  3 '19&lt;/span&gt;
        &lt;/div&gt;
      &lt;/div&gt;
      &lt;a class="ltag__stackexchange--score-container" href="https://stackoverflow.com/questions/59153845/using-jquery-append-should-add-new-li-with-the-value-from-input-field-but-it-o/59154286#59154286" rel="noopener noreferrer"&gt;
        &lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--5MiFESHx--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://practicaldev-herokuapp-com.freetls.fastly.net/assets/stackexchange-arrow-up-eff2e2849e67d156181d258e38802c0b57fa011f74164a7f97675ca3b6ab756b.svg" alt=""&gt;
        &lt;div class="ltag__stackexchange--score-number"&gt;
          3
        &lt;/div&gt;
        &lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Rk_a5QFN--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://practicaldev-herokuapp-com.freetls.fastly.net/assets/stackexchange-arrow-down-4349fac0dd932d284fab7e4dd9846f19a3710558efde0d2dfd05897f3eeb9aba.svg" alt=""&gt;
      &lt;/a&gt;
    
  &lt;/div&gt;
  &lt;div class="ltag__stackexchange--body"&gt;
    
&lt;p&gt;Your code &lt;code&gt;let currentItem = $('#newItem').val();&lt;/code&gt; Doesn't works because it is outside button &lt;code&gt;click event&lt;/code&gt;. So execute &lt;code&gt;let currentItem = $('#newItem').val();&lt;/code&gt;only after the button is &lt;code&gt;clicked&lt;/code&gt;. I would like to suggest to &lt;code&gt;bind&lt;/code&gt; and &lt;code&gt;unbind&lt;/code&gt; the event while using &lt;code&gt;click&lt;/code&gt; events. And also check the if the…&lt;/p&gt;
    
  &lt;/div&gt;
  &lt;div class="ltag__stackexchange--btn--container"&gt;
    
      &lt;a href="https://stackoverflow.com/questions/59153845/using-jquery-append-should-add-new-li-with-the-value-from-input-field-but-it-o/59154286#59154286" rel="noopener noreferrer"&gt;Open Full Answer&lt;/a&gt;
    
  &lt;/div&gt;
&lt;/div&gt;


</description>
    </item>
    <item>
      <title>Hacktoberfest2019 Swag Redeemed</title>
      <dc:creator>Sushil Shrestha</dc:creator>
      <pubDate>Thu, 24 Oct 2019 11:00:14 +0000</pubDate>
      <link>https://dev.to/shoesheill/hacktoberfest2019-swag-redeemed-37fa</link>
      <guid>https://dev.to/shoesheill/hacktoberfest2019-swag-redeemed-37fa</guid>
      <description>&lt;p&gt;I just redeemed my #hacktoberfest2019 swag. Excited to receive, and have a selfie  with #hacktoberfest2019 T-Shirt.&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fthepracticaldev.s3.amazonaws.com%2Fi%2F9myl3k7krbnzcntviopb.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%2Fthepracticaldev.s3.amazonaws.com%2Fi%2F9myl3k7krbnzcntviopb.PNG" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>hacktoberfest</category>
      <category>opensource</category>
    </item>
    <item>
      <title>Spread Operator, Javascript</title>
      <dc:creator>Sushil Shrestha</dc:creator>
      <pubDate>Thu, 24 Oct 2019 05:06:10 +0000</pubDate>
      <link>https://dev.to/shoesheill/spread-operator-javascript-1fh4</link>
      <guid>https://dev.to/shoesheill/spread-operator-javascript-1fh4</guid>
      <description>&lt;h1&gt;
  
  
  Spread Operator
&lt;/h1&gt;

&lt;p&gt;To start with, the unfold operator is .... thus you'll write one thing like:&lt;/p&gt;

&lt;p&gt;1&lt;br&gt;
2&lt;br&gt;
const cat = four };&lt;br&gt;
; // this is not helpful (yet), however it's valid&lt;br&gt;
As of ES6, exploitation 3 dots in an exceedingly row is valid code and pretty helpful code at that! ... spreads out the content thus you'll manipulate it a lot of simply.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Let’s consider some examples.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;... to repeat AN object&lt;br&gt;
It’s pretty common to require to base one object off of another, one thing like this:&lt;/p&gt;

&lt;p&gt;1&lt;br&gt;
2&lt;br&gt;
3&lt;br&gt;
var cat = four };&lt;br&gt;
var kitten = cat;&lt;br&gt;
kitten.age = 1;&lt;br&gt;
Doesn’t that have a bug?&lt;/p&gt;

&lt;p&gt;Yes! kitten and cat talk over with constant object. we tend to didn’t produce a replacement object for kitten to reference, we tend to simply pointed kitten to the prevailing cat object. you'll see that here:&lt;/p&gt;

&lt;p&gt;1&lt;br&gt;
2&lt;br&gt;
console.log(kitten.age); // 1&lt;br&gt;
console.log(cat.age); // one &amp;lt;-- problem!&lt;br&gt;
Using the unfold operator we are able to simply produce a replacement object with all constant properties of AN existing object.&lt;/p&gt;

&lt;p&gt;1&lt;br&gt;
2&lt;br&gt;
3&lt;br&gt;
4&lt;br&gt;
5&lt;br&gt;
const cat = four };&lt;br&gt;
const kitten = ; // &amp;lt;-- modified&lt;br&gt;
kitten.age = 1;&lt;br&gt;
console.log(kitten.age); // 1&lt;br&gt;
console.log(cat.age); // four &amp;lt;-- fixed!&lt;br&gt;
You can see that we tend to created a replacement object for kitten to reference after we used the unfold operator.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Can you make a case for the line a bit?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Sure thing, the we would like to form a replacement object. Next, the ...cat says that we would like that new object to contain all constant contents because the cat object. and eventually, } means we’re finished thereupon object and don’t need to feature anything to the article.&lt;/p&gt;

&lt;h3&gt;
  
  
  Warning!
&lt;/h3&gt;

&lt;p&gt;It’s fairly common for folks to expect ... to provide a deep copy. Let’s be cleare The unfold operator doesn't deep copy, whereas the unfold operator will produce a replacement object, the properties’ values ar merely references and not new instances. For example:&lt;/p&gt;

&lt;p&gt;1&lt;br&gt;
2&lt;br&gt;
3&lt;br&gt;
4&lt;br&gt;
5&lt;br&gt;
const cat = four, toys: ["mouse", "catnip"] };&lt;br&gt;
const kitten = ;&lt;br&gt;
kitten.toys[1] = "yarn";&lt;br&gt;
console.log(kitten.toys); // ["mouse", "yarn"]&lt;br&gt;
console.log(cat.toys); // ["mouse", "yarn"] &amp;lt;-- problem!&lt;br&gt;
So exploitation the unfold operator to form new objects can be fine, it would cause uncaused aspect effects. Please be careful!&lt;/p&gt;

&lt;p&gt;... as AN object base&lt;br&gt;
So far we've solely used ... to form a replica of AN existing object, however it’s really a lot of powerful than that. We’ll use a unique example to feature a replacement property to AN object created with the unfold operator:&lt;/p&gt;

&lt;p&gt;1&lt;br&gt;
2&lt;br&gt;
3&lt;br&gt;
4&lt;br&gt;
5&lt;br&gt;
6&lt;br&gt;
7&lt;br&gt;
const cat = { legs: four };&lt;br&gt;
const dog = "&amp;gt;;&lt;br&gt;
console.log(cat); // { legs: four }&lt;br&gt;
console.log(dog); // { legs: four, sound: "woof" }&lt;br&gt;
Again, you'll see the cat object wasn’t modified, however the new dog object has all the properties from cat in addition because the new property.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;But cats create sounds too, what happens if you assign the property to cat?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;1&lt;br&gt;
2&lt;br&gt;
3&lt;br&gt;
4&lt;br&gt;
5&lt;br&gt;
6&lt;br&gt;
7&lt;br&gt;
const cat = { legs: four, sound: "meow" };&lt;br&gt;
const dog = "&amp;gt;;&lt;br&gt;
console.log(cat); // { legs: four, sound: "meow" }&lt;br&gt;
console.log(dog); // { legs: four, sound: "woof" }&lt;br&gt;
Everything works precisely like you’d hope it would! The cat object has the new property, with "meow" properly appointed. and therefore the dog object is made with the property set to "woof".&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Let’s scrutinize those lines a lot of closely:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;1&lt;br&gt;
2&lt;br&gt;
3&lt;br&gt;
4&lt;br&gt;
const dog = "&amp;gt;;&lt;br&gt;
Just like before, the { starts a replacement object. Then exploitation the unfold operator on cat adds all the cat properties to the new object. Our new sound: "woof" overwrites the prevailing property from cat. and eventually we've got the } to complete our new object.&lt;/p&gt;

&lt;h3&gt;
  
  
  Warning!
&lt;/h3&gt;

&lt;p&gt;The line order maters for this to figure. we want sound: "woof" to return when ...cat therefore the write happens. This version doesn't do what we tend to want:&lt;/p&gt;

&lt;p&gt;1&lt;br&gt;
2&lt;br&gt;
3&lt;br&gt;
4&lt;br&gt;
5&lt;br&gt;
6&lt;br&gt;
7&lt;br&gt;
const cat = { legs: four, sound: "meow" };&lt;br&gt;
const dog = ...cat&lt;br&gt;
"&amp;gt;;&lt;br&gt;
console.log(cat); // { legs: four, sound: "meow" }&lt;br&gt;
console.log(dog); // { legs: four, sound: "meow" }&lt;br&gt;
Because we tend to place the ...cat when the sound: "woof" the cat's property overwrote the sound: "woof" property.&lt;/p&gt;

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