<?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: G Gokul</title>
    <description>The latest articles on DEV Community by G Gokul (@g_gokul_ganapathy).</description>
    <link>https://dev.to/g_gokul_ganapathy</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.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4014887%2F9d632c7b-b0ac-4c0a-a544-fd35256c39a2.jpg</url>
      <title>DEV Community: G Gokul</title>
      <link>https://dev.to/g_gokul_ganapathy</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/g_gokul_ganapathy"/>
    <language>en</language>
    <item>
      <title>ARRAY SEARCH METHODS IN JAVASCRIPT</title>
      <dc:creator>G Gokul</dc:creator>
      <pubDate>Tue, 21 Jul 2026 10:49:08 +0000</pubDate>
      <link>https://dev.to/g_gokul_ganapathy/array-search-methods-in-javascript-4eg4</link>
      <guid>https://dev.to/g_gokul_ganapathy/array-search-methods-in-javascript-4eg4</guid>
      <description>&lt;h2&gt;
  
  
  Array Search Methods:
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;JavaScript Array indexOf()&lt;/strong&gt;&lt;br&gt;
The indexOf() method searches an array for an element value and returns its position.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Syntax:&lt;/strong&gt;&lt;br&gt;
array.indexOf(item, start) &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;example:&lt;/strong&gt;&lt;br&gt;
&lt;code&gt;const fruits = ["Apple", "Orange", "Apple", "Mango"];&lt;br&gt;
        let position = fruits.indexOf("Apple");&lt;br&gt;
        console.log(position);&lt;br&gt;
        console.log(fruits);&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;output:&lt;/strong&gt;&lt;br&gt;
0&lt;br&gt;
[ "Apple", "Orange", "Apple", "Mango" ]&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;example:&lt;/strong&gt;&lt;br&gt;
&lt;code&gt;const fruits = ["Apple", "Orange", "Apple", "Mango"];&lt;br&gt;
        let position = fruits.indexOf("Apple",3);&lt;br&gt;
        console.log(position);&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;output:&lt;/strong&gt;&lt;br&gt;
-1 (Array.indexOf() returns -1 if the item is not found.)&lt;/p&gt;

&lt;h2&gt;
  
  
  JavaScript Array lastIndexOf()
&lt;/h2&gt;

&lt;p&gt;Array.lastIndexOf() is the same as Array.indexOf(), but returns the position of the last occurrence of the specified element.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;syntax:&lt;/strong&gt;&lt;br&gt;
array.lastIndexOf(item, start)&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;example:&lt;/strong&gt;&lt;br&gt;
const fruits = ["Apple", "Orange", "Apple", "Mango"];&lt;br&gt;
let position1 = fruits.lastIndexOf("Apple",1);&lt;br&gt;
        console.log(position1);&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;output:&lt;/strong&gt;&lt;br&gt;
0&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;example:&lt;/strong&gt;&lt;br&gt;
const fruits = ["Apple", "Orange", "Apple", "Mango"];&lt;br&gt;
let position1 = fruits.lastIndexOf("Apple");&lt;br&gt;
        console.log(position1);&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;output:&lt;/strong&gt;&lt;br&gt;
2&lt;/p&gt;

&lt;h2&gt;
  
  
  JavaScript Array includes()
&lt;/h2&gt;

&lt;p&gt;This allows us to check if an element is present in an array (including NaN, unlike indexOf).&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;syntax:&lt;/strong&gt;&lt;br&gt;
array.includes(search-item) &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;example:&lt;/strong&gt;&lt;br&gt;
 &lt;code&gt;const fruits1 = ["Banana", "Orange", "Apple", "Mango"];&lt;br&gt;
        console.log(fruits1.includes("Mango"));&lt;br&gt;
        console.log(fruits1.includes("kiwi"));&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;output:&lt;/strong&gt;&lt;br&gt;
true&lt;br&gt;
false&lt;/p&gt;

&lt;h2&gt;
  
  
  JavaScript Array find()
&lt;/h2&gt;

&lt;p&gt;The find() method returns the value of the first array element that passes a test function.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;example:&lt;/strong&gt;&lt;br&gt;
&lt;code&gt;const numbers = [4, 9, 16, 25, 29];&lt;br&gt;
        let first = numbers.find(myFunction);&lt;br&gt;
        function myFunction(value, index, array) {&lt;br&gt;
            return value &amp;gt; 18;&lt;br&gt;
        } &lt;br&gt;
        console.log(first);&lt;br&gt;
        console.log(numbers);&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;output:&lt;/strong&gt;&lt;br&gt;
25&lt;br&gt;
[ 4, 9, 16, 25, 29 ]&lt;/p&gt;

&lt;h2&gt;
  
  
  JavaScript Array findIndex()
&lt;/h2&gt;

&lt;p&gt;The findIndex() method returns the index of the first array element that passes a test function.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;example:&lt;/strong&gt;&lt;br&gt;
&lt;code&gt;const numbers1 = [4, 9, 16, 25, 29];&lt;br&gt;
        let first1 = numbers1.findIndex(myFunction1);&lt;br&gt;
        function myFunction1(value, index, array) {&lt;br&gt;
            return value &amp;gt; 18;&lt;br&gt;
        }&lt;br&gt;
        console.log(first1);&lt;br&gt;
        console.log(numbers1);&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;output:&lt;/strong&gt;&lt;br&gt;
3&lt;br&gt;&lt;br&gt;
[ 4, 9, 16, 25, 29 ]&lt;/p&gt;

&lt;h2&gt;
  
  
  JavaScript Array findLast() Method
&lt;/h2&gt;

&lt;p&gt;findLast() method that will start from the end of an array and return the value of the first element that satisfies a condition.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;example:&lt;/strong&gt;&lt;br&gt;
&lt;code&gt;const temp = [27, 28, 30, 40, 42, 35, 30];&lt;br&gt;
        let high = temp.findLast(x =&amp;gt; x &amp;lt; 40);&lt;br&gt;
        console.log(high);&lt;br&gt;
        console.log(temp);&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;output:&lt;/strong&gt;&lt;br&gt;
30&lt;br&gt;
[ 27, 28, 30, 40, 42, 35, 30 ]&lt;/p&gt;

&lt;h2&gt;
  
  
  JavaScript Array findLastIndex() Method
&lt;/h2&gt;

&lt;p&gt;The findLastIndex() method finds the index of the last element that satisfies a condition.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;example:&lt;/strong&gt;&lt;br&gt;
&lt;code&gt;const temp = [27, 28, 30, 40, 42, 35, 30];&lt;br&gt;
let pos = temp.findLastIndex(x =&amp;gt; x &amp;gt; 40);&lt;br&gt;
        console.log(pos);&lt;br&gt;
        console.log(temp);&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;output:&lt;/strong&gt;&lt;br&gt;
4&lt;br&gt;
[ 27, 28, 30, 40, 42, 35, 30 ]&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>search</category>
      <category>array</category>
      <category>methods</category>
    </item>
    <item>
      <title>ARRAY ITERATIONS IN JAVASCRIPT PART-3</title>
      <dc:creator>G Gokul</dc:creator>
      <pubDate>Tue, 21 Jul 2026 10:08:57 +0000</pubDate>
      <link>https://dev.to/g_gokul_ganapathy/array-iterations-in-javascript-part-3-3n8p</link>
      <guid>https://dev.to/g_gokul_ganapathy/array-iterations-in-javascript-part-3-3n8p</guid>
      <description>&lt;h2&gt;
  
  
  JavaScript Array Iterations:
&lt;/h2&gt;

&lt;h2&gt;
  
  
  JavaScript Array flatMap()
&lt;/h2&gt;

&lt;p&gt;The flatMap() method first maps all elements of an array and then creates a new array by flattening the array.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;example:&lt;/strong&gt;&lt;br&gt;
&lt;code&gt;const numbers = [1, 2, 3, 4];&lt;br&gt;
        const result = numbers.flatMap(num =&amp;gt; {&lt;br&gt;
            if (num % 2 === 0) {&lt;br&gt;
                return [num, num * 10];&lt;br&gt;
            } else {&lt;br&gt;
                return [];&lt;br&gt;
            }&lt;br&gt;
        });&lt;br&gt;
        console.log(result);&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;output:&lt;/strong&gt;&lt;br&gt;
[ 2, 20, 4, 40 ]&lt;/p&gt;
&lt;h2&gt;
  
  
  JavaScript Array filter()
&lt;/h2&gt;

&lt;p&gt;The filter() method creates a new array with array elements that pass a test.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;example:&lt;/strong&gt;&lt;br&gt;
&lt;code&gt;const numbers1 = [45, 4, 9, 16, 25];&lt;br&gt;
        const less18 = numbers1.filter(myFunction);&lt;br&gt;
        function myFunction(value) {&lt;br&gt;
            return value &amp;lt; 18;&lt;br&gt;
        }&lt;br&gt;
        console.log(less18);&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;output:&lt;/strong&gt;&lt;br&gt;
[4,9,16]&lt;/p&gt;
&lt;h2&gt;
  
  
  JavaScript Array reduce()
&lt;/h2&gt;

&lt;p&gt;The reduce() method runs a function on each array element to produce a single value.&lt;br&gt;
The reduce() method works from left-to-right in the array. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;example:&lt;/strong&gt;&lt;br&gt;
&lt;code&gt;const numbers = [45, 4, 9, 16, 25];&lt;br&gt;
let sum = numbers.reduce(myFunction);&lt;br&gt;
        function myFunction(total, value) {&lt;br&gt;
            return total / value;&lt;br&gt;
        }&lt;br&gt;
        console.log(sum);&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;output:&lt;/strong&gt;&lt;br&gt;
0.003125&lt;/p&gt;
&lt;h2&gt;
  
  
  JavaScript Array reduceRight()
&lt;/h2&gt;

&lt;p&gt;The reduceRight() method runs a function on each array element to produce a single value.&lt;br&gt;
The reduceRight() works from right-to-left in the array. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;example:&lt;/strong&gt;&lt;br&gt;
&lt;code&gt;const numbers = [45, 4, 9, 16, 25];&lt;br&gt;
let sum1 = numbers.reduceRight(myFunction);&lt;br&gt;
        function myFunction(total, value) {&lt;br&gt;
            return total - value;&lt;br&gt;
        }&lt;br&gt;
        console.log(sum1);&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;output:&lt;/strong&gt;&lt;br&gt;
-49&lt;/p&gt;
&lt;h2&gt;
  
  
  JavaScript Array every()
&lt;/h2&gt;

&lt;p&gt;The every() method checks if all array values pass a test.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;example:&lt;/strong&gt;&lt;br&gt;
&lt;code&gt;const numbers = [45, 4, 9, 16, 25];&lt;br&gt;
let allOver18 = numbers.every(myFunction);&lt;br&gt;
function myFunction(value) {&lt;br&gt;
  return value &amp;gt; 18;&lt;br&gt;
}&lt;/code&gt; &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;output:&lt;/strong&gt;&lt;br&gt;
false&lt;/p&gt;
&lt;h2&gt;
  
  
  JavaScript Array some()
&lt;/h2&gt;

&lt;p&gt;The some() method checks if some array values pass a test.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;example:&lt;/strong&gt;&lt;br&gt;
&lt;code&gt;const numbers = [45, 4, 9, 16, 25];&lt;br&gt;
let someOver18 = numbers.some(myFunction);&lt;br&gt;
function myFunction(value, index, array) {&lt;br&gt;
  return value &amp;gt; 18;&lt;br&gt;
}&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;output:&lt;/strong&gt;&lt;br&gt;
true&lt;/p&gt;
&lt;h2&gt;
  
  
  JavaScript Array.from()
&lt;/h2&gt;

&lt;p&gt;The Array.from() method returns an Array object from:&lt;br&gt;
    Any iterable object&lt;br&gt;
    Any object with a length property&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;example:&lt;/strong&gt;&lt;br&gt;
&lt;code&gt;let text = "GOKULGANAPATHY";&lt;br&gt;
        let name = Array.from(text);&lt;br&gt;
        console.log(name);&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;output:&lt;/strong&gt;&lt;br&gt;
[ "G", "O", "K", "U", "L", "G", "A", "N", "A", "P","A","T","H","Y"]&lt;/p&gt;
&lt;h2&gt;
  
  
  JavaScript Array keys()(TBD)
