<?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>Forem: Nikita Maharana</title>
    <description>The latest articles on Forem by Nikita Maharana (@nikita_maharana_879884df2).</description>
    <link>https://forem.com/nikita_maharana_879884df2</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%2F3928767%2F61477ffb-2e6e-43c1-997a-84cc3833ef7b.png</url>
      <title>Forem: Nikita Maharana</title>
      <link>https://forem.com/nikita_maharana_879884df2</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/nikita_maharana_879884df2"/>
    <language>en</language>
    <item>
      <title>Array Destructuring Explained</title>
      <dc:creator>Nikita Maharana</dc:creator>
      <pubDate>Thu, 14 May 2026 12:43:50 +0000</pubDate>
      <link>https://forem.com/nikita_maharana_879884df2/array-destructuring-explained-1o4o</link>
      <guid>https://forem.com/nikita_maharana_879884df2/array-destructuring-explained-1o4o</guid>
      <description>&lt;p&gt;&lt;strong&gt;Array Destructuring&lt;/strong&gt; means extracting values from arrays and assigning in a convenient way for unpacking array elements into distinct variables.&lt;/p&gt;

&lt;p&gt;or Simply, Array destructuring means taking values from an array and storing them into separate variables easily.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;e.g:1&lt;/strong&gt;&lt;br&gt;
let fruits = ["apple", "grapes", "orange"];&lt;br&gt;
let [first, second, third] = fruits;&lt;/p&gt;

&lt;p&gt;console.log(first);  //'apple'&lt;br&gt;
console.log(second); //'grapes'&lt;br&gt;
console.log(third);  //'orange'&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;e.g:2&lt;/strong&gt;&lt;br&gt;
Accessing by their index values&lt;/p&gt;

&lt;p&gt;let fruits = ["apple", "grapes", "orange"];&lt;br&gt;
let first = fruits[0];&lt;br&gt;
let second = fruits[1];&lt;br&gt;
let third = fruits[2];&lt;/p&gt;

&lt;p&gt;console.log(first); //'apple'&lt;br&gt;
console.log(second); //'grapes'&lt;br&gt;
console.log(third); //'orange'&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The Rest Syntax:&lt;/strong&gt; It allows you to capture the remaining elements of an array that have not been destructured into a new array.It's denoted by three dots (...).&lt;br&gt;
e.g:&lt;br&gt;
let fruits = ["apple", "banana", "orange", "grapes", "kiwi"];&lt;br&gt;
let [first, second, ...rest] = fruits;&lt;/p&gt;

&lt;p&gt;console.log(first);  //'apple'&lt;br&gt;
console.log(second); //'banana'&lt;br&gt;
console.log(rest);   //['orange', 'grapes', 'kiwi']&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>webdev</category>
      <category>programming</category>
      <category>beginners</category>
    </item>
    <item>
      <title>Explained Global, Local &amp; Block Scope in JavaScript</title>
      <dc:creator>Nikita Maharana</dc:creator>
      <pubDate>Wed, 13 May 2026 16:54:13 +0000</pubDate>
      <link>https://forem.com/nikita_maharana_879884df2/explained-global-local-block-scope-in-javascript-25e9</link>
      <guid>https://forem.com/nikita_maharana_879884df2/explained-global-local-block-scope-in-javascript-25e9</guid>
      <description>&lt;p&gt;&lt;strong&gt;Scope:&lt;/strong&gt; Scope generally means the visibility and accessibililty of variables in different parts of your code. Understanding of differnt types of scopes helps us write error free and clear code.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Global Scope:&lt;/strong&gt;&lt;br&gt;
Global scope means the variable is having its accessibility anywhere in the program, inside function or blocks etc. But sometimes it leads to naming conflicts.&lt;br&gt;
e.g:&lt;br&gt;
let global = "I'm a global variable";&lt;br&gt;
function display(){&lt;br&gt;
    console.log(global);&lt;br&gt;
}&lt;br&gt;
display(); // "I'm a global variable"&lt;/p&gt;

