{"id":5239,"date":"2024-10-24T09:28:51","date_gmt":"2024-10-24T09:28:51","guid":{"rendered":"https:\/\/ubiq.co\/tech-blog\/?p=5239"},"modified":"2024-10-24T09:59:37","modified_gmt":"2024-10-24T09:59:37","slug":"how-to-remove-item-from-array-in-javascript","status":"publish","type":"post","link":"https:\/\/ubiq.co\/tech-blog\/how-to-remove-item-from-array-in-javascript\/","title":{"rendered":"How to Remove Item From Array In JavaScript"},"content":{"rendered":"\n<p>JavaScript developers frequently use arrays to store data. They are very easy to use and offer tons of features. Often, while working with JS arrays, developers need to remove one or more items from the array. There are plenty of different ways to do this using plain JavaScript, without using any third-party library. In this article, we will learn how to remove item from array in JavaScript.<\/p>\n\n\n\n<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_82_2 counter-hierarchy ez-toc-counter ez-toc-grey ez-toc-container-direction\">\n<div class=\"ez-toc-title-container\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">Table of Contents<\/p>\n<span class=\"ez-toc-title-toggle\"><a href=\"#\" class=\"ez-toc-pull-right ez-toc-btn ez-toc-btn-xs ez-toc-btn-default ez-toc-toggle\" aria-label=\"Toggle Table of Content\"><span class=\"ez-toc-js-icon-con\"><span class=\"\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #999;color:#999\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #999;color:#999\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewBox=\"0 0 24 24\" version=\"1.2\" baseProfile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/span><\/a><\/span><\/div>\n<nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/ubiq.co\/tech-blog\/how-to-remove-item-from-array-in-javascript\/#How_to_Remove_Item_From_Array_In_JavaScript\" >How to Remove Item From Array In JavaScript<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/ubiq.co\/tech-blog\/how-to-remove-item-from-array-in-javascript\/#1_Using_pop\" >1. Using pop()<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/ubiq.co\/tech-blog\/how-to-remove-item-from-array-in-javascript\/#2_Using_shift\" >2. Using shift()<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/ubiq.co\/tech-blog\/how-to-remove-item-from-array-in-javascript\/#3_Using_delete_operator\" >3. Using delete operator<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/ubiq.co\/tech-blog\/how-to-remove-item-from-array-in-javascript\/#4_Using_splice\" >4. Using splice()<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-6\" href=\"https:\/\/ubiq.co\/tech-blog\/how-to-remove-item-from-array-in-javascript\/#5_Using_slice\" >5. Using slice()<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-7\" href=\"https:\/\/ubiq.co\/tech-blog\/how-to-remove-item-from-array-in-javascript\/#6_Using_filter\" >6. Using filter()<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-8\" href=\"https:\/\/ubiq.co\/tech-blog\/how-to-remove-item-from-array-in-javascript\/#7_Using_for_loop\" >7. Using for loop<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-9\" href=\"https:\/\/ubiq.co\/tech-blog\/how-to-remove-item-from-array-in-javascript\/#8_Using_Spread_Operator\" >8. Using Spread Operator<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-10\" href=\"https:\/\/ubiq.co\/tech-blog\/how-to-remove-item-from-array-in-javascript\/#Conclusion\" >Conclusion<\/a><\/li><\/ul><\/nav><\/div>\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"How_to_Remove_Item_From_Array_In_JavaScript\"><\/span>How to Remove Item From Array In JavaScript<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>Here are some of the common ways to remove one or more items from JavaScript array. Most of these solutions involve calling a function that is already supported by the array. Let us say you have the following array.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">var num = [1, 2, 3, 4, 5]<\/pre>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"1_Using_pop\"><\/span>1. Using pop()<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>The pop() function removes and returns the last item of a JavaScript array, every time it is called. Let us say you call it on the above mentioned num array.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">var num = [1, 2, 3, 4, 5];<br><br>console.log(num.pop());<br>console.log(num); <br><br>console.log(num.pop());<br>console.log(num);<\/pre>\n\n\n\n<p>Here is the output you will see.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">5<br>[ 1, 2, 3, 4 ]<br>4<br>[ 1, 2, 3 ]<\/pre>\n\n\n\n<p>In the above code, when we first call pop() function it returns the last item 5. This modifies the original array and reduces its length by 1. When we call it again, it returns the current last item 4 and reduces the array length by 1 once again.<\/p>\n\n\n\n<p>pop() function works well on all kinds of arrays not just numbers, strings or mixed data types.<\/p>\n\n\n\n<p>Please note, if you call pop() function on an empty array, it will return &#8216;undefined&#8217; value.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"2_Using_shift\"><\/span>2. Using shift()<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>On the other hand, shift() function will remove and return the first item in JavaScript array. It works similar to pop() function, except that it returns the first item instead of last item, every time you call it on an array.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">var num = [1, 2, 3, 4, 5];<br><br>console.log(num.shift());<br>console.log(num);<br><br>console.log(num.shift());<br>console.log(num);<\/pre>\n\n\n\n<p>Here is its output.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">1<br>[ 2, 3, 4, 5 ]<br>2<br>[ 3, 4, 5 ]<\/pre>\n\n\n\n<p>In the above code, when we call shift() function, it returns the first item 1 and reduces array length by 1. When we call it again, it once again returns the present first item 2 and reduces the array length by 1.<\/p>\n\n\n\n<p>Like pop() function, if you call shift() function on empty arrays, it will return undefined value. It works on all kinds of array items, whether they are numbers, strings, or complex data types.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"3_Using_delete_operator\"><\/span>3. Using delete operator<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>Delete operator allows you to remove the value of an item using its index. It returns true if the item is successfully removed and returns false if it is not removed. Also, the value of item is set to undefined. Here is its syntax.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">delete array_name[index]<\/pre>\n\n\n\n<p>Here is an example to delete item with index=2.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">var num = [1, 2, 3, 4, 5];<br><br>console.log(delete num[2]);<br>console.log(num);<br><br>console.log(delete num[7]);<br>console.log(num);<\/pre>\n\n\n\n<p>Here is the output you will see.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">true<br>[1, 2, undefined, 4, 5]<br><br>true<br>[1, 2, undefined, 4, 5]<\/pre>\n\n\n\n<p>In the above code, we first call delete operator to remove item with index=2. We receive true as its output and see that the original array has been modified. <\/p>\n\n\n\n<p>Please note, then we call it again with an index=6 that is outside the array bounds. Still we get true but not false or any error.<\/p>\n\n\n\n<p>Also, it only removes the value of the item but not the item itself. So the length of array remains unchanged. The value of removed item becomes undefined.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"4_Using_splice\"><\/span>4. Using splice()<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>Splice function allows you to easily remove\/add items in a JavaScript array. Here is the syntax for item removal.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">array_name.splice(starting_index, num_of_items);<\/pre>\n\n\n\n<p>Here is an example to remove 2 items from num array starting from index=1.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">var num = [1, 2, 3, 4, 5];<br><br>console.log(num.splice(1,2));<br>console.log(num);<\/pre>\n\n\n\n<p>Here is the output.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">[ 2, 3 ]<br>[ 1, 4, 5 ]<\/pre>\n\n\n\n<p>In the above example, we first call splice() function which returns an array of 2 items starting from index=1. We also see that the original array has been modified.<\/p>\n\n\n\n<p><a href=\"https:\/\/developer.mozilla.org\/en-US\/docs\/Web\/JavaScript\/Reference\/Global_Objects\/Array\/splice\" target=\"_blank\" rel=\"noreferrer noopener\">splice()<\/a> is one of the most useful functions for manipulating arrays. It can also be used with other functions and loops to deal with some powerful use cases.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"5_Using_slice\"><\/span>5. Using slice()<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>slice() is another useful function that allows you to easily extract items from an array, but it does not remove those items from original array. Here is its syntax.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">array_name.slice(start_index, end_index)<\/pre>\n\n\n\n<p>slice() function returns items starting from the start_index up to end_index excluding the item with end_index.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">var num = [1, 2, 3, 4, 5];<br>console.log(num.slice(1,3));<br>console.log(num);<\/pre>\n\n\n\n<p>In the above code, we call slice() function to extract items starting with index=1 up to index=3 excluding the item with index=3.<\/p>\n\n\n\n<p>Here is the output you get.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">[ 2, 3 ]<br>[ 1, 2, 3, 4, 5 ]<\/pre>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"6_Using_filter\"><\/span>6. Using filter()<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>filter() function allows you to issue a set of commands, conditions or function for all the items of an array, and get an array of items that result in true values. It is typically used to extract a sub-array from a given array, using a set of conditions. It can also be used to remove items from an array. Here is an example to illustrate it.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">var num = [1, 2, 3, 4, 5];<br><br>function extract(val){<br>    return val&gt;= 2 &amp;&amp; val &lt; 5;<br>}<br><br>console.log(num.filter(extract));<br>console.log(num);<\/pre>\n\n\n\n<p>In the above code, we define a function extract() that returns true if it is >=2 and &lt;5 else false. We call this function in filter() of num array. So it is called for all items of the array. Here is the output you get.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">[ 2, 3, 4 ]<br>[ 1, 2, 3, 4, 5 ]<\/pre>\n\n\n\n<p> We strongly recommend that you read up about filter() function since it is extremely versatile and helpful.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"7_Using_for_loop\"><\/span>7. Using for loop<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>This is the good old fashioned method of simply looping through the original array, checking each item for one or more conditions and removing those items that fulfill the condition. Here is an example.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">var num = [1, 2, 3, 4, 5];<br>var new_num=[];<br>for(i =0;i&lt;num.length;i++){<br>    if(i==3){<br>        new_num.push(num[i]);<br>    }<br>}<br><br>console.log(num);<br>console.log(new_num);<\/pre>\n\n\n\n<p>Here is the output you see.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">[ 1, 2, 3, 4, 5 ]<br>[ 4 ]<\/pre>\n\n\n\n<p>The above method does not alter the original array, but it offers tremendous control over the items you want to extract. This can be difficult to do using other methods but for loop makes things easy. For example, you can choose to remove alternate items (index=0,2,4) as shown below.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">for(i =0;i&lt;num.length;i++){<br>    if([0, 2, 4].includes(i)){<br>        new_num.push(num[i]);<br>    }<br>}<br><br>console.log(num);<br>console.log(new_num);<\/pre>\n\n\n\n<p>Here is the output you will see.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">[ 1, 2, 3, 4, 5 ]<br>[ 1, 3, 5 ]<\/pre>\n\n\n\n<p>This method is similar to using filter() function but it is similar to understand and works well for small-medium arrays. For large arrays, use filter().<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"8_Using_Spread_Operator\"><\/span>8. Using Spread Operator<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>Another off-beat way to remove array items is to use the spread operator along with splice() function. Spread operator is used to merge two or more arrays and JS objects. Here is its syntax.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">new_array = (...arr1, ...arr2, ...arr3);<\/pre>\n\n\n\n<p>So we can use use splice() function to extract the sub arrays other the items to be removed and merge them back using the spread operator. Here is an example to remove item 3 from num array.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">var num = [1, 2, 3, 4, 5];<br><br>var sub1 = num.splice(0,2);<br>var sub2 = num.splice(1,2);<br><br>console.log(sub1);<br>console.log(sub2);<br><br>console.log([...sub1,...sub2]);<\/pre>\n\n\n\n<p>In the above example, we first call splice() function on array to extract starting 2 elements to create sub array sub1. This will modify the original array. We call splice() again on modified array to remove the last 2 items to create sub array sub2.<\/p>\n\n\n\n<p>Lastly, we use spread operator to merge both sub arrays sub1 and sub2. <\/p>\n\n\n\n<p>This example is mainly meant for demonstration of spread operator. Obviously, there are more efficient methods mentioned above.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Conclusion\"><\/span>Conclusion<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>In this article, we have learnt several simple ways to remove items from array in JavaScript. Each of them has specific use cases so you can pick any of them as per your requirement. Among them, splice() and filter() functions are super powerful that can help you extract items from between the array. splice() allows you to remove items using their index. filter() allows you to extract items using conditions.<\/p>\n\n\n\n<p>None of the above methods require any third-party library and work with plain JavaScript. They are fast and work well with large arrays also. If you use a JS library, then you may also try any of its methods to remove items from JavaScript.<\/p>\n\n\n\n<p>Also read:<\/p>\n\n\n\n<p><a href=\"https:\/\/ubiq.co\/tech-blog\/how-to-set-checked-for-checkbox-in-jquery\/\">How to Set Checked for Checkbox in jQuery<\/a><br><a href=\"https:\/\/ubiq.co\/tech-blog\/how-to-include-javascript-file-in-another-javascript-file\/\">How to Include JavaScript File in Another JavaScript File<\/a><br><a href=\"https:\/\/ubiq.co\/tech-blog\/how-to-clone-object-in-javascript\/\">How to Clone JavaScript Object<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Often web developers need to remove items from JavaScript array. Here is how to remove item from array in JavaScript.<\/p>\n","protected":false},"author":1,"featured_media":5267,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[295],"tags":[326],"class_list":["post-5239","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-javascript","tag-remove-item"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.2 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>How to Remove Item From Array In JavaScript - Ubiq BI<\/title>\n<meta name=\"description\" content=\"Often web developers need to remove items from JavaScript array. Here is how to remove item from array in JavaScript.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/ubiq.co\/tech-blog\/how-to-remove-item-from-array-in-javascript\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to Remove Item From Array In JavaScript - Ubiq BI\" \/>\n<meta property=\"og:description\" content=\"Often web developers need to remove items from JavaScript array. Here is how to remove item from array in JavaScript.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/ubiq.co\/tech-blog\/how-to-remove-item-from-array-in-javascript\/\" \/>\n<meta property=\"og:site_name\" content=\"Ubiq BI\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/ubiqbi\" \/>\n<meta property=\"article:published_time\" content=\"2024-10-24T09:28:51+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-10-24T09:59:37+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/ubiq.co\/tech-blog\/wp-content\/uploads\/2024\/10\/remove-item-from-javascript-array.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"300\" \/>\n\t<meta property=\"og:image:height\" content=\"200\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Sreeram Sreenivasan\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@UbiqBI\" \/>\n<meta name=\"twitter:site\" content=\"@UbiqBI\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Sreeram Sreenivasan\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"6 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/ubiq.co\/tech-blog\/how-to-remove-item-from-array-in-javascript\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/ubiq.co\/tech-blog\/how-to-remove-item-from-array-in-javascript\/\"},\"author\":{\"name\":\"Sreeram Sreenivasan\",\"@id\":\"https:\/\/ubiq.co\/tech-blog\/#\/schema\/person\/db98d49a766a3a111d8510935ab90abc\"},\"headline\":\"How to Remove Item From Array In JavaScript\",\"datePublished\":\"2024-10-24T09:28:51+00:00\",\"dateModified\":\"2024-10-24T09:59:37+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/ubiq.co\/tech-blog\/how-to-remove-item-from-array-in-javascript\/\"},\"wordCount\":1214,\"commentCount\":0,\"image\":{\"@id\":\"https:\/\/ubiq.co\/tech-blog\/how-to-remove-item-from-array-in-javascript\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/i0.wp.com\/ubiq.co\/tech-blog\/wp-content\/uploads\/2024\/10\/remove-item-from-javascript-array.jpg?fit=300%2C200&ssl=1\",\"keywords\":[\"remove item\"],\"articleSection\":[\"JavaScript\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/ubiq.co\/tech-blog\/how-to-remove-item-from-array-in-javascript\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/ubiq.co\/tech-blog\/how-to-remove-item-from-array-in-javascript\/\",\"url\":\"https:\/\/ubiq.co\/tech-blog\/how-to-remove-item-from-array-in-javascript\/\",\"name\":\"How to Remove Item From Array In JavaScript - Ubiq BI\",\"isPartOf\":{\"@id\":\"https:\/\/ubiq.co\/tech-blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/ubiq.co\/tech-blog\/how-to-remove-item-from-array-in-javascript\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/ubiq.co\/tech-blog\/how-to-remove-item-from-array-in-javascript\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/i0.wp.com\/ubiq.co\/tech-blog\/wp-content\/uploads\/2024\/10\/remove-item-from-javascript-array.jpg?fit=300%2C200&ssl=1\",\"datePublished\":\"2024-10-24T09:28:51+00:00\",\"dateModified\":\"2024-10-24T09:59:37+00:00\",\"author\":{\"@id\":\"https:\/\/ubiq.co\/tech-blog\/#\/schema\/person\/db98d49a766a3a111d8510935ab90abc\"},\"description\":\"Often web developers need to remove items from JavaScript array. Here is how to remove item from array in JavaScript.\",\"breadcrumb\":{\"@id\":\"https:\/\/ubiq.co\/tech-blog\/how-to-remove-item-from-array-in-javascript\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/ubiq.co\/tech-blog\/how-to-remove-item-from-array-in-javascript\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/ubiq.co\/tech-blog\/how-to-remove-item-from-array-in-javascript\/#primaryimage\",\"url\":\"https:\/\/i0.wp.com\/ubiq.co\/tech-blog\/wp-content\/uploads\/2024\/10\/remove-item-from-javascript-array.jpg?fit=300%2C200&ssl=1\",\"contentUrl\":\"https:\/\/i0.wp.com\/ubiq.co\/tech-blog\/wp-content\/uploads\/2024\/10\/remove-item-from-javascript-array.jpg?fit=300%2C200&ssl=1\",\"width\":300,\"height\":200,\"caption\":\"remove item from javascript array\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/ubiq.co\/tech-blog\/how-to-remove-item-from-array-in-javascript\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/ubiq.co\/tech-blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to Remove Item From Array In JavaScript\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/ubiq.co\/tech-blog\/#website\",\"url\":\"https:\/\/ubiq.co\/tech-blog\/\",\"name\":\"Ubiq BI\",\"description\":\"Build dashboards &amp; reports in minutes\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/ubiq.co\/tech-blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/ubiq.co\/tech-blog\/#\/schema\/person\/db98d49a766a3a111d8510935ab90abc\",\"name\":\"Sreeram Sreenivasan\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/secure.gravatar.com\/avatar\/4b3127ed2d4bb8efb3fa0bbb52cf2efd4d0156c97fc05a503537c883e8279947?s=96&d=mm&r=g\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/4b3127ed2d4bb8efb3fa0bbb52cf2efd4d0156c97fc05a503537c883e8279947?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/4b3127ed2d4bb8efb3fa0bbb52cf2efd4d0156c97fc05a503537c883e8279947?s=96&d=mm&r=g\",\"caption\":\"Sreeram Sreenivasan\"},\"description\":\"Sreeram Sreenivasan is the Founder of Ubiq. He has helped many Fortune 500 companies in the areas of BI &amp; software development.\",\"sameAs\":[\"https:\/\/www.linkedin.com\/in\/sreeram-sreenivasan\/\"],\"url\":\"https:\/\/ubiq.co\/tech-blog\/author\/wordpress\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How to Remove Item From Array In JavaScript - Ubiq BI","description":"Often web developers need to remove items from JavaScript array. Here is how to remove item from array in JavaScript.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/ubiq.co\/tech-blog\/how-to-remove-item-from-array-in-javascript\/","og_locale":"en_US","og_type":"article","og_title":"How to Remove Item From Array In JavaScript - Ubiq BI","og_description":"Often web developers need to remove items from JavaScript array. Here is how to remove item from array in JavaScript.","og_url":"https:\/\/ubiq.co\/tech-blog\/how-to-remove-item-from-array-in-javascript\/","og_site_name":"Ubiq BI","article_publisher":"https:\/\/www.facebook.com\/ubiqbi","article_published_time":"2024-10-24T09:28:51+00:00","article_modified_time":"2024-10-24T09:59:37+00:00","og_image":[{"width":300,"height":200,"url":"https:\/\/ubiq.co\/tech-blog\/wp-content\/uploads\/2024\/10\/remove-item-from-javascript-array.jpg","type":"image\/jpeg"}],"author":"Sreeram Sreenivasan","twitter_card":"summary_large_image","twitter_creator":"@UbiqBI","twitter_site":"@UbiqBI","twitter_misc":{"Written by":"Sreeram Sreenivasan","Est. reading time":"6 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/ubiq.co\/tech-blog\/how-to-remove-item-from-array-in-javascript\/#article","isPartOf":{"@id":"https:\/\/ubiq.co\/tech-blog\/how-to-remove-item-from-array-in-javascript\/"},"author":{"name":"Sreeram Sreenivasan","@id":"https:\/\/ubiq.co\/tech-blog\/#\/schema\/person\/db98d49a766a3a111d8510935ab90abc"},"headline":"How to Remove Item From Array In JavaScript","datePublished":"2024-10-24T09:28:51+00:00","dateModified":"2024-10-24T09:59:37+00:00","mainEntityOfPage":{"@id":"https:\/\/ubiq.co\/tech-blog\/how-to-remove-item-from-array-in-javascript\/"},"wordCount":1214,"commentCount":0,"image":{"@id":"https:\/\/ubiq.co\/tech-blog\/how-to-remove-item-from-array-in-javascript\/#primaryimage"},"thumbnailUrl":"https:\/\/i0.wp.com\/ubiq.co\/tech-blog\/wp-content\/uploads\/2024\/10\/remove-item-from-javascript-array.jpg?fit=300%2C200&ssl=1","keywords":["remove item"],"articleSection":["JavaScript"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/ubiq.co\/tech-blog\/how-to-remove-item-from-array-in-javascript\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/ubiq.co\/tech-blog\/how-to-remove-item-from-array-in-javascript\/","url":"https:\/\/ubiq.co\/tech-blog\/how-to-remove-item-from-array-in-javascript\/","name":"How to Remove Item From Array In JavaScript - Ubiq BI","isPartOf":{"@id":"https:\/\/ubiq.co\/tech-blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/ubiq.co\/tech-blog\/how-to-remove-item-from-array-in-javascript\/#primaryimage"},"image":{"@id":"https:\/\/ubiq.co\/tech-blog\/how-to-remove-item-from-array-in-javascript\/#primaryimage"},"thumbnailUrl":"https:\/\/i0.wp.com\/ubiq.co\/tech-blog\/wp-content\/uploads\/2024\/10\/remove-item-from-javascript-array.jpg?fit=300%2C200&ssl=1","datePublished":"2024-10-24T09:28:51+00:00","dateModified":"2024-10-24T09:59:37+00:00","author":{"@id":"https:\/\/ubiq.co\/tech-blog\/#\/schema\/person\/db98d49a766a3a111d8510935ab90abc"},"description":"Often web developers need to remove items from JavaScript array. Here is how to remove item from array in JavaScript.","breadcrumb":{"@id":"https:\/\/ubiq.co\/tech-blog\/how-to-remove-item-from-array-in-javascript\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/ubiq.co\/tech-blog\/how-to-remove-item-from-array-in-javascript\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/ubiq.co\/tech-blog\/how-to-remove-item-from-array-in-javascript\/#primaryimage","url":"https:\/\/i0.wp.com\/ubiq.co\/tech-blog\/wp-content\/uploads\/2024\/10\/remove-item-from-javascript-array.jpg?fit=300%2C200&ssl=1","contentUrl":"https:\/\/i0.wp.com\/ubiq.co\/tech-blog\/wp-content\/uploads\/2024\/10\/remove-item-from-javascript-array.jpg?fit=300%2C200&ssl=1","width":300,"height":200,"caption":"remove item from javascript array"},{"@type":"BreadcrumbList","@id":"https:\/\/ubiq.co\/tech-blog\/how-to-remove-item-from-array-in-javascript\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/ubiq.co\/tech-blog\/"},{"@type":"ListItem","position":2,"name":"How to Remove Item From Array In JavaScript"}]},{"@type":"WebSite","@id":"https:\/\/ubiq.co\/tech-blog\/#website","url":"https:\/\/ubiq.co\/tech-blog\/","name":"Ubiq BI","description":"Build dashboards &amp; reports in minutes","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/ubiq.co\/tech-blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/ubiq.co\/tech-blog\/#\/schema\/person\/db98d49a766a3a111d8510935ab90abc","name":"Sreeram Sreenivasan","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/4b3127ed2d4bb8efb3fa0bbb52cf2efd4d0156c97fc05a503537c883e8279947?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/4b3127ed2d4bb8efb3fa0bbb52cf2efd4d0156c97fc05a503537c883e8279947?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/4b3127ed2d4bb8efb3fa0bbb52cf2efd4d0156c97fc05a503537c883e8279947?s=96&d=mm&r=g","caption":"Sreeram Sreenivasan"},"description":"Sreeram Sreenivasan is the Founder of Ubiq. He has helped many Fortune 500 companies in the areas of BI &amp; software development.","sameAs":["https:\/\/www.linkedin.com\/in\/sreeram-sreenivasan\/"],"url":"https:\/\/ubiq.co\/tech-blog\/author\/wordpress\/"}]}},"jetpack_featured_media_url":"https:\/\/i0.wp.com\/ubiq.co\/tech-blog\/wp-content\/uploads\/2024\/10\/remove-item-from-javascript-array.jpg?fit=300%2C200&ssl=1","jetpack_shortlink":"https:\/\/wp.me\/pbGGTT-1mv","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/ubiq.co\/tech-blog\/wp-json\/wp\/v2\/posts\/5239","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ubiq.co\/tech-blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ubiq.co\/tech-blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ubiq.co\/tech-blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/ubiq.co\/tech-blog\/wp-json\/wp\/v2\/comments?post=5239"}],"version-history":[{"count":38,"href":"https:\/\/ubiq.co\/tech-blog\/wp-json\/wp\/v2\/posts\/5239\/revisions"}],"predecessor-version":[{"id":5283,"href":"https:\/\/ubiq.co\/tech-blog\/wp-json\/wp\/v2\/posts\/5239\/revisions\/5283"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/ubiq.co\/tech-blog\/wp-json\/wp\/v2\/media\/5267"}],"wp:attachment":[{"href":"https:\/\/ubiq.co\/tech-blog\/wp-json\/wp\/v2\/media?parent=5239"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ubiq.co\/tech-blog\/wp-json\/wp\/v2\/categories?post=5239"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ubiq.co\/tech-blog\/wp-json\/wp\/v2\/tags?post=5239"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}