<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Untitled Publication]]></title><description><![CDATA[Untitled Publication]]></description><link>https://shihabnodes.hashnode.dev</link><generator>RSS for Node</generator><lastBuildDate>Tue, 15 Sep 2026 17:57:06 GMT</lastBuildDate><atom:link href="https://shihabnodes.hashnode.dev/rss.xml" rel="self" type="application/rss+xml"/><language><![CDATA[en]]></language><ttl>60</ttl><item><title><![CDATA[JavaScript point]]></title><description><![CDATA[Put & Patch
Put:
put move the hole ice cream.
Patch:
patch moves only ice cream cubes.

Graphical view
source from @VikasRajput]]></description><link>https://shihabnodes.hashnode.dev/javascript-point</link><guid isPermaLink="true">https://shihabnodes.hashnode.dev/javascript-point</guid><category><![CDATA[ @problematicConceptClear]]></category><category><![CDATA[@graphicalExplanition]]></category><category><![CDATA[@putVsPatchInJs]]></category><dc:creator><![CDATA[shihab_kabir]]></dc:creator><pubDate>Tue, 05 Mar 2024 14:41:31 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1709648542217/f88e2f64-7429-4f46-af87-1adfc0931a44.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<h3 id="heading-put-amp-patch"><strong>Put &amp; Patch</strong></h3>
<h3 id="heading-put">Put:</h3>
<h3 id="heading-put-move-the-hole-ice-cream">put move the hole ice cream.</h3>
<h3 id="heading-patch"><strong>Patch:</strong></h3>
<h3 id="heading-patch-moves-only-ice-cream-cubes">patch moves only ice cream cubes.</h3>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1709645852558/39c9ec8e-10ef-4936-88e9-f318c328acdd.png" alt class="image--center mx-auto" /></p>
<p><a target="_blank" href="https://www.linkedin.com/posts/vikasrajputin_http-put-vs-patch-simplified-put-method-activity-7122439314218586112-zLhD?utm_source=share&amp;utm_medium=member_desktop">Graphical view</a></p>
<p>source from @<a target="_blank" href="https://www.linkedin.com/in/vikasrajputin/">VikasRajpu</a>t</p>
]]></content:encoded></item><item><title><![CDATA[JS Array & Use case]]></title><description><![CDATA[The array is just a collection of data & it is an object. Array data sets are integrated index-wise. [ ]=This is called notation. JS array is mutable which means after declaration you can change data & that wouldn't take more memory, you can replace ...]]></description><link>https://shihabnodes.hashnode.dev/js-array-use-case</link><guid isPermaLink="true">https://shihabnodes.hashnode.dev/js-array-use-case</guid><category><![CDATA[JavaScript]]></category><category><![CDATA[array]]></category><category><![CDATA[array methods]]></category><dc:creator><![CDATA[shihab_kabir]]></dc:creator><pubDate>Mon, 03 Apr 2023 10:44:06 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1680425299330/c64d8595-313e-4fb8-89ec-5a31f1f60e6b.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>The array is just a collection of data &amp; it is an object. Array data sets are integrated index-wise. [ ]=This is called notation. JS array is mutable which means after declaration you can change data &amp; that wouldn't take more memory, you can replace the data without increasing memory space.</p>
<h3 id="heading-array-benefit">Array benefit</h3>
<ul>
<li><p>Easily Traverse</p>
</li>
<li><p>Filter</p>
</li>
<li><p>Delete</p>
</li>
<li><p>Update</p>
</li>
<li><p>Create new data</p>
</li>
</ul>
<h3 id="heading-js-array-is-dynamic">JS array is dynamic</h3>
<ul>
<li><p>Don't need to Specify the array type in high-level languages like JS or Python. In the other language, you have to specify the array type. Exp: C, C++, Java.</p>
</li>
<li><p>Array size can increase/decrease. but other language array sizes are fixed.</p>
</li>
<li><p>Don't need to collect garbage value.</p>
</li>
</ul>
<p>can store any kind of data. Exp:</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1680381888345/9bc7d837-5969-4958-8fad-c9a99e490627.png" alt class="image--center mx-auto" /></p>
<h3 id="heading-multidimensional-array">Multidimensional array</h3>
<p>this array has two things column and a row. To find the data we will have two for loops one for the column &amp; another for the row.</p>
<div class="hn-table">
<table>
<thead>
<tr>
<td>name</td><td>Job</td><td>hobby</td></tr>
</thead>
<tbody>
<tr>
<td>Shihab</td><td>Freelancer</td><td>farming</td></tr>
<tr>
<td>Fehim</td><td>businessman</td><td>Gamer</td></tr>
<tr>
<td>Onto</td><td>Businessman</td><td>Model</td></tr>
</tbody>
</table>
</div><p>if we want the hobby of fehim then the code will look like</p>
<pre><code class="lang-javascript">person [<span class="hljs-number">3</span>][<span class="hljs-number">3</span>]=<span class="hljs-string">"Gamer"</span>
</code></pre>
<p>Find out the length &amp; LastIndex</p>
<pre><code class="lang-javascript">length =lastIndex +<span class="hljs-number">1</span>
lastIndex=length <span class="hljs-number">-1</span>
</code></pre>
<h3 id="heading-array-literal">Array Literal</h3>
<p>Totaly on use it is not the dynamic way Most of cases we will use this method.</p>
<pre><code class="lang-javascript"><span class="hljs-keyword">const</span> arr=[ <span class="hljs-number">3</span>, <span class="hljs-number">4</span>,<span class="hljs-number">5</span>,<span class="hljs-number">6</span>,<span class="hljs-number">98</span>]
consol.log(arr.length)
consol.log(arr)
</code></pre>
<h3 id="heading-contractor-pattern">Contractor pattern</h3>
<p>js have two away to build object 1/Contractor pattern. 2/ factory pattern.<br />sometimes we have to give array length first in that cases we have to use a constructor pattern</p>
<pre><code class="lang-javascript"><span class="hljs-keyword">const</span> a1= <span class="hljs-keyword">new</span> <span class="hljs-built_in">Array</span>(<span class="hljs-number">5</span>,<span class="hljs-number">33</span>,<span class="hljs-number">5</span>,<span class="hljs-number">6</span>,<span class="hljs-number">7</span>)  <span class="hljs-comment">//in this case we are giving array length (5) first</span>
<span class="hljs-built_in">console</span>.log(a1.length)
</code></pre>
<h3 id="heading-factory-pattern">Factory pattern</h3>
<p><strong>The main difference with the Constructor pattern is New But the prototype are same</strong></p>
<pre><code class="lang-javascript"><span class="hljs-keyword">const</span> a1= <span class="hljs-built_in">Array</span>(<span class="hljs-number">5</span>)  <span class="hljs-comment">//in this case we are giving array length (5,33,5,6,7) and New is not here</span>
<span class="hljs-built_in">console</span>.log(a1.length)
</code></pre>
<h3 id="heading-array-traversing">Array traversing</h3>
<p>The benefit of traversing is to do a sum, average, greater number, and smaller number find out.</p>
<pre><code class="lang-javascript">
<span class="hljs-keyword">const</span> arr = [<span class="hljs-number">2</span>, <span class="hljs-number">34</span>, <span class="hljs-number">346</span>, <span class="hljs-number">54</span>, <span class="hljs-number">131</span>, <span class="hljs-number">65</span>, <span class="hljs-number">435</span>, <span class="hljs-number">24</span>, <span class="hljs-number">345</span>, <span class="hljs-number">5</span>, <span class="hljs-number">23</span>, <span class="hljs-number">35</span>, <span class="hljs-number">33</span>, <span class="hljs-number">43</span>]
<span class="hljs-keyword">let</span> Largest = <span class="hljs-number">0</span>
<span class="hljs-keyword">let</span> Smallest = <span class="hljs-number">0</span>
<span class="hljs-keyword">let</span> secondLargest = <span class="hljs-number">0</span>
<span class="hljs-keyword">let</span> secondSmallest = <span class="hljs-number">0</span>

<span class="hljs-keyword">let</span> sum=<span class="hljs-number">0</span>
<span class="hljs-keyword">for</span> (<span class="hljs-keyword">let</span> i=<span class="hljs-number">0</span>;i&lt;arr.length;i++){
    sum+=sum[i]
}
<span class="hljs-built_in">console</span>.log(sum)            <span class="hljs-comment">//find out sum number</span>
<span class="hljs-built_in">console</span>.log(sum/arr.length)  <span class="hljs-comment">//find out averagr number</span>
<span class="hljs-keyword">let</span> largestNumber=arr[<span class="hljs-number">0</span>]       <span class="hljs-comment">//find out largest number</span>
<span class="hljs-keyword">for</span> (<span class="hljs-keyword">let</span> i=<span class="hljs-number">1</span>;i&lt;arr.length;i++){
    <span class="hljs-keyword">if</span>(arr[i]&gt;largestNumber){
    largestNumber=arr[i]}
}
<span class="hljs-built_in">console</span>.log(largestNumber)


<span class="hljs-keyword">for</span> (<span class="hljs-keyword">let</span> i = <span class="hljs-number">0</span>; i &lt; arr.length; i++) {
    <span class="hljs-keyword">if</span> (arr[i] &gt; Largest) {            <span class="hljs-comment">//find out secondLargest number</span>
        secondLargest = Largest
        Largest = arr[i]
    } <span class="hljs-keyword">else</span> <span class="hljs-keyword">if</span> (arr[i] &gt; secondLargest &amp;&amp; Largest != secondLargest) {
        secondLargest = arr[i]
    }
}
<span class="hljs-built_in">console</span>.log(<span class="hljs-string">"secondLargest :"</span>, secondLargest)



<span class="hljs-keyword">let</span> smallestNumber = arr[<span class="hljs-number">0</span>] <span class="hljs-comment">//find out smallest number</span>
<span class="hljs-keyword">for</span> (<span class="hljs-keyword">let</span> i = <span class="hljs-number">1</span>; i &lt; arr.length; i++) {
    <span class="hljs-keyword">if</span> (arr[i] &lt; smallestNumber) {
        smallestNumber = arr[i]
    }

}
<span class="hljs-built_in">console</span>.log(<span class="hljs-string">"Smallest :"</span>, smallestNumber)


<span class="hljs-keyword">for</span> (<span class="hljs-keyword">let</span> i = <span class="hljs-number">0</span>; i &lt; arr.length; i++) {
    <span class="hljs-keyword">if</span> (arr[i] &gt; Smallest) {        <span class="hljs-comment">//find out secondSmallest number</span>
        secondSmallest = Smallest
        Smallest = arr[i]
    } <span class="hljs-keyword">else</span> <span class="hljs-keyword">if</span> (arr[i] &lt; secondSmallest &amp;&amp; Smallest != secondSmallest) {
        secondSmallest = arr[i]
    }
}
<span class="hljs-built_in">console</span>.log(<span class="hljs-string">"secondSmallest :"</span>, secondSmallest)
</code></pre>
<h2 id="heading-array-update">Array update</h2>
<h3 id="heading-array-fill-manual-away">Array fill manual away</h3>
<pre><code class="lang-javascript"><span class="hljs-keyword">const</span> arr1 = <span class="hljs-keyword">new</span> <span class="hljs-built_in">Array</span>(<span class="hljs-number">10</span>);
<span class="hljs-keyword">for</span> (<span class="hljs-keyword">let</span> i = <span class="hljs-number">0</span>; i &lt; arr1.length; i++) {
    arr1[i] = <span class="hljs-literal">false</span>
}
<span class="hljs-built_in">console</span>.log(arr1)
</code></pre>
<h3 id="heading-array-fill-method">Array fill method</h3>
<pre><code class="lang-javascript">
<span class="hljs-keyword">const</span> arr2 = <span class="hljs-keyword">new</span> <span class="hljs-built_in">Array</span>(<span class="hljs-number">10</span>);
arr2.fill(<span class="hljs-number">0</span>);
<span class="hljs-built_in">console</span>.log(arr2)
</code></pre>
<h3 id="heading-specifically-array-fill">Specifically array fill</h3>
<pre><code class="lang-javascript"><span class="hljs-keyword">const</span> names = [<span class="hljs-string">"shihab"</span>, <span class="hljs-string">"fehim"</span>, <span class="hljs-string">"onto"</span>]
names[<span class="hljs-number">0</span>] = <span class="hljs-string">"shihab kabir"</span>
names[<span class="hljs-number">1</span>] = <span class="hljs-string">"fehim kabir"</span>
names[<span class="hljs-number">3</span>] = <span class="hljs-string">"onto kobir"</span>
<span class="hljs-built_in">console</span>.log(names)
</code></pre>
<h3 id="heading-array-fill-amp-update">Array fill &amp; update</h3>
<pre><code class="lang-javascript"><span class="hljs-keyword">const</span> response = <span class="hljs-keyword">new</span> <span class="hljs-built_in">Array</span>(<span class="hljs-number">9</span>)
response.fill(<span class="hljs-literal">false</span>)
<span class="hljs-keyword">for</span> (<span class="hljs-keyword">let</span> i = <span class="hljs-number">0</span>; i &lt; response.length; i++) {
    <span class="hljs-keyword">const</span> rand = <span class="hljs-built_in">Math</span>.floor(<span class="hljs-built_in">Math</span>.random() * <span class="hljs-number">10</span> + <span class="hljs-number">1</span>);
    response[i] = rand &gt; <span class="hljs-number">5</span> ? <span class="hljs-string">"X"</span> : <span class="hljs-string">"O"</span>
}
<span class="hljs-built_in">console</span>.log(response)
</code></pre>
<h2 id="heading-everything-in-array">Everything in Array</h2>
<h3 id="heading-array-of-object">Array of Object</h3>
<pre><code class="lang-javascript"><span class="hljs-keyword">const</span> faveChanal=[        <span class="hljs-comment">//here we have a object</span>
{<span class="hljs-attr">name</span>:<span class="hljs-string">"Stack learner"</span> ,<span class="hljs-attr">url</span>:<span class="hljs-string">"https://www.youtube.com/playlist?list=PL_XxuZqN0xVD0op-QDEgyXFA4fRPChvkl"</span>}

{<span class="hljs-attr">name</span>:<span class="hljs-string">"Traversy media"</span> ,<span class="hljs-attr">url</span>:<span class="hljs-string">"https://www.youtube.com/@TraversyMedia/playlists"</span>}

{<span class="hljs-attr">name</span>:<span class="hljs-string">"wes Bos"</span> ,<span class="hljs-attr">url</span>:<span class="hljs-string">"https://www.youtube.com/results?search_query=wes+bos"</span>}

{<span class="hljs-attr">name</span>:<span class="hljs-string">"freeCodeCamp"</span> ,<span class="hljs-attr">url</span>:<span class="hljs-string">"https://www.youtube.com/results?search_query=freecodecamp"</span>}
]
</code></pre>
<h3 id="heading-array-of-functions">Array of functions</h3>
<pre><code class="lang-javascript"><span class="hljs-keyword">const</span> sum = <span class="hljs-function">(<span class="hljs-params">a, b</span>) =&gt;</span> a + b; <span class="hljs-comment">//here we have functions</span>
<span class="hljs-keyword">const</span> sub = <span class="hljs-function">(<span class="hljs-params">a, b</span>) =&gt;</span> a - b;
<span class="hljs-keyword">const</span> multi = <span class="hljs-function">(<span class="hljs-params">a, b</span>) =&gt;</span> a * b;
<span class="hljs-keyword">const</span> div = <span class="hljs-function">(<span class="hljs-params">a, b</span>) =&gt;</span> a / b;
<span class="hljs-keyword">const</span> mod = <span class="hljs-function">(<span class="hljs-params">a, b</span>) =&gt;</span> a % b;
<span class="hljs-keyword">const</span> funcs = [sum, sub, multi, div, mod] <span class="hljs-comment">//here all function in array</span>
<span class="hljs-keyword">const</span> a = <span class="hljs-number">10</span>,
    b = <span class="hljs-number">20</span>;
<span class="hljs-keyword">for</span> (<span class="hljs-keyword">let</span> i = <span class="hljs-number">0</span>; i &lt; funcs.length; i++) {
    <span class="hljs-keyword">const</span> result = funcs[i](a, b)
    <span class="hljs-built_in">console</span>.log(<span class="hljs-string">`[<span class="hljs-subst">${funcs[i].name}</span>] Result= <span class="hljs-subst">${result}</span>`</span>)
}
</code></pre>
<h3 id="heading-multi-dimensional-array">multi-dimensional Array</h3>
<p>in multi-dimension, we need two loops or nested loops.</p>
<pre><code class="lang-javascript"><span class="hljs-keyword">const</span> twoDimArray = [
    [<span class="hljs-number">1</span>, <span class="hljs-number">2</span>, <span class="hljs-number">3</span>],
    [<span class="hljs-number">4</span>, <span class="hljs-number">6</span>],
    [<span class="hljs-number">7</span>, <span class="hljs-number">8</span>, <span class="hljs-number">9</span>, <span class="hljs-number">20</span>]
];

<span class="hljs-keyword">for</span> (<span class="hljs-keyword">let</span> i = <span class="hljs-number">0</span>; i &lt; twoDimArray.length; i++) {
    <span class="hljs-keyword">for</span> (<span class="hljs-keyword">let</span> j = <span class="hljs-number">0</span>; j &lt; twoDimArray[i].length; j++) {  <span class="hljs-comment">//here twoDimArray[i]=([i]) mean numberIndex &amp; .length mean= sub-array length</span>
        <span class="hljs-built_in">console</span>.log(<span class="hljs-string">`Element at index [<span class="hljs-subst">${i}</span>][<span class="hljs-subst">${j}</span>] is <span class="hljs-subst">${twoDimArray[i][j]}</span>`</span>);
    }
}
</code></pre>
<h3 id="heading-add-in-array">Add in Array</h3>
<p>Unshift is used to add data in the 0 indexes.</p>
<pre><code class="lang-javascript"><span class="hljs-keyword">const</span> arr1 = [<span class="hljs-number">1</span>, <span class="hljs-number">2</span>, <span class="hljs-number">3</span>];
<span class="hljs-keyword">const</span> arr2 = [<span class="hljs-number">8</span>, <span class="hljs-number">9</span>];
arr1[arr1.length] = <span class="hljs-number">4</span>;
<span class="hljs-comment">//this is genaral method</span>
arr1.push(<span class="hljs-number">5</span>);
arr1.push(<span class="hljs-number">8</span>, <span class="hljs-number">9</span>)
<span class="hljs-built_in">console</span>.log(arr1)
<span class="hljs-comment">//this is push method</span>
arr1.push(...arr2)
<span class="hljs-comment">//this is new method for combind two array</span>
<span class="hljs-built_in">Array</span>.prototype.push.apply(arr1, arr2)
<span class="hljs-built_in">console</span>.log(arr1)
<span class="hljs-comment">//this is old method to combind to array</span>

<span class="hljs-keyword">const</span> arr3 = [<span class="hljs-number">6</span>, <span class="hljs-number">7</span>, <span class="hljs-number">8</span>]
<span class="hljs-keyword">const</span> arr4 = [<span class="hljs-number">11</span>, <span class="hljs-number">4</span>, <span class="hljs-number">12</span>]

arr3.unshift(<span class="hljs-number">4</span>)
<span class="hljs-built_in">console</span>.log(arr3)
    <span class="hljs-comment">//insert at beginning new method {here are (...)=that means splide method in ,splide method add two arr with out chidArray concept exmp: add arr3 &amp; arr4 without (...) method look like [6,7,8,[11,4,12]] with (...) method [6,7,8,11,4,12] =here we can see no childArray</span>
}
arr3.unshift(...arr4)
<span class="hljs-built_in">console</span>.log(arr3)
<span class="hljs-comment">//insert hole array in begining new method</span>
<span class="hljs-built_in">Array</span>.prototype.unshift.apply(arr3, arr4)
<span class="hljs-built_in">console</span>.log(arr3)
<span class="hljs-comment">//insert hole array in begining old method</span>
<span class="hljs-keyword">const</span> arr5 = [<span class="hljs-number">1</span>, <span class="hljs-number">2</span>, <span class="hljs-number">3</span>, <span class="hljs-number">4</span>, <span class="hljs-number">5</span>]
arr5.splice(<span class="hljs-number">3</span>, <span class="hljs-number">0</span>, <span class="hljs-number">4</span>) <span class="hljs-comment">//splice(start: indexNumber, delete: indexNumber, ...additems: indexNumber)</span>
<span class="hljs-built_in">console</span>.log(arr5)
</code></pre>
<h3 id="heading-update-existing-element">Update Existing element</h3>
<pre><code class="lang-javascript"><span class="hljs-keyword">const</span> arr1=[<span class="hljs-number">2</span>,<span class="hljs-number">3</span>,<span class="hljs-number">4</span>,<span class="hljs-number">5</span>,<span class="hljs-number">6</span>,<span class="hljs-number">7</span>]
arr1[<span class="hljs-number">4</span>]=<span class="hljs-number">1000</span>
<span class="hljs-built_in">console</span>.log(arr1)
<span class="hljs-comment">//this is old method or scripting method</span>
<span class="hljs-keyword">const</span> Student=[
    {<span class="hljs-attr">id</span>:<span class="hljs-number">1</span>,<span class="hljs-attr">name</span>:<span class="hljs-string">"Shihab"</span>}
    {<span class="hljs-attr">id</span>:<span class="hljs-number">2</span>,<span class="hljs-attr">name</span>:<span class="hljs-string">"Subbir"</span>}
    {<span class="hljs-attr">id</span>:<span class="hljs-number">3</span>,<span class="hljs-attr">name</span>:<span class="hljs-string">"Fehim"</span>}
    {<span class="hljs-attr">id</span>:<span class="hljs-number">4</span>,<span class="hljs-attr">name</span>:<span class="hljs-string">"Onto"</span>}

]
<span class="hljs-keyword">const</span> givinId=<span class="hljs-number">3</span>;
<span class="hljs-keyword">const</span> UpdateName=kabir
<span class="hljs-keyword">for</span>(<span class="hljs-keyword">let</span> i=<span class="hljs-number">0</span>;i&lt;stydent.legth;i++){
    <span class="hljs-keyword">if</span>(givenId==Student[i].id){
    Student[i]=UpdateName
    <span class="hljs-keyword">break</span>
}
}
</code></pre>
<h2 id="heading-delete-item-from-an-array">Delete Item From An Array</h2>
<pre><code class="lang-javascript"><span class="hljs-keyword">const</span> number =[<span class="hljs-number">1</span>,<span class="hljs-number">2</span>,<span class="hljs-number">3</span>,<span class="hljs-number">4</span>,<span class="hljs-number">5</span>,<span class="hljs-number">6</span>,<span class="hljs-number">7</span>,<span class="hljs-number">8</span>,<span class="hljs-number">9</span>,<span class="hljs-number">10</span>,<span class="hljs-number">11</span>,<span class="hljs-number">12</span>]
number.shift();
<span class="hljs-comment">//it remove first element &amp; you can add first element.</span>
number.pop();
number.length=number.length<span class="hljs-number">-1</span>
<span class="hljs-comment">//it remove last element</span>
number.splice(<span class="hljs-number">0</span>,<span class="hljs-number">0</span>,<span class="hljs-number">0</span>)
<span class="hljs-comment">//you can update,delete data by index number .splice(start: indexNumber, deletes: indexNumber, ...additems: indexNumber) ,you can delete multipul data by serice</span>
<span class="hljs-keyword">const</span> toBeDelete=<span class="hljs-number">5</span>;
<span class="hljs-keyword">for</span>(<span class="hljs-keyword">let</span> i=<span class="hljs-number">0</span>; i&lt;number.length;i++){
     <span class="hljs-keyword">if</span>(numbers[i]==toBeDeleted)}{
    number.splice(i,<span class="hljs-number">1</span>)
}
}
<span class="hljs-comment">//remove inside element -splice using value</span>
<span class="hljs-keyword">const</span> toBeDelete=<span class="hljs-number">6</span>;
number= number.filter(<span class="hljs-function"><span class="hljs-params">item</span>=&gt;</span> item!= toBeDelete)
<span class="hljs-comment">//delete array by filter mathod</span>