&lt;/h2&gt;

&lt;p&gt;The Array.keys() method returns an Array Iterator object with the keys of an array.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;example:&lt;/strong&gt;&lt;br&gt;
&lt;code&gt;const fruits = ["Banana", "Orange", "Apple", "Mango"];&lt;br&gt;
        const keys = fruits.keys();&lt;br&gt;
        for (let x of keys) {&lt;br&gt;
            console.log(x);&lt;br&gt;
        }&lt;br&gt;
        console.log(keys)&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;output:&lt;/strong&gt;&lt;br&gt;
0&lt;br&gt;
1&lt;br&gt;
2&lt;br&gt;
3&lt;br&gt;
Array Iterator { constructor: Iterator() }&lt;/p&gt;
&lt;h2&gt;
  
  
  JavaScript Array entries()(TBD)
&lt;/h2&gt;

&lt;p&gt;The entries() method returns an Array Iterator object with key/value pairs.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;example:&lt;/strong&gt;&lt;br&gt;
&lt;code&gt;const fruits1 = ["Banana", "Orange", "Apple", "Mango"];&lt;br&gt;
        const f = fruits1.entries();&lt;br&gt;
        for (let x of f) {&lt;br&gt;
            console.log(x);   &lt;br&gt;
        }&lt;br&gt;
        console.log(f);&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;output:&lt;/strong&gt;&lt;br&gt;
[ 0, "Banana" ]&lt;br&gt;
[ 1, "Orange" ]&lt;br&gt;
[ 2, "Apple" ]&lt;br&gt;
[ 3, "Mango" ]&lt;br&gt;
Array Iterator { constructor: Iterator() }&lt;/p&gt;
&lt;h2&gt;
  
  
  JavaScript Array with() Method
&lt;/h2&gt;

&lt;p&gt;the Array with() method as a safe way to update elements in an array without altering the original array.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;example:&lt;/strong&gt;&lt;br&gt;
&lt;code&gt;const months = ["January", "February", "March", "April"];&lt;br&gt;
        const myMonths = months.with(2, "august");&lt;br&gt;
        console.log(myMonths);&lt;br&gt;
        console.log(months);&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;output:&lt;/strong&gt;&lt;br&gt;
[ "January", "February", "august", "April" ]&lt;br&gt;
[ "January", "February", "March", "April" ]&lt;/p&gt;
&lt;h2&gt;
  
  
  JavaScript Array Spread (...)
&lt;/h2&gt;

&lt;p&gt;The ... operator expands an array into individual elements.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;example:&lt;/strong&gt;&lt;br&gt;
&lt;code&gt;const q1 = ["Jan", "Feb", "Mar"];&lt;br&gt;
        const q2 = ["Apr", "May", "Jun"];&lt;br&gt;
        const q3 = ["Jul", "Aug", "Sep"];&lt;br&gt;
        const q4 = ["Oct", "Nov", "Des"];&lt;br&gt;
        const year = [...q1, ...q2, ...q3, ...q4];&lt;br&gt;
        console.log(year);&lt;br&gt;
        console.log(q3);&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;output:&lt;br&gt;
[ "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"]&lt;br&gt;
[ "Jul", "Aug", "Sep" ]&lt;/p&gt;
&lt;h2&gt;
  
  
  JavaScript Array Rest (...)
&lt;/h2&gt;

&lt;p&gt;The rest operator (...) allows us to destruct an array and collect the leftovers.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;example:&lt;/strong&gt;&lt;br&gt;
&lt;code&gt;let a, b, rest;&lt;br&gt;
        const arr1 = [1, 2, 3, 4, 5, 6, 7, 8];&lt;br&gt;
        [a, b, ...rest] = arr1;&lt;br&gt;
        console.log(a);&lt;br&gt;
        console.log(b);&lt;br&gt;
        console.log(rest);&lt;br&gt;
        console.log(arr1);&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;output:&lt;/strong&gt;&lt;br&gt;
1 &lt;br&gt;
2 &lt;br&gt;
[ 3, 4, 5, 6, 7, 8 ]&lt;br&gt;
[ 1, 2, 3, 4, 5, 6, 7, 8 ]&lt;/p&gt;

&lt;p&gt;References:&lt;br&gt;
&lt;/p&gt;
&lt;div class="crayons-card c-embed text-styles text-styles--secondary"&gt;
    &lt;div class="c-embed__content"&gt;
      &lt;div class="c-embed__body flex items-center justify-between"&gt;
        &lt;a href="https://www.w3schools.com/js/js_array_iteration.asp#mark_from" rel="noopener noreferrer" class="c-link fw-bold flex items-center"&gt;
          &lt;span class="mr-2"&gt;w3schools.com&lt;/span&gt;
          

        &lt;/a&gt;
      &lt;/div&gt;
    &lt;/div&gt;
&lt;/div&gt;


</description>
      <category>javascript</category>
      <category>array</category>
      <category>methods</category>
    </item>
    <item>
      <title>ARRAY ITERATIONS IN JAVASCRIPT PART-2</title>
      <dc:creator>G Gokul</dc:creator>
      <pubDate>Mon, 20 Jul 2026 13:15:14 +0000</pubDate>
      <link>https://dev.to/g_gokul_ganapathy/array-iterations-in-javascript-part-2-14op</link>
      <guid>https://dev.to/g_gokul_ganapathy/array-iterations-in-javascript-part-2-14op</guid>
      <description>&lt;h2&gt;
  
  
  Difference between forEach() and map():
&lt;/h2&gt;

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

&lt;p&gt;&lt;strong&gt;example:&lt;/strong&gt;&lt;br&gt;
&lt;code&gt;const numbers = [45,10,25,30,60];&lt;br&gt;
        function display (value, index, array ){&lt;br&gt;
            return value * 2;&lt;br&gt;
        }&lt;br&gt;
        const forEachReturn = numbers.forEach(display);&lt;br&gt;
        const MapReturn = numbers.map(display);&lt;br&gt;
        console.log(forEachReturn);&lt;br&gt;
        console.log(MapReturn)&lt;br&gt;
        console.log(numbers);&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;output:&lt;/strong&gt;&lt;br&gt;
undefined&lt;br&gt;
[ 90, 20, 50, 60, 120 ]&lt;br&gt;
[ 45, 10, 25, 30, 60 ]&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;example:&lt;/strong&gt;&lt;br&gt;
&lt;code&gt;const numbers2 = [1, 2, 3];&lt;br&gt;
        const resultForEach = numbers2.forEach(num =&amp;gt; num * 2);&lt;br&gt;
        console.log(resultForEach);&lt;br&gt;
        const resultMap = numbers2.map(num =&amp;gt; num * 2);&lt;br&gt;
        console.log(resultMap);&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;output:&lt;br&gt;
undefined&lt;br&gt;
[ 2, 4, 6 ]&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;example:&lt;/strong&gt;&lt;br&gt;
&lt;code&gt;const users = [&lt;br&gt;
            { id: 1, name: "Sam" },&lt;br&gt;
            { id: 2, name: "Alex" }&lt;br&gt;
        ];&lt;br&gt;
        const usernames = users.map(user =&amp;gt; user.name);&lt;br&gt;
        console.log(usernames);&lt;br&gt;
        const username =  users.forEach(user =&amp;gt; user.name);&lt;br&gt;
        console.log(username)&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;output:&lt;/strong&gt;&lt;br&gt;
Array [ "Sam", "Alex" ]&lt;br&gt;
undefined&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;example:&lt;/strong&gt;&lt;br&gt;
(TBD)&lt;br&gt;
&lt;code&gt;const sparseArr = [1, , 3, , 5];&lt;br&gt;
        sparseArr.forEach(n =&amp;gt; console.log(n));&lt;br&gt;
        const mapped = sparseArr.map(n =&amp;gt; n * 2);&lt;br&gt;
        console.log(mapped);&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;output:&lt;/strong&gt;&lt;br&gt;
1&lt;br&gt;
3&lt;br&gt;
5&lt;br&gt;
[ 2, &amp;lt;1 empty slot&amp;gt;, 6, &amp;lt;1 empty slot&amp;gt;, 10 ]&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>array</category>
      <category>foreach</category>
      <category>map</category>
    </item>
    <item>
      <title>ARRAY ITERATIONS IN JAVASCRIPT</title>
      <dc:creator>G Gokul</dc:creator>
      <pubDate>Fri, 17 Jul 2026 08:51:21 +0000</pubDate>
      <link>https://dev.to/g_gokul_ganapathy/array-iterations-in-javascript-15pj</link>
      <guid>https://dev.to/g_gokul_ganapathy/array-iterations-in-javascript-15pj</guid>
      <description>&lt;h2&gt;
  
  
  Iteration in javascript:
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Iteration in JavaScript refers to repeatedly executing a block of code over a sequence of values, such as arrays, objects, or other iterable structures. &lt;/li&gt;
&lt;li&gt;JavaScript offers multiple loop constructs, array iteration methods, and iterator protocols to handle different scenarios efficiently.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Array Iteration Methods:
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Array iteration methods operate on every array item.&lt;/li&gt;
&lt;li&gt;In JavaScript, array iteration methods are built-in functions that allow you to loop through (iterate over) each element of an array and perform some operation on them without manually writing a for loop.&lt;/li&gt;
&lt;li&gt;These methods make code shorter, cleaner, and more readable.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  1. The for...of Loop:
&lt;/h2&gt;

&lt;p&gt;The for...of statements hands you the array values.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt;&lt;br&gt;
&lt;code&gt;const cars =["bmw","volvo","mini"];&lt;br&gt;
        for (let car of cars){&lt;br&gt;
            console.log(car);&lt;br&gt;
        }&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;output:&lt;/strong&gt;&lt;br&gt;
bmw&lt;br&gt;
volvo&lt;br&gt;
mini&lt;/p&gt;
&lt;h2&gt;
  
  
  2. The for...in Loop:
&lt;/h2&gt;

&lt;p&gt;The for...in statements hands you the array indexes.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt;&lt;br&gt;
&lt;code&gt;const cars =["bmw","volvo","mini"];&lt;br&gt;
for (let car in cars){&lt;br&gt;
            console.log(car)&lt;br&gt;
        }&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;output:&lt;/strong&gt;&lt;br&gt;
0&lt;br&gt;
1&lt;br&gt;
2&lt;/p&gt;
&lt;h2&gt;
  
  
  3. JavaScript Array forEach():
&lt;/h2&gt;

&lt;p&gt;The forEach() method calls a function (a callback function) for each array element.&lt;br&gt;
the function takes 3 arguments:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The item value&lt;/li&gt;
&lt;li&gt;The item index&lt;/li&gt;
&lt;li&gt;The array itself&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt;&lt;br&gt;
&lt;code&gt;const numbers = [45,4,9,12,15];&lt;br&gt;
        numbers.forEach(display);&lt;br&gt;
        function display(value,index,array){&lt;br&gt;
            console.log(value, index, array)&lt;br&gt;
        }&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;output:&lt;/strong&gt;&lt;br&gt;
45 0 (5)&amp;nbsp;[45, 4, 9, 12, 15]&lt;br&gt;
4 1 (5)&amp;nbsp;[45, 4, 9, 12, 15]&lt;br&gt;
9 2 (5)&amp;nbsp;[45, 4, 9, 12, 15]&lt;br&gt;
12 3 (5)&amp;nbsp;[45, 4, 9, 12, 15]&lt;br&gt;
15 4 (5)&amp;nbsp;[45, 4, 9, 12, 15]&lt;/p&gt;
&lt;h2&gt;
  
  
  Callback function:
&lt;/h2&gt;

&lt;p&gt;A callback function in JavaScript is a function that is passed as an argument to another function and is executed later, usually after some operation has completed or when an event occurs.&lt;br&gt;
Callbacks are commonly used for:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Asynchronous operations (e.g., reading files, making API calls)&lt;/li&gt;
&lt;li&gt;Event handling (e.g., button clicks)&lt;/li&gt;
&lt;li&gt;Customizable function behavior&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;
  
  
  Types of callbacks:
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Synchronous Callbacks:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Executed immediately during the execution of the function they are passed to.&lt;/li&gt;
&lt;li&gt;Commonly used in array methods like .map(), .filter(), .forEach().&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;example:&lt;/strong&gt;&lt;br&gt;
&lt;code&gt;function greet(callback) {&lt;br&gt;
        console.log("Hello ");&lt;br&gt;
        callback(); &lt;br&gt;
    }&lt;br&gt;
    function sayBye() {&lt;br&gt;
        console.log("Goodbye!");&lt;br&gt;
    }&lt;br&gt;
    greet(sayBye);&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;output:&lt;/strong&gt;&lt;br&gt;