&lt;p&gt;In this example, global is declared in the global scope and can be accessed inside the display function.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Local Scope:&lt;/strong&gt;&lt;br&gt;
The variables are only accessible within a function not outside of it.&lt;br&gt;
e.g:&lt;br&gt;
function local(){&lt;br&gt;
    var local = "I'm a local scope variable";&lt;br&gt;
    if (true){&lt;br&gt;
       console.log(local);// Works here also inside of if block&lt;br&gt;
    }&lt;br&gt;
}&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Block Scope:&lt;/strong&gt;&lt;br&gt;
The variables are accessed within that block not outside of it.&lt;br&gt;
if (true) {&lt;br&gt;
    let block = "I'm a block variable";&lt;br&gt;
    console.log(block);// Works here inside of the block only&lt;br&gt;
}&lt;br&gt;
console.log(block);//it will throw an error&lt;/p&gt;

&lt;h1&gt;
  
  
  Let's try to understand the difference between var, let and const based on Scopes
&lt;/h1&gt;

&lt;p&gt;&lt;strong&gt;How to declare variables in JS?&lt;/strong&gt;&lt;br&gt;
We can declare variables in JS using var, let and const.&lt;/p&gt;

&lt;p&gt;A variable is like a container used to store a value.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;var&lt;/strong&gt; is a function scoped variable which can be redeclared and reassigned.&lt;br&gt;
e.g: console.log("Nikita Maharana");&lt;br&gt;
var a = 25;&lt;br&gt;
var a = 3;//can redeclare using var in js&lt;br&gt;
a = 56;//reassigning is possible&lt;br&gt;
console.log(a);&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;let&lt;/strong&gt; is a block scoped variable which can be reassigned but cannot be redeclared.&lt;br&gt;
e.g: let x = 9;&lt;br&gt;
// let x = 5;// cannot redeclare&lt;br&gt;
x = 78;//reassigning is also possible using let not re-declare&lt;br&gt;
console.log(x);&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;const&lt;/strong&gt; is a block scoped variable which cannot be redeclared or reassigned.&lt;br&gt;
e.g: const y = 11;&lt;br&gt;
// const y = 22; cannot re-declare&lt;br&gt;
//y = 30;//re-assigning is not possible&lt;br&gt;
console.log(y);&lt;/p&gt;

&lt;p&gt;So, basically we can say...var is function scoped variable &amp;amp; let and const are block scoped variables.&lt;br&gt;
&lt;strong&gt;ex1:&lt;/strong&gt;&lt;br&gt;
function fun(){&lt;br&gt;
  if(true){&lt;br&gt;
    var a = 55;&lt;br&gt;
  }&lt;br&gt;
  console.log(a);//inside the fxn it will work everywhere&lt;br&gt;
}&lt;br&gt;
fun();&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;ex2:&lt;/strong&gt;&lt;br&gt;
function fun(){&lt;br&gt;
  if(true){&lt;br&gt;
    var a = 55;let b = 34;const c = 34&lt;br&gt;
  }&lt;br&gt;
  console.log(a,b);//inside the fxn it will work everywhere b will not be printed&lt;br&gt;
  console.log(c);//c is block scoped it will not be printed&lt;br&gt;
}&lt;br&gt;
fun();&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>learning</category>
      <category>webdev</category>
      <category>programming</category>
    </item>
    <item>
      <title>Array Functions Explained Simply</title>
      <dc:creator>Nikita Maharana</dc:creator>
      <pubDate>Wed, 13 May 2026 15:20:37 +0000</pubDate>
      <link>https://forem.com/nikita_maharana_879884df2/array-functions-explained-simply-1eki</link>
      <guid>https://forem.com/nikita_maharana_879884df2/array-functions-explained-simply-1eki</guid>
      <description>&lt;p&gt;Array: Arrays are used to store elements. Array is a collection of elements. &lt;br&gt;
eg: let arr = [5, 44, 87, 9]&lt;br&gt;
arr[0] = 5;&lt;br&gt;
arr[1] = 44;&lt;/p&gt;

&lt;p&gt;length is a method of array which returns total no of elements in the array.&lt;/p&gt;

&lt;p&gt;//Arrays Methods: &lt;br&gt;
i. push: push is used to insert a value into the array as last value &lt;br&gt;
e.g: array.push(values)&lt;br&gt;
ii. pop(): pop is used to remove only the last value of the array&lt;br&gt;
eg: array.pop()&lt;/p&gt;

&lt;p&gt;iii. unshift : unshift is used to insert value or values into the array as first value&lt;br&gt;
e.g: array.unshift(values)&lt;/p&gt;

&lt;p&gt;iv. shift(): shift is used to remove only starting vlaue of the array&lt;br&gt;
eg: array.shift()&lt;/p&gt;