<span class="hljs-keyword">let</span> xx=[<span class="hljs-number">2</span>,<span class="hljs-number">4</span>,<span class="hljs-number">5</span>]
<span class="hljs-keyword">let</span> yy=xx
xx.length=<span class="hljs-number">0</span>
<span class="hljs-built_in">console</span>.log(xx,yy)
<span class="hljs-comment">//old method to rest data</span>
<span class="hljs-keyword">while</span>(number.length)number.pop()
<span class="hljs-built_in">console</span>.log(number)
</code></pre>
<h3 id="heading-array-slice">Array slice</h3>
<p>It is an inclusive and exclusive method. Exp:</p>
<pre><code class="lang-javascript"><span class="hljs-keyword">const</span> =[<span class="hljs-number">1</span>,<span class="hljs-number">2</span>,<span class="hljs-number">3</span>,<span class="hljs-number">4</span>,<span class="hljs-number">5</span>,<span class="hljs-number">6</span>,<span class="hljs-number">7</span>]
<span class="hljs-keyword">const</span> sliced=arr.slice(<span class="hljs-number">0</span>,<span class="hljs-number">5</span>)
<span class="hljs-built_in">console</span>.log(sliced)
<span class="hljs-comment">//here first parameter inlusive(0+1)= index+1,last paramete Exclusive(5-1)=index-1</span>
<span class="hljs-keyword">const</span> cloned=arr.slice()
consol.log(arr==cloned)
<span class="hljs-literal">false</span>
 <span class="hljs-comment">//here we can see the cloned address has been change &amp; clone is not equile to arr.</span>