Hello &lt;br&gt;
Goodbye!&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Asynchronous Callbacks:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Executed later, often after an operation completes (e.g., timers, API calls, file reading).&lt;/li&gt;
&lt;li&gt;Common in event handling and I/O operations.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;
  
  
  4. JavaScript Array map():
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;The map() method creates a new array by performing a function on each array element.&lt;/li&gt;
&lt;li&gt;The map() method does not execute the function for array elements without values.&lt;/li&gt;
&lt;li&gt;The map() method does not change the original array.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;example:&lt;/strong&gt;&lt;br&gt;
&lt;code&gt;const num = [45, 4, 9, 12, 15];&lt;br&gt;
        num.map(display);&lt;br&gt;
        function display(value, index, array) {&lt;br&gt;
            console.log(value, index, array)&lt;br&gt;
        }&lt;br&gt;
        console.log(num);&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;output:&lt;/strong&gt;&lt;br&gt;
45 0 Array(5)&lt;br&gt;
4 1 Array(5)&lt;br&gt;
9 2 Array(5)&lt;br&gt;
12 3 Array(5)&lt;br&gt;
15 4 Array(5)&lt;/p&gt;
&lt;h2&gt;
  
  
  Differences between forEach() and map() methods:
&lt;/h2&gt;

&lt;p&gt;(TBD)&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F2fehqnpn8ysgy73c6umd.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F2fehqnpn8ysgy73c6umd.png" alt="difference" width="600" height="689"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Reference:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;
&lt;div class="crayons-card c-embed text-styles text-styles--secondary"&gt;
    &lt;div class="c-embed__content"&gt;
      &lt;div class="c-embed__body flex items-center justify-between"&gt;
        &lt;a href="https://www.w3schools.com/js/js_array_iteration.asp" rel="noopener noreferrer" class="c-link fw-bold flex items-center"&gt;
          &lt;span class="mr-2"&gt;w3schools.com&lt;/span&gt;
          

        &lt;/a&gt;
      &lt;/div&gt;
    &lt;/div&gt;
&lt;/div&gt;


</description>
    </item>
    <item>
      <title>BASIC ARRAY METHODS IN JAVASCRIPT</title>
      <dc:creator>G Gokul</dc:creator>
      <pubDate>Thu, 16 Jul 2026 17:06:42 +0000</pubDate>
      <link>https://dev.to/g_gokul_ganapathy/basic-array-methods-in-javascript-i0d</link>
      <guid>https://dev.to/g_gokul_ganapathy/basic-array-methods-in-javascript-i0d</guid>
      <description>&lt;h2&gt;
  
  
  Basic Array Methods
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;JavaScript Array length:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;the length property returns the length (size) of an array.&lt;/li&gt;
&lt;li&gt;The length property can also be used to set the length of an array.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt;&lt;br&gt;
&lt;code&gt;const fruits = ["Banana", "Orange", "Apple", "Mango"];&lt;br&gt;
console.log(fruits.length);&lt;br&gt;
fruits.length = 2;&lt;br&gt;
console.log(fruits)&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Output:&lt;/strong&gt;&lt;br&gt;
4&lt;br&gt;
[ 'Banana', 'Orange' ]&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;JavaScript Array toString():&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The toString() method returns the elements of an array as a comma separated string.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt;&lt;br&gt;
&lt;code&gt;const fruits = ["Banana", "Orange", "Apple", "Mango"];&lt;br&gt;
console.log(fruits.toString());&lt;br&gt;
&lt;/code&gt;&lt;br&gt;
&lt;strong&gt;Output:&lt;/strong&gt;&lt;br&gt;
Banana,Orange,Apple,Mango&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;JavaScript Array at():&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The at() method returns an indexed element from an array.&lt;/li&gt;
&lt;li&gt;The at() method returns the same as [].&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt;&lt;br&gt;
&lt;code&gt;const fruits = ["Banana", "Orange", "Apple", "Mango"];&lt;br&gt;
console.log(fruits.at(2));&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Output:&lt;/strong&gt;&lt;br&gt;
Apple&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;JavaScript Array join():&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The join() method also joins all array elements into a string.&lt;/li&gt;
&lt;li&gt;It behaves just like toString(), but in addition you can specify the separator.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt;&lt;br&gt;
&lt;code&gt;const fruits = ["Banana", "Orange", "Apple", "Mango"];&lt;br&gt;
console.log(fruits.join("*"));&lt;br&gt;
&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Output:&lt;/strong&gt;&lt;br&gt;
Banana*Orange*Apple*Mango&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;JavaScript Array pop():&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The pop() method removes the last element from an array.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt;&lt;br&gt;
&lt;code&gt;const fruits = ["Banana", "Orange", "Apple", "Mango"];&lt;br&gt;
console.log(fruits.pop());&lt;br&gt;
console.log(fruits)&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Output:&lt;/strong&gt;&lt;br&gt;
Mango&lt;br&gt;
[ 'Banana', 'Orange', 'Apple' ]&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;JavaScript Array push()&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The push() method adds a new element to an array (at the end).&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt;&lt;br&gt;
&lt;code&gt;const fruits = ["Banana", "Orange", "Apple", "Mango"];&lt;br&gt;
console.log(fruits.push("Kiwi"));&lt;br&gt;
console.log(fruits)&lt;br&gt;
&lt;/code&gt;&lt;br&gt;
&lt;strong&gt;Output:&lt;/strong&gt;&lt;br&gt;
5&lt;br&gt;
[ 'Banana', 'Orange', 'Apple', 'Mango', 'Kiwi' ]&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;JavaScript Array shift()&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The shift() method removes the first array element and "shifts" all other elements to a lower index.&lt;/li&gt;
&lt;li&gt;The shift() method returns the value that was "shifted out".&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt;&lt;br&gt;
&lt;code&gt;const fruits = ["Banana", "Orange", "Apple", "Mango"];&lt;br&gt;
console.log(fruits.shift());&lt;br&gt;
console.log(fruits)&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Output:&lt;/strong&gt;&lt;br&gt;
Banana&lt;br&gt;
[ 'Orange', 'Apple', 'Mango' ]&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;JavaScript Array unshift()&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The unshift() method adds a new element to an array (at the beginning), and "unshifts" older elements.&lt;/li&gt;
&lt;li&gt;The unshift() method returns the new array length.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;const fruits = ["Banana", "Orange", "Apple", "Mango"];&lt;br&gt;
console.log(fruits.unshift("Lemon"));&lt;br&gt;
console.log(fruits)&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Output:&lt;/strong&gt;&lt;br&gt;
5&lt;br&gt;
[ 'Lemon', 'Banana', 'Orange', 'Apple', 'Mango' ]&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Array.isArray()&lt;/strong&gt;&lt;br&gt;
&lt;strong&gt;Example:&lt;/strong&gt;&lt;br&gt;
&lt;code&gt;const fruits = ["Banana", "Orange", "Apple", "Mango"];&lt;br&gt;
console.log(Array.isArray(fruits));&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Output:&lt;/strong&gt;&lt;br&gt;
True&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;JavaScript Array delete()&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Using delete() leaves undefined holes in the array.&lt;/li&gt;
&lt;li&gt;Use pop() or shift() instead.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt;&lt;br&gt;
&lt;code&gt;const fruits = ["Banana", "Orange", "Apple", "Mango"];&lt;br&gt;
console.log(delete fruits[0]);&lt;br&gt;
console.log(fruits)&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Output:&lt;/strong&gt;&lt;br&gt;
true&lt;br&gt;
[ &amp;lt;1 empty item&amp;gt;, 'Orange', 'Apple', 'Mango' ]&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;JavaScript Array concat()&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The concat() method creates a new array by merging (concatenating) existing arrays.&lt;/li&gt;
&lt;li&gt;The concat() method does not change the existing arrays. It always returns a new array.&lt;/li&gt;
&lt;li&gt;The concat() method can take any number of array arguments.&lt;/li&gt;
&lt;li&gt;The concat() method can also take strings as arguments.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt;&lt;br&gt;
&lt;code&gt;const myGirls = ["Cecilie", "Lone"];&lt;br&gt;
const myBoys = ["Emil", "Tobias", "Linus"];&lt;br&gt;
const myChildren = myGirls.concat(myBoys);&lt;br&gt;
console.log(myChildren)&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Output:&lt;/strong&gt;&lt;br&gt;
['Cecilie', 'Lone', 'Emil', 'Tobias', 'Linus' ]&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Array copyWithin()&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The copyWithin() method copies array elements to another position in an array.&lt;/li&gt;
&lt;li&gt;The copyWithin() method overwrites the existing values.&lt;/li&gt;
&lt;li&gt;The copyWithin() method does not add items to the array.&lt;/li&gt;
&lt;li&gt;The copyWithin() method does not change the length of the array.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt;&lt;br&gt;
&lt;code&gt;const fruits = ["Banana", "Orange", "Apple", "Mango", "Kiwi"];&lt;br&gt;
console.log(fruits.copyWithin(2, 0, 2));&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Output:&lt;/strong&gt;&lt;br&gt;
['Banana', 'Orange', 'Banana', 'Orange', 'Kiwi' ]&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;JavaScript Array flat()&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The flat() method creates a new array with sub-array elements concatenated to a specified depth.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt;&lt;br&gt;
&lt;code&gt;const myArr = [[1,2],[3,4],[5,6]];&lt;br&gt;
const newArr = myArr.flat();&lt;br&gt;
console.log(newArr)&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Output:&lt;/strong&gt;&lt;br&gt;
[1, 2, 3, 4, 5, 6 ]&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;JavaScript Array flatMap()&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The flatMap() method first maps all elements of an array and then creates a new array by flattening the array.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt;&lt;br&gt;
&lt;code&gt;const myArr = [1, 2, 3, 4, 5, 6];&lt;br&gt;
const newArr = myArr.flatMap(x =&amp;gt; [x, x * 10]);&lt;br&gt;
console.log(newArr)&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Output:&lt;/strong&gt;&lt;br&gt;
[&lt;br&gt;
   1, 10,  2, 20,  3,&lt;br&gt;
  30,  4, 40,  5, 50,&lt;br&gt;
   6, 60&lt;br&gt;
]&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;JavaScript Array splice()&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The splice() method can be used to add new items to an array.&lt;/li&gt;
&lt;li&gt;The first parameter (2) defines the position where new elements should be added (spliced in).&lt;/li&gt;
&lt;li&gt;The second parameter (0) defines how many elements should be removed.&lt;/li&gt;
&lt;li&gt;The rest of the parameters ("Lemon" , "Kiwi") define the new elements to be added.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt;&lt;br&gt;
&lt;code&gt;const fruits = ["Banana", "Orange", "Apple", "Mango"];&lt;br&gt;
console.log(fruits.splice(2, 0, "Lemon", "Kiwi"));&lt;br&gt;
console.log(fruits)&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Output:&lt;/strong&gt;&lt;br&gt;
[]&lt;br&gt;
['Banana', 'Orange', 'Lemon', 'Kiwi', 'Apple', 'Mango' ]&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;JavaScript Array toSpliced()&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The difference between the new toSpliced() method and the old splice() method is that the new method creates a new array, keeping the original array unchanged, while the old method altered the original array.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;*&lt;em&gt;Example:&lt;/em&gt;"&lt;br&gt;
&lt;code&gt;const months = ["Jan", "Feb", "Mar", "Apr"];&lt;br&gt;
const spliced = months.toSpliced(0, 2);&lt;br&gt;
console.log(spliced)&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Output:&lt;/strong&gt;&lt;br&gt;
['Mar', 'Apr' ]&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;JavaScript Array slice()&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The slice() method slices out a piece of an array into a new array.&lt;/li&gt;
&lt;li&gt;The slice() method creates a new array.&lt;/li&gt;
&lt;li&gt;The slice() method does not remove any elements from the source array.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt;&lt;br&gt;
&lt;code&gt;const fruits = ["Banana", "Orange", "Lemon", "Apple", "Mango"];&lt;br&gt;
const citrus = fruits.slice(1, 3);&lt;br&gt;
console.log(citrus)&lt;br&gt;
console.log(fruits)&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Output:&lt;/strong&gt;&lt;br&gt;
[ 'Orange', 'Lemon' ]&lt;br&gt;
[ 'Banana', 'Orange', 'Lemon', 'Apple', 'Mango' ]&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>array</category>
      <category>methods</category>
    </item>
    <item>
      <title>ARRAYS IN JAVASCRIPT</title>
      <dc:creator>G Gokul</dc:creator>
      <pubDate>Wed, 15 Jul 2026 11:53:37 +0000</pubDate>
      <link>https://dev.to/g_gokul_ganapathy/arrays-in-javascript-1nkg</link>
      <guid>https://dev.to/g_gokul_ganapathy/arrays-in-javascript-1nkg</guid>
      <description>&lt;h2&gt;
  
  
  Arrays in js:
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;An Array is an object type designed for storing data collections.&lt;/li&gt;
&lt;li&gt;An array is a list of values, known as elements.&lt;/li&gt;
&lt;li&gt;Array elements are ordered based on their index.&lt;/li&gt;
&lt;li&gt;The first element is at index 0, the second at index 1, and so on.&lt;/li&gt;
&lt;li&gt;Arrays can grow or shrink as elements are added or removed.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F4pe55i1l0co4t2ugp9v3.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F4pe55i1l0co4t2ugp9v3.webp" alt="array" width="800" height="400"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Arrays can store elements of different data types (numbers, strings, objects and other arrays).&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  1. Create Array using Literal:
&lt;/h2&gt;

