{"id":1036,"date":"2022-07-21T08:32:11","date_gmt":"2022-07-21T08:32:11","guid":{"rendered":"https:\/\/gyanipandit.com\/programming\/?p=1036"},"modified":"2022-07-21T08:32:13","modified_gmt":"2022-07-21T08:32:13","slug":"javascript-array-length","status":"publish","type":"post","link":"https:\/\/gyanipandit.com\/programming\/javascript-array-length\/","title":{"rendered":"javascript array length"},"content":{"rendered":"<p style=\"text-align: center;\"><strong>Javascript Array Length<\/strong><\/p>\n<p>By length of the array, we just mean the number of elements in the array. So, for getting the length of the array, you can use the length property. Remember that the length of the array simply means the number of elements in the array.<\/p>\n<p>Let&#8217;s have a look at the below program, where we are trying to get the length of the array.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-1037 size-full\" src=\"https:\/\/gyanipandit.com\/programming\/wp-content\/uploads\/2022\/05\/Calculating-the-length-of-the-array.jpg\" alt=\"\" width=\"562\" height=\"84\" srcset=\"https:\/\/gyanipandit.com\/programming\/wp-content\/uploads\/2022\/05\/Calculating-the-length-of-the-array.jpg 562w, https:\/\/gyanipandit.com\/programming\/wp-content\/uploads\/2022\/05\/Calculating-the-length-of-the-array-300x45.jpg 300w\" sizes=\"auto, (max-width: 562px) 100vw, 562px\" \/>Lets now have a look at the output for the above program &#8211;<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-1038 size-full\" src=\"https:\/\/gyanipandit.com\/programming\/wp-content\/uploads\/2022\/05\/Calculating-the-length-of-the-array-1.jpg\" alt=\"\" width=\"678\" height=\"84\" srcset=\"https:\/\/gyanipandit.com\/programming\/wp-content\/uploads\/2022\/05\/Calculating-the-length-of-the-array-1.jpg 678w, https:\/\/gyanipandit.com\/programming\/wp-content\/uploads\/2022\/05\/Calculating-the-length-of-the-array-1-300x37.jpg 300w\" sizes=\"auto, (max-width: 678px) 100vw, 678px\" \/><\/p>\n<p>As you can see that there are 6 elements in the array, so the length of the array is 6. Notice how are we using the length property. We are writing the variable name, followed by the dot, and then we are writing length, and this is how we are getting the length of the array. We can make use of the length property, whenever we need the length of the array.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Javascript Array Length By length of the array, we just mean the number of elements in the array. So, for getting the length of the array, you can use the length property. Remember that the length of the array simply means the number of elements in the array. Let&#8217;s have a look at the below [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[7],"tags":[14,15],"class_list":{"0":"post-1036","1":"post","2":"type-post","3":"status-publish","4":"format-standard","6":"category-javascript-tutorial","7":"tag-javascript","8":"tag-javascript-tutorial"},"_links":{"self":[{"href":"https:\/\/gyanipandit.com\/programming\/wp-json\/wp\/v2\/posts\/1036","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/gyanipandit.com\/programming\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/gyanipandit.com\/programming\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/gyanipandit.com\/programming\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/gyanipandit.com\/programming\/wp-json\/wp\/v2\/comments?post=1036"}],"version-history":[{"count":4,"href":"https:\/\/gyanipandit.com\/programming\/wp-json\/wp\/v2\/posts\/1036\/revisions"}],"predecessor-version":[{"id":2426,"href":"https:\/\/gyanipandit.com\/programming\/wp-json\/wp\/v2\/posts\/1036\/revisions\/2426"}],"wp:attachment":[{"href":"https:\/\/gyanipandit.com\/programming\/wp-json\/wp\/v2\/media?parent=1036"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/gyanipandit.com\/programming\/wp-json\/wp\/v2\/categories?post=1036"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/gyanipandit.com\/programming\/wp-json\/wp\/v2\/tags?post=1036"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}