<span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">toArray</span>(<span class="hljs-params"></span>)</span>{
<span class="hljs-keyword">return</span> Srray.prototype.slice.call(argument)
}
<span class="hljs-keyword">const</span> argument=toArray(<span class="hljs-number">4</span>,<span class="hljs-number">2</span>,<span class="hljs-number">2</span>,<span class="hljs-number">9</span>,<span class="hljs-string">"test"</span>)
<span class="hljs-built_in">console</span>.log(argument)
<span class="hljs-comment">//array like Object : those who are acting like object but there not.</span>
</code></pre>
<h3 id="heading-stack">Stack</h3>
<p>it is a data structure theory that explains data in &amp; out of the process.<br />it works LIFO method =<strong>last in, first out</strong><br />Exp</p>
<p><img src="https://sf.ezoiccdn.com/ezoimgfmt/i0.wp.com/learnersbucket.com/wp-content/uploads/2018/12/stack-2-1.png?ezimgfmt=ng%3Awebp%2Fngcb1%2Frs%3Adevice%2Frscb1-1&amp;ssl=1&amp;w=768" alt="Stack implementation in javascript" /></p>
<h3 id="heading-push-amp-pop-method">push &amp; pop method</h3>
<p>push &amp; pop methods are used to add and delete data from the last index of the array. The POP &amp; PUSH method comes from Stack DS</p>
<pre><code class="lang-javascript"><span class="hljs-keyword">const</span> text= hello
<span class="hljs-keyword">const</span> JsStack=[]
<span class="hljs-keyword">for</span>(<span class="hljs-keyword">let</span> i=<span class="hljs-number">0</span>;i&lt;test.length;i++)
    JsStack.push(test.charAt(i)) <span class="hljs-comment">// charAt is a method to call string</span>
}
<span class="hljs-keyword">let</span> result=<span class="hljs-string">""</span>
<span class="hljs-keyword">while</span>(JsStack.length) result= JsStack.pop()
</code></pre>
<h3 id="heading-queue">Queue</h3>
<p>Queue theory maintains FIFO= first in first out. Rare will increase (++) and the front is fixed= 0, push method= Enqueue &amp; Pop is Dequeueff</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1680635585229/eda3ef67-e474-45a2-9965-a78aa1e5daa5.png" alt class="image--center mx-auto" /></p>
<h3 id="heading-put-amp-patch"><strong>Put &amp; Patch</strong></h3>
<h3 id="heading-put">Put:</h3>
<h3 id="heading-put-move-the-hole-ice-cream">put move the hole ice cream.</h3>
<h3 id="heading-patch"><strong>Patch:</strong></h3>
<h3 id="heading-patch-moves-only-ice-cream-cubes">patch moves only ice cream cubes.</h3>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1709645852558/39c9ec8e-10ef-4936-88e9-f318c328acdd.png" alt class="image--center mx-auto" /></p>
<p><a target="_blank" href="https://www.linkedin.com/posts/vikasrajputin_http-put-vs-patch-simplified-put-method-activity-7122439314218586112-zLhD?utm_source=share&amp;utm_medium=member_desktop">Graphical view</a></p>
<p>source from @<a target="_blank" href="https://www.linkedin.com/in/vikasrajputin/">VikasRajpu</a>t</p>
<h1 id="heading-to-be-conthttpswwwlinkedincominvikasrajputinoverlayabout-this-profileinue"><a target="_blank" href="https://www.linkedin.com/in/vikasrajputin/overlay/about-this-profile/">To Be Cont</a>inue<strong>.....</strong></h1>
]]></content:encoded></item></channel></rss>