&lt;p&gt;Creating an array using array literal involves using square brackets [] to define and initialize the array.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;example:&lt;/strong&gt;&lt;br&gt;
&lt;code&gt;let b = [10, 20, 30];&lt;br&gt;
console.log(b);&lt;/code&gt;&lt;br&gt;
&lt;strong&gt;output:&lt;/strong&gt;&lt;br&gt;
&lt;code&gt;[10, 20, 30]&lt;/code&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  2. Create using new Keyword (Constructor):(TBD)
&lt;/h2&gt;

&lt;p&gt;The "Array Constructor" refers to a method of creating arrays by invoking the Array constructor function.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;example:&lt;/strong&gt;&lt;br&gt;
&lt;code&gt;let a = new Array(10, 20, 30);&lt;br&gt;
console.log(a);&lt;/code&gt;&lt;br&gt;
&lt;strong&gt;output:&lt;/strong&gt;&lt;br&gt;
&lt;code&gt;[10, 20, 30]&lt;/code&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Basic Operations on JavaScript Arrays:
&lt;/h2&gt;

&lt;p&gt;(TBD)&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. Accessing Elements of an Array:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Any element in the array can be accessed using the index number.&lt;/li&gt;
&lt;li&gt;The index in the arrays starts with 0.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;example:&lt;/strong&gt;&lt;br&gt;
&lt;code&gt;let k = ["HTML", "CSS", "JS"];&lt;br&gt;
        console.log(k[0]);&lt;br&gt;
        console.log(k[1]);&lt;/code&gt;&lt;br&gt;
&lt;strong&gt;output:&lt;/strong&gt;&lt;br&gt;
&lt;code&gt;html&lt;br&gt;
css&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. Modifying the Array Elements:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Elements in an array can be modified by assigning a new value to their corresponding index.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;example:&lt;/strong&gt;&lt;br&gt;
&lt;code&gt;let g = ["HTML", "CSS", "JS"];&lt;br&gt;
        console.log(g);&lt;br&gt;
        g[1] = "Bootstrap";&lt;br&gt;
        console.log(g);&lt;/code&gt;&lt;br&gt;
&lt;strong&gt;output:&lt;/strong&gt;&lt;br&gt;
&lt;code&gt;['HTML', 'CSS', 'JS']&lt;br&gt;
['HTML', 'Bootstrap', 'JS']&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. Adding Elements to the Array:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Elements can be added to the array using methods like push() and unshift().&lt;/li&gt;
&lt;li&gt;The push() method add the element to the end of the array.&lt;/li&gt;
&lt;li&gt;The unshift() method add the element to the starting of the array.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;example:&lt;/strong&gt;&lt;br&gt;
&lt;code&gt;let a = ["HTML", "CSS", "JS"];&lt;br&gt;
a.push("Node.js");&lt;br&gt;
a.unshift("Web Development");&lt;br&gt;
console.log(a);&lt;/code&gt;&lt;br&gt;
&lt;strong&gt;output:&lt;/strong&gt;&lt;br&gt;
&lt;code&gt;["Web Development","HTML","CSS","JS","Node.js"]&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;4. Removing Elements from an Array:&lt;/strong&gt;(TBD)&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;To remove the elements from an array we have different methods like pop(), shift(), or splice().&lt;/li&gt;
&lt;li&gt;The pop() method removes an element from the last index of the array.&lt;/li&gt;
&lt;li&gt;The shift() method removes the element from the first index of the array.&lt;/li&gt;
&lt;li&gt;The splice() method removes or replaces the element from the array.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;example:&lt;/strong&gt;&lt;br&gt;
&lt;code&gt;// Creating an Array and Initializing with Values&lt;br&gt;
        let m = ["HTML", "CSS", "JS"];&lt;br&gt;
        console.log(m);&lt;br&gt;
        // Removes and returns the last element&lt;br&gt;
        let lst = m.pop();&lt;br&gt;
        console.log(m);&lt;br&gt;
        // Removes and returns the first element&lt;br&gt;
        let fst = m.shift();&lt;br&gt;
        console.log(m);&lt;br&gt;
        // Removes 2 elements starting from index 1&lt;br&gt;
        m.splice(1, 2);&lt;br&gt;
        console.log(m);&lt;/code&gt;&lt;br&gt;
&lt;strong&gt;output:&lt;/strong&gt;&lt;br&gt;
&lt;code&gt;['HTML', 'CSS', 'JS']&lt;br&gt;
['HTML', 'CSS']&lt;br&gt;
['CSS']&lt;br&gt;
['CSS']&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;5. Array Length:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;We can get the length of the array using the array length property.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;example:&lt;/strong&gt;&lt;br&gt;
// Creating an Array and Initializing with Values&lt;br&gt;
&lt;code&gt;let a = ["HTML", "CSS", "JS"];&lt;br&gt;
let len = a.length;&lt;br&gt;
console.log("Array Length: " + len);&lt;/code&gt;&lt;br&gt;
&lt;strong&gt;output:&lt;/strong&gt;&lt;br&gt;
&lt;code&gt;Array Length: 3&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;6. Iterating Through Array Elements:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;example:&lt;/strong&gt;&lt;br&gt;
&lt;code&gt;let z = ["HTML", "CSS", "JS"];&lt;br&gt;
        for (let i = 0; i &amp;lt; z.length; i++) {&lt;br&gt;
            console.log(z[i])&lt;br&gt;
        }&lt;/code&gt;&lt;br&gt;
&lt;strong&gt;output:&lt;/strong&gt;&lt;br&gt;
&lt;code&gt;html&lt;br&gt;
css&lt;br&gt;
js&lt;/code&gt;&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>arrays</category>
      <category>object</category>
      <category>loops</category>
    </item>
    <item>
      <title>OBJECTS IN JAVASCRIPT PART-2</title>
      <dc:creator>G Gokul</dc:creator>
      <pubDate>Tue, 14 Jul 2026 12:48:02 +0000</pubDate>
      <link>https://dev.to/g_gokul_ganapathy/objects-in-javascript-part-2-2731</link>
      <guid>https://dev.to/g_gokul_ganapathy/objects-in-javascript-part-2-2731</guid>
      <description>&lt;h2&gt;
  
  
  CRUD operations in JS:
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;CRUD operations in JavaScript allow you to Create, Read, Update, and Delete data. &lt;/li&gt;
&lt;li&gt;These operations are fundamental for managing data in applications.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;1. Create:&lt;/strong&gt;&lt;br&gt;
To create an object or add properties to an existing object:&lt;br&gt;
&lt;strong&gt;example:&lt;/strong&gt;&lt;br&gt;
&lt;code&gt;const user = {&lt;br&gt;
   name: "John",&lt;br&gt;
   age: 30&lt;br&gt;
};&lt;br&gt;
user.email = "john@example.com";&lt;br&gt;
console.log(user);&lt;/code&gt;&lt;br&gt;
&lt;strong&gt;output:&lt;/strong&gt;&lt;br&gt;
&lt;code&gt;{name: 'John', age: 30, email: 'john@example.com'}&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. Read:&lt;/strong&gt;&lt;br&gt;
To access properties of an object:&lt;br&gt;
&lt;strong&gt;example:&lt;/strong&gt;&lt;br&gt;
&lt;code&gt;const user = {&lt;br&gt;
   name: "John",&lt;br&gt;
   age: 30,&lt;br&gt;
   email: "john@example.com"&lt;br&gt;
};&lt;br&gt;
// Using Dot Notation&lt;br&gt;
console.log(user.name);&lt;br&gt;
// Using Bracket Notation&lt;br&gt;
console.log(user["email"]);&lt;br&gt;
// Destructuring(TBD)&lt;br&gt;
const { name, age } = user;&lt;br&gt;
console.log(name, age);&lt;/code&gt;&lt;br&gt;
&lt;strong&gt;output:&lt;/strong&gt;&lt;br&gt;
&lt;code&gt;John&lt;br&gt;
john@example.com&lt;br&gt;
John 30&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. Update:&lt;/strong&gt;&lt;br&gt;
To modify existing properties:&lt;br&gt;
&lt;strong&gt;example:&lt;/strong&gt;&lt;br&gt;
&lt;code&gt;const user = {&lt;br&gt;
   name: "John",&lt;br&gt;
   age: 30,&lt;br&gt;
   email: "john@example.com"&lt;br&gt;
};&lt;br&gt;
user.age = 35;&lt;br&gt;
user["email"] = "john.doe@example.com";&lt;br&gt;
console.log(user);&lt;/code&gt;&lt;br&gt;
&lt;strong&gt;output:&lt;/strong&gt;&lt;br&gt;
&lt;code&gt;{name: 'John', age: 35, email: 'john.doe@example.com'}&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;4. Delete:&lt;/strong&gt;&lt;br&gt;
To remove properties from an object:&lt;br&gt;
&lt;strong&gt;example:&lt;/strong&gt;&lt;br&gt;
&lt;code&gt;const user = {&lt;br&gt;
   name: "John",&lt;br&gt;
   age: 30,&lt;br&gt;
   email: "john@example.com"&lt;br&gt;
};&lt;br&gt;
delete user.email;&lt;br&gt;
console.log(user);&lt;/code&gt;&lt;br&gt;
&lt;strong&gt;output:&lt;/strong&gt;&lt;br&gt;
&lt;code&gt;{name: 'John', age: 30}&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;CONSTRUCTORS:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;In JavaScript, a constructor is a special function used to create and initialize objects.&lt;/li&gt;
&lt;li&gt;It’s typically used with the new keyword to produce multiple objects of the same type.&lt;/li&gt;
&lt;li&gt;constructor function names start with an uppercase letter.&lt;/li&gt;
&lt;li&gt;this inside the constructor refers to that new current object.&lt;/li&gt;
&lt;li&gt;This approach is useful when you need to create many objects with similar properties and methods.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;example:&lt;/strong&gt;&lt;br&gt;
&lt;code&gt;function Laptop(price,brand,storage,ram){&lt;br&gt;
            this. price = price;&lt;br&gt;
            this. brand = brand;&lt;br&gt;
            this. storage = storage;&lt;br&gt;
            this. ram = ram;&lt;br&gt;
        }&lt;br&gt;
        const hp01 = new Laptop(40000,"hp",512,8);&lt;br&gt;
        const lenovol1 = new Laptop(50000,"lenovo",1000,16);&lt;br&gt;
        const asusvivobook = new Laptop(48000,"asus",516,16);&lt;br&gt;
        const delld5 = new Laptop(45000,"dell",256,8);&lt;br&gt;
        console.log(hp01);&lt;br&gt;
        console.log(asusvivobook.ram);&lt;br&gt;
        console.log(lenovol1["price"])&lt;/code&gt;&lt;br&gt;