&lt;p&gt;v. splice: splice(starting_index, deleteCount, insertValues)&lt;br&gt;
It is used to delete any number of values or insert any number of values to the array&lt;br&gt;
 let arr = [5,4,6,7];&lt;br&gt;
 arr.splice(1,1)&lt;br&gt;
 arr.splice(1) -- will delete whole array from index 1&lt;br&gt;
 arr.splice(1, 2) -- will delete 2 values from index 1&lt;br&gt;
 arr.splice(1, 2, "shekhar") -- will delete 2 values from index 1 and add shkhar at index 1 &lt;/p&gt;

&lt;p&gt;vi. reverse is used to reverse the array.&lt;br&gt;
eg: array.reverse();&lt;br&gt;
arrays are mutable it changes the original array.&lt;/p&gt;

&lt;p&gt;vii. includes : includes is used to check whether the value is included in the array or not. &lt;/p&gt;

&lt;p&gt;viii. forEach(callback) : forEach is a method of arrays which accepts callback fxns as parameter and will apply the fxn to each and every element of array &lt;/p&gt;

&lt;p&gt;Syntax : forEach(value, index)&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>beginners</category>
      <category>learning</category>
      <category>developer</category>
    </item>
    <item>
      <title>Closure Explained in JS</title>
      <dc:creator>Nikita Maharana</dc:creator>
      <pubDate>Wed, 13 May 2026 08:53:12 +0000</pubDate>
      <link>https://forem.com/nikita_maharana_879884df2/closure-explained-in-js-1f0j</link>
      <guid>https://forem.com/nikita_maharana_879884df2/closure-explained-in-js-1f0j</guid>
      <description>&lt;p&gt;Closure: An inner fxn remembers the outer fxn values even after outer fxn execution gets ended. &lt;/p&gt;

&lt;p&gt;We use this in techniques called memorization it means making code able to remember the previous input and its corresponding output such that it will not again calculate for same input. &lt;/p&gt;

&lt;p&gt;//CLosure&lt;br&gt;
function outer(){&lt;br&gt;
  var x = 25;&lt;br&gt;
  function inner() {&lt;br&gt;
    x++;//x is not in inner fxn its in outer but it remembers outer value that called memorization or closure&lt;br&gt;
    console.log(x);&lt;br&gt;
  }&lt;br&gt;
  return inner;&lt;br&gt;
}&lt;br&gt;
let result = outer();&lt;br&gt;
console.log(result);&lt;br&gt;
//it calls outer and outer returns inner so whole innner fxn returns&lt;br&gt;
//inner is not yet called so 26 will not be printed as it is seems&lt;/p&gt;

&lt;p&gt;result();//inner called 26&lt;br&gt;
result()//27&lt;br&gt;
result()//28 and so on...&lt;/p&gt;

</description>
      <category>beginners</category>
      <category>javascript</category>
      <category>programming</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>Callback Functions in JavaScript Explained</title>
      <dc:creator>Nikita Maharana</dc:creator>
      <pubDate>Wed, 13 May 2026 08:22:18 +0000</pubDate>
      <link>https://forem.com/nikita_maharana_879884df2/callback-functions-in-javascript-explained-3ija</link>
      <guid>https://forem.com/nikita_maharana_879884df2/callback-functions-in-javascript-explained-3ija</guid>
      <description>&lt;h1&gt;
  
  
  Callback Functions
&lt;/h1&gt;

&lt;p&gt;A callback function is a function which is passed as an argument to another function.&lt;/p&gt;

&lt;p&gt;e.g. function kind(){&lt;br&gt;
       console.log("I'm kind");&lt;br&gt;
     }&lt;br&gt;
    function rude(){&lt;br&gt;
       console.log("I'm rude");&lt;br&gt;
    }&lt;br&gt;
    function fun(a, b){&lt;br&gt;
       a();//calls kind()&lt;br&gt;
       b();//calls rude()&lt;br&gt;
    }&lt;br&gt;
    fun(kind, rude);&lt;/p&gt;

&lt;p&gt;//Output:&lt;br&gt;
   I'm kind&lt;br&gt;
   I'm rude&lt;/p&gt;

&lt;p&gt;Here, kind and rude are callback functions because they are passed as arguments to another function named as fun.&lt;br&gt;
And fun is called a higher order function because it accepts functions (kind and rude) as parameters.&lt;/p&gt;

</description>
      <category>beginners</category>
      <category>javascript</category>
      <category>programming</category>
      <category>tutorial</category>
    </item>
  </channel>
</rss>