&lt;strong&gt;output:&lt;/strong&gt;&lt;br&gt;
&lt;code&gt;Laptop&amp;nbsp;{price: 40000, brand: 'hp', storage: 512, ram: 8}&lt;br&gt;
16&lt;br&gt;
50000&lt;/code&gt;&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>objects</category>
      <category>constructor</category>
      <category>crud</category>
    </item>
    <item>
      <title>HOISTING AND OBJECTS IN JAVASCRIPT</title>
      <dc:creator>G Gokul</dc:creator>
      <pubDate>Mon, 13 Jul 2026 13:38:06 +0000</pubDate>
      <link>https://dev.to/g_gokul_ganapathy/hoisting-and-objects-in-javascript-185b</link>
      <guid>https://dev.to/g_gokul_ganapathy/hoisting-and-objects-in-javascript-185b</guid>
      <description>&lt;h2&gt;
  
  
  Hoisting:
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Hoisting refers to the behavior where JavaScript moves the declarations of variables, functions, and classes to the top of their scope during the compilation phase. &lt;/li&gt;
&lt;li&gt;This can sometimes lead to surprising results, especially when using var, let, const, or function expressions.&lt;/li&gt;
&lt;li&gt;Hoisting applies to variable and function declarations.&lt;/li&gt;
&lt;li&gt;Initializations are not hoisted, they are only declarations.&lt;/li&gt;
&lt;li&gt;'var' variables are hoisted with undefined, while 'let' and 'const' are hoisted but remain in the Temporal Dead Zone until initialized.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fnzpzhz7d61dbg5s8jpgg.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fnzpzhz7d61dbg5s8jpgg.webp" alt="hoisting" width="800" height="400"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Temporal Dead Zone (TDZ):
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;The Temporal Dead Zone (TDZ) is the period in JavaScript between entering a scope and the initialization of variables declared with let or const, during which accessing them results in an error.&lt;/li&gt;
&lt;li&gt;Variables declared with let and const are hoisted but not initialized.&lt;/li&gt;
&lt;li&gt;Accessing these variables before their declaration throws a ReferenceError.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;example:&lt;/strong&gt;&lt;br&gt;
&lt;code&gt;hello();&lt;br&gt;
var hello = function() {&lt;br&gt;
    console.log("Hi!");&lt;br&gt;
};&lt;/code&gt;&lt;br&gt;
&lt;strong&gt;output:&lt;/strong&gt;&lt;br&gt;
&lt;code&gt;TypeError: hello is not a function&lt;/code&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  1. Variable Hoisting with var:
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;When you use var to declare a variable, the declaration is hoisted to the top, but its value is not assigned until the code execution reaches the variable’s initialization. &lt;/li&gt;
&lt;li&gt;This results in the variable being assigned undefined during the hoisting phase.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;example:&lt;/strong&gt;&lt;br&gt;
&lt;code&gt;console.log(a);&lt;br&gt;
var a = 5;&lt;/code&gt;&lt;br&gt;
&lt;strong&gt;output:&lt;/strong&gt;&lt;br&gt;
&lt;code&gt;undefined&lt;/code&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  2. Variable Hoisting with let and const:
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Unlike var, let and const are also hoisted, but they remain in a Temporal Dead Zone (TDZ) from the start of the block until their declaration is encountered. &lt;/li&gt;
&lt;li&gt;Accessing them before their declaration will throw a ReferenceError.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;example:&lt;/strong&gt;&lt;br&gt;
&lt;code&gt;console.log(b); &lt;br&gt;
let b = 10;&lt;/code&gt;&lt;br&gt;
&lt;strong&gt;output:&lt;/strong&gt;&lt;br&gt;
&lt;code&gt;Uncaught ReferenceError: Cannot access 'b' before initialization&lt;/code&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  3. Function Declaration Hoisting:
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Function declarations are hoisted with both their name and the function body. &lt;/li&gt;
&lt;li&gt;This means the function can be called before its definition in the code.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;example:&lt;/strong&gt;&lt;br&gt;
&lt;code&gt;greet();&lt;br&gt;
function greet() {&lt;br&gt;
    console.log("Hello, Mahima!");&lt;br&gt;
}&lt;/code&gt;&lt;br&gt;
&lt;strong&gt;output:&lt;/strong&gt;&lt;br&gt;
&lt;code&gt;Hello, Mahima!&lt;/code&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  Objects in JS:
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;In JavaScript, an object is a collection of key–value pairs where keys (also called properties) are strings or symbols, and values can be any data type (including other objects or functions).&lt;/li&gt;
&lt;li&gt;Objects are used to store structured data and represent real-world entities.&lt;/li&gt;
&lt;li&gt;Values are stored as key:value pairs called properties.&lt;/li&gt;
&lt;li&gt;Functions are stored as key:function() pairs called methods.&lt;/li&gt;
&lt;li&gt;Objects are mutable and dynamic properties can be added, modified, or deleted at any time.&lt;/li&gt;
&lt;li&gt;Objects allow data grouping and encapsulation, making it easier to manage related information and behaviour together.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;There are two primary ways to create an object in JavaScript:&lt;/strong&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  1.Creation Using Object Literal:
&lt;/h2&gt;

&lt;p&gt;The object literal syntax allows you to define and initialize an object with curly braces {}, setting properties as key-value pairs.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;example:&lt;/strong&gt;&lt;br&gt;
&lt;code&gt;let obj = {&lt;br&gt;
    name: "Sourav",&lt;br&gt;
    age: 23,&lt;br&gt;
    job: "Developer"&lt;br&gt;
};&lt;br&gt;
console.log(obj);&lt;/code&gt;&lt;br&gt;
&lt;strong&gt;output:&lt;/strong&gt;&lt;br&gt;
&lt;code&gt;{"name":"Sourav","age":23,"job":"Developer"}&lt;/code&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  2. Creation Using new Object() Constructor:
&lt;/h2&gt;

&lt;p&gt;(TBD)&lt;/p&gt;
&lt;h2&gt;
  
  
  Properties:
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Values are stored as key:value pairs called properties.&lt;/li&gt;
&lt;li&gt;Definition: A property is a key–value pair inside an object.&lt;/li&gt;
&lt;li&gt;Key: Always a string (or symbol).&lt;/li&gt;
&lt;li&gt;Value: Can be any data type (string, number, boolean, object, array, function, etc.).&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;example:&lt;/strong&gt;&lt;br&gt;
&lt;code&gt;const mobile1={&lt;br&gt;
            name : "realme",&lt;br&gt;
            price : 45000,&lt;br&gt;
            storage : {&lt;br&gt;
                ram : 8,&lt;br&gt;
                rom : 256&lt;br&gt;
            }&lt;br&gt;
        }&lt;br&gt;
        console.log(mobile1)&lt;br&gt;
        console.log(mobile1.storage.ram)&lt;/code&gt;&lt;br&gt;
&lt;strong&gt;output:&lt;/strong&gt;&lt;br&gt;
&lt;code&gt;name: "realme"&lt;br&gt;
price: 45000&lt;br&gt;
storage: ram: 8&lt;br&gt;
         rom:256&lt;br&gt;
8&lt;/code&gt;&lt;br&gt;
Adding/Updating properties:(TBD)&lt;br&gt;
Deleting properties:(TBD)&lt;/p&gt;
&lt;h2&gt;
  
  
  Methods:
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Functions are stored as key:function() pairs called methods.&lt;/li&gt;
&lt;li&gt;Definition: A method is a function stored as a property.&lt;/li&gt;
&lt;li&gt;Purpose: To define behavior for the object.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;example:&lt;/strong&gt;&lt;br&gt;
&lt;code&gt;const mobile2 = {&lt;br&gt;
            name: "realme",&lt;br&gt;
            price: 45000,&lt;br&gt;
            storage: {&lt;br&gt;
                ram: 8,&lt;br&gt;
                rom: 256&lt;br&gt;
            },&lt;br&gt;
            browse:function(){&lt;br&gt;
                console.log("5g networking speed")&lt;br&gt;
            }&lt;br&gt;
        }&lt;br&gt;
        mobile2.browse();&lt;/code&gt;&lt;br&gt;
&lt;strong&gt;output:&lt;/strong&gt;&lt;br&gt;
&lt;code&gt;5g networking speed&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;References:&lt;br&gt;
&lt;/p&gt;
&lt;div class="crayons-card c-embed text-styles text-styles--secondary"&gt;
    &lt;div class="c-embed__content"&gt;
        &lt;div class="c-embed__cover"&gt;
          &lt;a href="https://www.geeksforgeeks.org/javascript/objects-in-javascript/" class="c-link align-middle" rel="noopener noreferrer"&gt;
            &lt;img alt="" src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fmedia.geeksforgeeks.org%2Fwp-content%2Fcdn-uploads%2Fgfg_200x200-min.png" height="200" class="m-0" width="200"&gt;
          &lt;/a&gt;
        &lt;/div&gt;
      &lt;div class="c-embed__body"&gt;
        &lt;h2 class="fs-xl lh-tight"&gt;
          &lt;a href="https://www.geeksforgeeks.org/javascript/objects-in-javascript/" rel="noopener noreferrer" class="c-link"&gt;
            Objects in JavaScript - GeeksforGeeks
          &lt;/a&gt;
        &lt;/h2&gt;
          &lt;p class="truncate-at-3"&gt;
            Your All-in-One Learning Portal: GeeksforGeeks is a comprehensive educational platform that empowers learners across domains-spanning computer science and programming, school education, upskilling, commerce, software tools, competitive exams, and more.
          &lt;/p&gt;
        &lt;div class="color-secondary fs-s flex items-center"&gt;
            &lt;img alt="favicon" class="c-embed__favicon m-0 mr-2 radius-0" src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fmedia.geeksforgeeks.org%2Fwp-content%2Fcdn-uploads%2Fgfg_favicon.png" width="32" height="32"&gt;
          geeksforgeeks.org
        &lt;/div&gt;
      &lt;/div&gt;
    &lt;/div&gt;
&lt;/div&gt;
&lt;br&gt;
&lt;div class="crayons-card c-embed text-styles text-styles--secondary"&gt;
    &lt;div class="c-embed__content"&gt;
      &lt;div class="c-embed__body flex items-center justify-between"&gt;
        &lt;a href="https://www.w3schools.com/js/js_object_properties.asp" rel="noopener noreferrer" class="c-link fw-bold flex items-center"&gt;
          &lt;span class="mr-2"&gt;w3schools.com&lt;/span&gt;
          

        &lt;/a&gt;
      &lt;/div&gt;
    &lt;/div&gt;
&lt;/div&gt;


</description>
      <category>javascript</category>
      <category>hoisting</category>
      <category>objects</category>
    </item>
    <item>
      <title>FUNCTIONS IN JAVASCRIPT</title>
      <dc:creator>G Gokul</dc:creator>
      <pubDate>Sun, 12 Jul 2026 15:50:11 +0000</pubDate>
      <link>https://dev.to/g_gokul_ganapathy/functions-in-javascript-46hl</link>
      <guid>https://dev.to/g_gokul_ganapathy/functions-in-javascript-46hl</guid>
      <description>&lt;h2&gt;
  
  
  Functions:
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Functions are one of the fundamental building blocks in JavaScript.&lt;/li&gt;
&lt;li&gt;In JavaScript, a function is a reusable block of code designed to perform a specific task. &lt;/li&gt;
&lt;li&gt;It can take inputs (parameters), process them, and optionally return an output. &lt;/li&gt;
&lt;li&gt;Functions help in organizing code, improving reusability, and making programs modular.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  How function works in js:
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;1. Function Declaration:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A function must be defined before it can be used.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;2. Function Execution:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Creates a new execution context.&lt;/li&gt;
&lt;li&gt;Passes arguments to parameters.&lt;/li&gt;
&lt;li&gt;Executes the function body line by line.&lt;/li&gt;
&lt;li&gt;Returns the result (or undefined if no return).&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Why use functions:
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fhkuawjp39i1brqsp8004.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fhkuawjp39i1brqsp8004.webp" alt="usage" width="800" height="400"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Understanding Functions:
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fxluo90ndn53at4d6xduc.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fxluo90ndn53at4d6xduc.webp" alt="function" width="800" height="400"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In functions, &lt;strong&gt;parameters&lt;/strong&gt; are placeholders defined in the function, while &lt;strong&gt;arguments&lt;/strong&gt; are the actual values you pass when calling the function.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;example:&lt;/strong&gt;&lt;br&gt;
&lt;code&gt;function greet(name) { &lt;br&gt;
  console.log("Hello " + name);&lt;br&gt;
}&lt;br&gt;
greet("Alice");&lt;/code&gt;&lt;br&gt;
&lt;strong&gt;output:&lt;/strong&gt;&lt;br&gt;
&lt;code&gt;Hello Alice&lt;/code&gt;&lt;br&gt;
&lt;strong&gt;Parameter:&lt;/strong&gt; name (placeholder inside the function).&lt;br&gt;
&lt;strong&gt;Argument:&lt;/strong&gt; "Alice" (real value given at call time).&lt;/p&gt;
&lt;h2&gt;
  
  
  Return Statement:
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;The return statement is used to send a result back from a function.&lt;/li&gt;
&lt;li&gt;When return executes, the function stops running at that point.&lt;/li&gt;
&lt;li&gt;The returned value can be stored in a variable or used directly.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;example:&lt;/strong&gt;&lt;br&gt;
&lt;code&gt;function add(a, b) {&lt;br&gt;
  return a + b; // returns the sum&lt;br&gt;
}&lt;br&gt;
let result = add(5, 10);&lt;br&gt;
console.log(result);&lt;/code&gt;&lt;br&gt;
&lt;strong&gt;output:&lt;/strong&gt;&lt;br&gt;
&lt;code&gt;15&lt;/code&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  Function Expression:
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;A function expression is a function created as part of an expression and assigned to a variable or passed to another function. &lt;/li&gt;
&lt;li&gt;It can be named or anonymous.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;example:&lt;/strong&gt;&lt;br&gt;
&lt;code&gt;const add = function(a, b) {&lt;br&gt;
  return a + b;&lt;br&gt;
};&lt;br&gt;
console.log(add(2, 3));&lt;/code&gt;&lt;br&gt;
output:&lt;br&gt;
&lt;code&gt;5&lt;/code&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  Arrow Function:
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;A new way to write functions using the =&amp;gt; syntax. &lt;/li&gt;
&lt;li&gt;They are shorter and do not have their own this binding, which makes them useful in some cases.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;example:&lt;br&gt;
&lt;code&gt;const square = n =&amp;gt; n * n;&lt;br&gt;
console.log(square(4));&lt;/code&gt;&lt;br&gt;
output:&lt;br&gt;
&lt;code&gt;16&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;References:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;
&lt;div class="crayons-card c-embed text-styles text-styles--secondary"&gt;
    &lt;div class="c-embed__content"&gt;
      &lt;div class="c-embed__body flex items-center justify-between"&gt;
        &lt;a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Functions" rel="noopener noreferrer" class="c-link fw-bold flex items-center"&gt;
          &lt;span class="mr-2"&gt;developer.mozilla.org&lt;/span&gt;
          

        &lt;/a&gt;
      &lt;/div&gt;
    &lt;/div&gt;
&lt;/div&gt;
&lt;br&gt;
&lt;div class="crayons-card c-embed text-styles text-styles--secondary"&gt;
    &lt;div class="c-embed__content"&gt;
        &lt;div class="c-embed__cover"&gt;
          &lt;a href="https://www.geeksforgeeks.org/javascript/functions-in-javascript/" class="c-link align-middle" rel="noopener noreferrer"&gt;
            &lt;img alt="" src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fmedia.geeksforgeeks.org%2Fwp-content%2Fcdn-uploads%2Fgfg_200x200-min.png" height="200" class="m-0" width="200"&gt;
          &lt;/a&gt;
        &lt;/div&gt;
      &lt;div class="c-embed__body"&gt;
        &lt;h2 class="fs-xl lh-tight"&gt;
          &lt;a href="https://www.geeksforgeeks.org/javascript/functions-in-javascript/" rel="noopener noreferrer" class="c-link"&gt;
            Functions in JavaScript - GeeksforGeeks
          &lt;/a&gt;
        &lt;/h2&gt;
          &lt;p class="truncate-at-3"&gt;
            Your All-in-One Learning Portal: GeeksforGeeks is a comprehensive educational platform that empowers learners across domains-spanning computer science and programming, school education, upskilling, commerce, software tools, competitive exams, and more.
          &lt;/p&gt;
        &lt;div class="color-secondary fs-s flex items-center"&gt;
            &lt;img alt="favicon" class="c-embed__favicon m-0 mr-2 radius-0" src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fmedia.geeksforgeeks.org%2Fwp-content%2Fcdn-uploads%2Fgfg_favicon.png" width="32" height="32"&gt;
          geeksforgeeks.org
        &lt;/div&gt;
      &lt;/div&gt;
    &lt;/div&gt;
&lt;/div&gt;


</description>
      <category>javascript</category>
      <category>function</category>
      <category>return</category>
      <category>arguments</category>
    </item>
    <item>
      <title>LOOPING IN JAVASCRIPT</title>
      <dc:creator>G Gokul</dc:creator>
      <pubDate>Sun, 12 Jul 2026 15:08:52 +0000</pubDate>
      <link>https://dev.to/g_gokul_ganapathy/looping-in-javascript-k7p</link>
      <guid>https://dev.to/g_gokul_ganapathy/looping-in-javascript-k7p</guid>
      <description>&lt;h2&gt;
  
  
  Looping:
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Loops in JavaScript are essential for executing a block of code repeatedly based on a specified condition. &lt;/li&gt;
&lt;li&gt;They are powerful tools for automating tasks and streamlining your code.&lt;/li&gt;
&lt;li&gt;JavaScript supports several types of loops, each suited for different scenarios.&lt;/li&gt;
&lt;li&gt;Loops continue running until the condition becomes false.&lt;/li&gt;
&lt;li&gt;They are useful for iterating over arrays, strings, and ranges of values.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Types of Loops:
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;1. for Loop:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The for loop is one of the most commonly used loops in JavaScript. &lt;/li&gt;
&lt;li&gt;It provides a concise way of writing the loop structure by including initialization, condition, and increment/decrement in one line.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;syntax:&lt;/strong&gt;&lt;br&gt;
&lt;code&gt;for (initialization; condition; increment/decrement)  { &lt;br&gt;
        // Code to execute}&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Flowchart:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F5ji2tbektc4h25fh1n80.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F5ji2tbektc4h25fh1n80.webp" alt="for loop" width="800" height="400"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;example:&lt;/strong&gt;&lt;br&gt;
&lt;code&gt;for (let i = 0; i &amp;lt; 5; i++) {&lt;br&gt;
console.log("Hello World!");&lt;br&gt;
}&lt;/code&gt;&lt;br&gt;
&lt;strong&gt;output:&lt;/strong&gt;&lt;br&gt;
&lt;code&gt;Hello World!&lt;br&gt;
Hello World!&lt;br&gt;
Hello World!&lt;br&gt;
Hello World!&lt;br&gt;
Hello World!&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. while Loop:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The while loop executes its statements as long as a specified condition evaluates to true. &lt;/li&gt;
&lt;li&gt;It is useful when the number of iterations is not known beforehand.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;syntax:&lt;/strong&gt;&lt;br&gt;
&lt;code&gt;while (condition) {&lt;br&gt;
    // Code to execute&lt;br&gt;
}&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Flowchart:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fuiqbbaer0mvjrvfxh2vw.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fuiqbbaer0mvjrvfxh2vw.webp" alt="while loop" width="800" height="400"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;example:&lt;/strong&gt;&lt;br&gt;
 &lt;code&gt;let i = 1;&lt;br&gt;
        let givenno = 54;&lt;br&gt;
        let count = 0;&lt;br&gt;
        while(i&amp;lt;=givenno){&lt;br&gt;
            if(givenno % i == 0){&lt;br&gt;
                count = count + 1;&lt;br&gt;
            }&lt;br&gt;
            i++;&lt;br&gt;
        }&lt;br&gt;
        console.log(count)&lt;/code&gt;&lt;br&gt;
&lt;strong&gt;output:&lt;/strong&gt;&lt;br&gt;
&lt;code&gt;8&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. do...while Loop:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The do-while loop is similar to the while loop, but it checks the condition after executing the statements. &lt;/li&gt;
&lt;li&gt;This ensures that the loop executes at least once.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;syntax:&lt;/strong&gt;&lt;br&gt;
&lt;code&gt;do {&lt;br&gt;
    // Code to execute&lt;br&gt;
} while (condition);&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Flowchart:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fveobiw29tpan2962ha5v.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fveobiw29tpan2962ha5v.webp" alt="do while" width="800" height="400"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;example:&lt;/strong&gt;&lt;br&gt;
&lt;code&gt;let num = 1;&lt;br&gt;
do {&lt;br&gt;
    console.log(num);&lt;br&gt;
    num++;&lt;br&gt;
} while (num &amp;lt;= 5);&lt;/code&gt;&lt;br&gt;
&lt;strong&gt;output:&lt;/strong&gt;&lt;br&gt;
&lt;code&gt;1&lt;br&gt;
2&lt;br&gt;
3&lt;br&gt;
4&lt;br&gt;
5&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;4. for...of Loop:&lt;/strong&gt;(TBD)&lt;br&gt;
&lt;strong&gt;5. for...in Loop:&lt;/strong&gt;(TBD)&lt;br&gt;
&lt;strong&gt;6. Breaking &amp;amp; Skipping:&lt;/strong&gt;(TBD)&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;References:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;
&lt;div class="crayons-card c-embed text-styles text-styles--secondary"&gt;
    &lt;div class="c-embed__content"&gt;
        &lt;div class="c-embed__cover"&gt;
          &lt;a href="https://www.geeksforgeeks.org/javascript/loops-in-javascript/" class="c-link align-middle" rel="noopener noreferrer"&gt;
            &lt;img alt="" src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fmedia.geeksforgeeks.org%2Fwp-content%2Fcdn-uploads%2Fgfg_200x200-min.png" height="200" class="m-0" width="200"&gt;
          &lt;/a&gt;
        &lt;/div&gt;
      &lt;div class="c-embed__body"&gt;
        &lt;h2 class="fs-xl lh-tight"&gt;
          &lt;a href="https://www.geeksforgeeks.org/javascript/loops-in-javascript/" rel="noopener noreferrer" class="c-link"&gt;
            JavaScript Loops - GeeksforGeeks
          &lt;/a&gt;
        &lt;/h2&gt;
          &lt;p class="truncate-at-3"&gt;
            Your All-in-One Learning Portal: GeeksforGeeks is a comprehensive educational platform that empowers learners across domains-spanning computer science and programming, school education, upskilling, commerce, software tools, competitive exams, and more.
          &lt;/p&gt;
        &lt;div class="color-secondary fs-s flex items-center"&gt;
            &lt;img alt="favicon" class="c-embed__favicon m-0 mr-2 radius-0" src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fmedia.geeksforgeeks.org%2Fwp-content%2Fcdn-uploads%2Fgfg_favicon.png" width="32" height="32"&gt;
          geeksforgeeks.org
        &lt;/div&gt;
      &lt;/div&gt;
    &lt;/div&gt;
&lt;/div&gt;
&lt;br&gt;
&lt;div class="crayons-card c-embed text-styles text-styles--secondary"&gt;
    &lt;div class="c-embed__content"&gt;
      &lt;div class="c-embed__body flex items-center justify-between"&gt;
        &lt;a href="https://www.w3schools.com/js/js_loop_while.asp" rel="noopener noreferrer" class="c-link fw-bold flex items-center"&gt;
          &lt;span class="mr-2"&gt;w3schools.com&lt;/span&gt;
          

        &lt;/a&gt;
      &lt;/div&gt;
    &lt;/div&gt;
&lt;/div&gt;


</description>
      <category>javascript</category>
      <category>looping</category>
      <category>for</category>
      <category>while</category>
    </item>
    <item>
      <title>CONDITIONAL STATEMENTS IN JAVASCRIPT</title>
      <dc:creator>G Gokul</dc:creator>
      <pubDate>Sun, 12 Jul 2026 14:38:56 +0000</pubDate>
      <link>https://dev.to/g_gokul_ganapathy/conditional-statements-in-javascript-250j</link>
      <guid>https://dev.to/g_gokul_ganapathy/conditional-statements-in-javascript-250j</guid>
      <description>&lt;h2&gt;
  
  
  Conditional Statements:
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;In JavaScript, conditional statements control the program flow by executing specific blocks of code based on whether a condition evaluates to true or false. &lt;/li&gt;
&lt;li&gt;They are essential for decision-making in scripts, enabling dynamic and interactive behavior.&lt;/li&gt;
&lt;li&gt;Conditions are evaluated using comparison and logical operators.&lt;/li&gt;
&lt;li&gt;They help in building dynamic and interactive applications by responding to different inputs.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Types of Conditional Statements:
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;1. if Statement:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The if statement checks a condition written inside parentheses. &lt;/li&gt;
&lt;li&gt;If the condition evaluates to true, the code inside {} is executed; otherwise, it is skipped.&lt;/li&gt;
&lt;li&gt;Executes code only when a specified condition is true.&lt;/li&gt;
&lt;li&gt;Useful for making simple decisions in a program.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;syntax:&lt;/strong&gt;&lt;br&gt;
&lt;code&gt;if (condition) {&lt;br&gt;
  //  block of code to be executed if the condition is true&lt;br&gt;
}&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;example:&lt;/strong&gt;&lt;br&gt;
&lt;code&gt;let mark = 35;&lt;br&gt;
if(mark&amp;gt;=35){&lt;br&gt;
console.log("pass")&lt;br&gt;
}&lt;/code&gt;&lt;br&gt;
&lt;strong&gt;output:&lt;/strong&gt;&lt;br&gt;
&lt;code&gt;pass&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. if...else Statement:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The if-else statement executes one block of code if a condition is true and another block if it is false.&lt;/li&gt;
&lt;li&gt; It ensures that exactly one of the two code blocks runs.&lt;/li&gt;
&lt;li&gt;Used when there are two possible outcomes.&lt;/li&gt;
&lt;li&gt;The else block runs when the if condition is not satisfied.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;syntax:&lt;/strong&gt;&lt;br&gt;
&lt;code&gt;if (condition) {&lt;br&gt;
  //  block of code to be executed if the condition is true&lt;br&gt;
} else {&lt;br&gt;
  //  block of code to be executed if the condition is false&lt;br&gt;
}&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;example:&lt;/strong&gt;&lt;br&gt;
&lt;code&gt;let age = 17;&lt;br&gt;
        if(age&amp;gt;=18){&lt;br&gt;
            console.log("eligible to vote")&lt;br&gt;
        }else{&lt;br&gt;
            console.log("not eligible to vote")&lt;br&gt;
        }&lt;/code&gt;&lt;br&gt;
&lt;strong&gt;output:&lt;/strong&gt;&lt;br&gt;
&lt;code&gt;not eligible to vote&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. if...else if...else Ladder:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The else if statement is used to test multiple conditions in sequence.&lt;/li&gt;
&lt;li&gt; It executes the first block whose condition evaluates to true.&lt;/li&gt;
&lt;li&gt;Allows checking more than two conditions.&lt;/li&gt;
&lt;li&gt;Evaluated from top to bottom until a true condition is found.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;syntax:&lt;/strong&gt;&lt;br&gt;
&lt;code&gt;if (condition1) {&lt;br&gt;
  //  block of code to be executed if condition1 is true&lt;br&gt;
} else if (condition2) {&lt;br&gt;
  //  block of code to be executed if the condition1 is false and condition2 is true&lt;br&gt;
} else {&lt;br&gt;
  //  block of code to be executed if the condition1 is false and condition2 is false&lt;br&gt;
}&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;example:&lt;/strong&gt;&lt;br&gt;
let score = 75;&lt;br&gt;
if (score &amp;gt;= 90) {&lt;br&gt;
    console.log("Grade: A");&lt;br&gt;
} else if (score &amp;gt;= 75) {&lt;br&gt;
    console.log("Grade: B");&lt;br&gt;
} else if (score &amp;gt;= 50) {&lt;br&gt;
    console.log("Grade: C");&lt;br&gt;
} else {&lt;br&gt;
    console.log("Grade: F");&lt;br&gt;
}&lt;br&gt;
&lt;strong&gt;output:&lt;/strong&gt;&lt;br&gt;
&lt;code&gt;Grade: B&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;4. switch Statement:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The switch statement evaluates an expression and executes the matching case block based on its value. &lt;/li&gt;
&lt;li&gt;It provides a clean and readable way to handle multiple conditions for a single variable.&lt;/li&gt;
&lt;li&gt;Used when one variable needs to be compared against multiple fixed values.&lt;/li&gt;
&lt;li&gt;Improves readability compared to long if...else if chains.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;syntax:&lt;/strong&gt;&lt;br&gt;
&lt;code&gt;switch(expression) {&lt;br&gt;
  case x:&lt;br&gt;
    // code block&lt;br&gt;
    break;&lt;br&gt;
  case y:&lt;br&gt;
    // code block&lt;br&gt;
    break;&lt;br&gt;
  default:&lt;br&gt;
    // code block&lt;br&gt;
}&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;example:&lt;/strong&gt;&lt;br&gt;
&lt;code&gt;let day = 3;&lt;br&gt;
      switch (day) {&lt;br&gt;
            case 1:&lt;br&gt;
                console.log("Monday");&lt;br&gt;
                break;&lt;br&gt;
            case 2:&lt;br&gt;
                console.log("Tuesday");&lt;br&gt;
                break;&lt;br&gt;
            case 3:&lt;br&gt;
                console.log("Wednesday");&lt;br&gt;
                break;&lt;br&gt;
            case 4:&lt;br&gt;
                console.log("Thursday");&lt;br&gt;
                break;&lt;br&gt;
            case 5:&lt;br&gt;
                console.log("Friday");&lt;br&gt;
                break;&lt;br&gt;
            case 6:&lt;br&gt;
                console.log("Saturday");&lt;br&gt;
                break;&lt;br&gt;
            case 7:&lt;br&gt;
                console.log("Sunday");&lt;br&gt;
                break;&lt;br&gt;
            default:&lt;br&gt;
                console.log("Invalid day");&lt;br&gt;
        }&lt;/code&gt;&lt;br&gt;
&lt;strong&gt;output:&lt;/strong&gt;&lt;br&gt;
&lt;code&gt;Wednesday&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;5. Ternary Operator (? :):&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The ternary operator is a compact shorthand for an if...else statement.&lt;/li&gt;
&lt;li&gt; It is called “ternary” because it takes three operands:&lt;/li&gt;
&lt;li&gt;A condition to test.&lt;/li&gt;
&lt;li&gt;An expression to evaluate if the condition is true.&lt;/li&gt;
&lt;li&gt;An expression to evaluate if the condition is false.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;syntax:&lt;/strong&gt;&lt;br&gt;
&lt;code&gt;(condition) ? expression1 : expression2&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;example:&lt;/strong&gt;&lt;br&gt;
&lt;code&gt;let age = 18;&lt;br&gt;
let message = (age &amp;gt;= 18) ? "Eligible to vote" : "Not eligible";&lt;br&gt;
console.log(message);&lt;/code&gt;&lt;br&gt;
&lt;strong&gt;output:&lt;/strong&gt;&lt;br&gt;
&lt;code&gt;Eligible to vote&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;6. Nested if...else:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A nested if...else statement is an if...else block written inside another if or else. &lt;/li&gt;
&lt;li&gt;It is used to evaluate multiple related conditions in a hierarchical manner.&lt;/li&gt;
&lt;li&gt;Useful for handling complex decision-making logic.&lt;/li&gt;
&lt;li&gt;Deep nesting should be avoided to maintain code readability.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fh6n4dpxqintqr8cl01ru.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fh6n4dpxqintqr8cl01ru.png" alt="nested if" width="506" height="353"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;example:&lt;/strong&gt;&lt;br&gt;
&lt;code&gt;let tam = 37;&lt;br&gt;
        let eng = 45;&lt;br&gt;
        let mat = 67;&lt;br&gt;
        let sci = 56;&lt;br&gt;
        let soc = 77;&lt;br&gt;
        let total;&lt;br&gt;
        let avg;&lt;br&gt;
        if (tam&amp;gt;=35 &amp;amp;&amp;amp; eng&amp;gt;=35 &amp;amp;&amp;amp; mat&amp;gt;=35 &amp;amp;&amp;amp; sci&amp;gt;=35 &amp;amp;&amp;amp; soc&amp;gt;=35){&lt;br&gt;
            console.log("pass")&lt;br&gt;
            total = (tam + eng + mat + sci + soc);&lt;br&gt;
            console.log(total)&lt;br&gt;
            avg = total/5;&lt;br&gt;
            console.log(avg)&lt;br&gt;
            if (avg&amp;gt;=70){&lt;br&gt;
                console.log("grade a");&lt;br&gt;
            }else if(avg&amp;gt;=50){&lt;br&gt;
                console.log("grade b")&lt;br&gt;
            }else{&lt;br&gt;
                console.log("grade c")&lt;br&gt;
            }&lt;br&gt;
        }else{&lt;br&gt;
            console.log("fail");&lt;br&gt;
        }&lt;/code&gt;&lt;br&gt;
&lt;strong&gt;output:&lt;/strong&gt;&lt;br&gt;
&lt;code&gt;pass&lt;br&gt;
282&lt;br&gt;
56.4&lt;br&gt;
grade b&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;References:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;
&lt;div class="crayons-card c-embed text-styles text-styles--secondary"&gt;
    &lt;div class="c-embed__content"&gt;
        &lt;div class="c-embed__cover"&gt;
          &lt;a href="https://www.geeksforgeeks.org/javascript/conditional-statements-in-javascript/" class="c-link align-middle" rel="noopener noreferrer"&gt;
            &lt;img alt="" src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fmedia.geeksforgeeks.org%2Fwp-content%2Fcdn-uploads%2Fgfg_200x200-min.png" height="200" class="m-0" width="200"&gt;
          &lt;/a&gt;
        &lt;/div&gt;
      &lt;div class="c-embed__body"&gt;
        &lt;h2 class="fs-xl lh-tight"&gt;
          &lt;a href="https://www.geeksforgeeks.org/javascript/conditional-statements-in-javascript/" rel="noopener noreferrer" class="c-link"&gt;
            JavaScript - Conditional Statements - GeeksforGeeks
          &lt;/a&gt;
        &lt;/h2&gt;
          &lt;p class="truncate-at-3"&gt;
            Your All-in-One Learning Portal: GeeksforGeeks is a comprehensive educational platform that empowers learners across domains-spanning computer science and programming, school education, upskilling, commerce, software tools, competitive exams, and more.
          &lt;/p&gt;
        &lt;div class="color-secondary fs-s flex items-center"&gt;
            &lt;img alt="favicon" class="c-embed__favicon m-0 mr-2 radius-0" src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fmedia.geeksforgeeks.org%2Fwp-content%2Fcdn-uploads%2Fgfg_favicon.png" width="32" height="32"&gt;
          geeksforgeeks.org
        &lt;/div&gt;
      &lt;/div&gt;
    &lt;/div&gt;
&lt;/div&gt;


&lt;p&gt;&lt;a href="https://www.w3schools.com/js/js_switch.asp" rel="noopener noreferrer"&gt;https://www.w3schools.com/js/js_switch.asp&lt;/a&gt;&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>if</category>
      <category>else</category>
      <category>switch</category>
    </item>
    <item>
      <title>OPERATORS IN JAVASCRIPT</title>
      <dc:creator>G Gokul</dc:creator>
      <pubDate>Sun, 12 Jul 2026 08:58:41 +0000</pubDate>
      <link>https://dev.to/g_gokul_ganapathy/operators-in-javascript-39pl</link>
      <guid>https://dev.to/g_gokul_ganapathy/operators-in-javascript-39pl</guid>
      <description>&lt;h2&gt;
  
  
  Operators in JS:
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;In JavaScript, operators are symbols or keywords used to perform operations on values (operands).&lt;/li&gt;
&lt;li&gt;They are the building blocks of expressions and allow you to manipulate data, perform calculations, compare values, and control logic.&lt;/li&gt;
&lt;li&gt;Operators fall into three arities based on how many operands they take:&lt;/li&gt;
&lt;li&gt;Binary takes two operands, one on each side: a + b, x === y&lt;/li&gt;
&lt;li&gt;Unary takes a single operand, before or after: typeof x, x++&lt;/li&gt;
&lt;li&gt;Ternary takes three operands: condition ? a : b&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Types of Operators in JS:
&lt;/h2&gt;

&lt;p&gt;JavaScript provides a variety of operators to perform actions on values and variables, and data types to represent different kinds of values.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. Arithmetic Operators:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Arithmetic Operators perform mathematical calculations like addition, subtraction, multiplication, division, remainder, increment, decrement,exponentiation etc.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;example:&lt;/strong&gt;&lt;br&gt;
&lt;code&gt;let x = 5;&lt;br&gt;
console.log("Addition: x + 3 = ", x + 3);&lt;br&gt;
console.log("Subtraction: x - 3 =", x - 3);&lt;br&gt;
console.log("Multiplication: x * 3 =", x * 3);&lt;br&gt;
console.log("Division: x / 3 =", x / 3);&lt;br&gt;
console.log("Remainder: x % 3 =", x % 3);&lt;br&gt;
console.log("Increment: ++x =", ++x);&lt;br&gt;
console.log("Decrement: --x =", --x);&lt;br&gt;
console.log("Exponentiation: x ** 3 =", x ** 3);&lt;/code&gt;&lt;br&gt;
&lt;strong&gt;output:&lt;/strong&gt;&lt;br&gt;
&lt;code&gt;Addition: x + 3 =  8&lt;br&gt;
Subtraction: x - 3 = 2&lt;br&gt;
Multiplication: x * 3 = 15&lt;br&gt;
Division: x / 3 = 1.6666666666666667&lt;br&gt;
Remainder: x % 3 = 2&lt;br&gt;
Increment: ++x = 6&lt;br&gt;
Decrement: --x = 5&lt;br&gt;
Exponentiation: x ** 3 = 125&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. Assignment Operators:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Assignment operators are used to assign values to variables. &lt;/li&gt;
&lt;li&gt;They can also perform operations like addition or multiplication while assigning the value.&lt;/li&gt;
&lt;li&gt;For example: a += 5 -&amp;gt; a = a + 5.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;example:&lt;/strong&gt;&lt;br&gt;
&lt;code&gt;let a = 7;&lt;br&gt;
console.log(a);&lt;br&gt;
a += 5; &lt;br&gt;
console.log(a);&lt;br&gt;
a -= 5;&lt;br&gt;
console.log(a);&lt;br&gt;
a *= 2;  &lt;br&gt;
console.log(a);&lt;br&gt;
a /= 2;&lt;br&gt;
console.log(a);&lt;br&gt;
a %= 2;&lt;br&gt;
console.log(a);&lt;br&gt;
a **= 2;&lt;br&gt;
console.log(a);&lt;/code&gt;&lt;br&gt;
&lt;strong&gt;output:&lt;/strong&gt;&lt;br&gt;
&lt;code&gt;7&lt;br&gt;
12&lt;br&gt;
7&lt;br&gt;
14&lt;br&gt;
7&lt;br&gt;
1&lt;br&gt;
1&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. Comparison Operators:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Comparison operators compare two values and return a boolean (true or false). &lt;/li&gt;
&lt;li&gt;They are useful for making decisions in conditional statements.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Loose equality (==)&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Checks whether two values are equal after type coercion. JavaScript converts operand types before comparing.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Strict equality (===)&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Checks value and type. No coercion happens. Prefer === in almost every situation because loose equality produces counterintuitive results.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Loose inequality (!=)&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Returns true if the values are not equal after coercion.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Greater than (&amp;gt;) and greater than or equal (&amp;gt;=)&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Less than (&amp;lt;) and less than or equal (&amp;lt;=)&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;example:&lt;/strong&gt;&lt;br&gt;
&lt;code&gt;console.log(2 == 2);&lt;br&gt;
console.log(3 != 3);&lt;br&gt;
console.log(2 === '2');&lt;br&gt;
console.log(2 !== '2');&lt;br&gt;
console.log(3 &amp;gt; 3);&lt;br&gt;
console.log(2 &amp;gt; 2);&lt;br&gt;
console.log(3 &amp;gt;= 3);&lt;br&gt;
console.log(2 &amp;lt;= 2);&lt;/code&gt;&lt;br&gt;
&lt;strong&gt;output:&lt;/strong&gt;&lt;br&gt;
&lt;code&gt;true&lt;br&gt;
false&lt;br&gt;
false&lt;br&gt;
true&lt;br&gt;
false&lt;br&gt;
false&lt;br&gt;
true&lt;br&gt;
true&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;4. Logical Operators:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Logical operators are mainly used to perform the logical operations that determine the equality or difference between the values.&lt;/li&gt;
&lt;li&gt;&amp;amp;&amp;amp; returns true if both operands are true.&lt;/li&gt;
&lt;li&gt;|| returns true if at least one operand is true.&lt;/li&gt;
&lt;li&gt;! negates the boolean value.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;example:&lt;/strong&gt;&lt;br&gt;
&lt;code&gt;let age = 20;&lt;br&gt;
console.log(age &amp;gt; 18 &amp;amp;&amp;amp; age &amp;lt; 30);&lt;br&gt;
console.log(age &amp;gt; 18 || age &amp;gt; 30);&lt;br&gt;
console.log(!(age &amp;gt; 18));&lt;/code&gt;&lt;br&gt;
&lt;strong&gt;output:&lt;/strong&gt;&lt;br&gt;
&lt;code&gt;true&lt;br&gt;
true&lt;br&gt;
false&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;5. Bitwise Operators:&lt;/strong&gt;(TBD)&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Bitwise operators perform operations on binary representations of numbers.&lt;/li&gt;
&lt;li&gt;&amp;amp; performs AND operation on each bit.&lt;/li&gt;
&lt;li&gt;| performs OR operation on each bit.&lt;/li&gt;
&lt;li&gt;^ performs XOR (exclusive OR) on each bit.&lt;/li&gt;
&lt;li&gt;~ inverts all bits (NOT operator).&lt;/li&gt;
&lt;li&gt;&amp;lt;&amp;lt; shifts bits to the left.&lt;/li&gt;
&lt;li&gt;&amp;gt;&amp;gt; shifts bits to the right (with sign).&lt;/li&gt;
&lt;li&gt;&amp;gt;&amp;gt;&amp;gt; shifts bits to the right (without sign).&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;6. Ternary Operator:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A ternary operator evaluates a condition and executes a block of code based on the condition.&lt;/li&gt;
&lt;li&gt;The ternary operator evaluates the test condition.&lt;/li&gt;
&lt;li&gt;If the condition is true, expression1 is executed.&lt;/li&gt;
&lt;li&gt;If the condition is false, expression2 is executed.&lt;/li&gt;
&lt;li&gt;The ternary operator takes three operands, hence, the name ternary operator. &lt;/li&gt;
&lt;li&gt;It is also known as a conditional operator.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;syntax:&lt;/strong&gt;&lt;br&gt;
&lt;code&gt;condition ? expression1 : expression2&lt;/code&gt;&lt;br&gt;
&lt;strong&gt;example:&lt;/strong&gt;&lt;br&gt;
 &lt;code&gt;let marks = 45;&lt;br&gt;
 let result = marks&amp;gt;35 ? "pass" : "fail";&lt;br&gt;
 console.log(result)&lt;/code&gt;&lt;br&gt;
&lt;strong&gt;output:&lt;/strong&gt;&lt;br&gt;
&lt;code&gt;pass&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;7. Type Operators:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;typeof → Returns the type of a variable.&lt;/li&gt;
&lt;li&gt;instanceof → Checks if an object is an instance of a class.(TBD)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;example:&lt;/strong&gt;&lt;br&gt;
&lt;code&gt;console.log(typeof "Hello");&lt;br&gt;
console.log([1,2,3] instanceof Array);&lt;/code&gt;&lt;br&gt;
&lt;strong&gt;output:&lt;/strong&gt;&lt;br&gt;
&lt;code&gt;string&lt;br&gt;
true&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;References:&lt;br&gt;
&lt;/p&gt;
&lt;div class="crayons-card c-embed text-styles text-styles--secondary"&gt;
    &lt;div class="c-embed__content"&gt;
        &lt;div class="c-embed__cover"&gt;
          &lt;a href="https://www.geeksforgeeks.org/javascript/javascript-operators/" class="c-link align-middle" rel="noopener noreferrer"&gt;
            &lt;img alt="" src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fmedia.geeksforgeeks.org%2Fwp-content%2Fcdn-uploads%2Fgfg_200x200-min.png" height="200" class="m-0" width="200"&gt;
          &lt;/a&gt;
        &lt;/div&gt;
      &lt;div class="c-embed__body"&gt;
        &lt;h2 class="fs-xl lh-tight"&gt;
          &lt;a href="https://www.geeksforgeeks.org/javascript/javascript-operators/" rel="noopener noreferrer" class="c-link"&gt;
            JavaScript Operators - GeeksforGeeks
          &lt;/a&gt;
        &lt;/h2&gt;
          &lt;p class="truncate-at-3"&gt;
            Your All-in-One Learning Portal: GeeksforGeeks is a comprehensive educational platform that empowers learners across domains-spanning computer science and programming, school education, upskilling, commerce, software tools, competitive exams, and more.
          &lt;/p&gt;
        &lt;div class="color-secondary fs-s flex items-center"&gt;
            &lt;img alt="favicon" class="c-embed__favicon m-0 mr-2 radius-0" src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fmedia.geeksforgeeks.org%2Fwp-content%2Fcdn-uploads%2Fgfg_favicon.png" width="32" height="32"&gt;
          geeksforgeeks.org
        &lt;/div&gt;
      &lt;/div&gt;
    &lt;/div&gt;
&lt;/div&gt;
&lt;br&gt;
&lt;div class="crayons-card c-embed text-styles text-styles--secondary"&gt;
    &lt;div class="c-embed__content"&gt;
      &lt;div class="c-embed__body flex items-center justify-between"&gt;
        &lt;a href="https://www.programiz.com/javascript/operators" rel="noopener noreferrer" class="c-link fw-bold flex items-center"&gt;
          &lt;span class="mr-2"&gt;programiz.com&lt;/span&gt;
          

        &lt;/a&gt;
      &lt;/div&gt;
    &lt;/div&gt;
&lt;/div&gt;
&lt;br&gt;
&lt;div class="crayons-card c-embed text-styles text-styles--secondary"&gt;
    &lt;div class="c-embed__content"&gt;
        &lt;div class="c-embed__cover"&gt;
          &lt;a href="https://codeforgeek.com/javascript-operators/" class="c-link align-middle" rel="noopener noreferrer"&gt;
            &lt;img alt="" src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcodeforgeek.com%2Fwp-content%2Fuploads%2F2025%2F07%2Ffeat-16733.png" height="419" class="m-0" width="800"&gt;
          &lt;/a&gt;
        &lt;/div&gt;
      &lt;div class="c-embed__body"&gt;
        &lt;h2 class="fs-xl lh-tight"&gt;
          &lt;a href="https://codeforgeek.com/javascript-operators/" rel="noopener noreferrer" class="c-link"&gt;
            All JS Operators in one guide | CodeForGeek
          &lt;/a&gt;
        &lt;/h2&gt;
          &lt;p class="truncate-at-3"&gt;
            JS operators are the symbols and keywords that let you do something meaningful with values: add two numbers, compare a user's input, check if an object has a
          &lt;/p&gt;
        &lt;div class="color-secondary fs-s flex items-center"&gt;
            &lt;img alt="favicon" class="c-embed__favicon m-0 mr-2 radius-0" src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcodeforgeek.com%2Fwp-content%2Fuploads%2Fcodefavicon-150x150.png" width="150" height="150"&gt;
          codeforgeek.com
        &lt;/div&gt;
      &lt;/div&gt;
    &lt;/div&gt;
&lt;/div&gt;


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