{"id":95658,"date":"2022-08-23T22:52:39","date_gmt":"2022-08-23T20:52:39","guid":{"rendered":"https:\/\/rmarketingdigital.com\/javascript\/bucles-utilizados-en-javascript\/"},"modified":"2020-12-05T23:36:56","modified_gmt":"2020-12-06T02:36:56","slug":"bucles-utilizados-en-javascript","status":"publish","type":"post","link":"https:\/\/rmarketingdigital.com\/en\/javascript\/bucles-utilizados-en-javascript\/","title":{"rendered":"Loops used in JavaScript"},"content":{"rendered":"<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_86 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\">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:\/\/rmarketingdigital.com\/en\/javascript\/bucles-utilizados-en-javascript\/#El-bucle-%C2%ABwhile%C2%BB\" >The &quot;while&quot; loop<\/a><ul class='ez-toc-list-level-3' ><li class='ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/rmarketingdigital.com\/en\/javascript\/bucles-utilizados-en-javascript\/#El-bucle-%C2%ABhacer-%E2%80%A6-mientras%C2%BB-o-Do%E2%80%A6-While\" >The &quot;do ... while&quot; or Do ... While loop<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/rmarketingdigital.com\/en\/javascript\/bucles-utilizados-en-javascript\/#El-bucle-For-o-%C2%ABpara%C2%BB\" >The For or &quot;for&quot; loop<\/a><ul class='ez-toc-list-level-4' ><li class='ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/rmarketingdigital.com\/en\/javascript\/bucles-utilizados-en-javascript\/#Declaracion-de-variable-en-linea\" >Online variable declaration<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/rmarketingdigital.com\/en\/javascript\/bucles-utilizados-en-javascript\/#Saltando-partes\" >Skipping parts<\/a><ul class='ez-toc-list-level-5' ><li class='ez-toc-heading-level-5'><a class=\"ez-toc-link ez-toc-heading-6\" href=\"https:\/\/rmarketingdigital.com\/en\/javascript\/bucles-utilizados-en-javascript\/#Rompiendo-el-bucle\" >Breaking the loop<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-5'><a class=\"ez-toc-link ez-toc-heading-7\" href=\"https:\/\/rmarketingdigital.com\/en\/javascript\/bucles-utilizados-en-javascript\/#Continuar-a-la-siguiente-iteracion\" >Continue to the next iteration.<\/a><\/li><\/ul><\/li><\/ul><\/li><\/ul><\/li><\/ul><\/nav><\/div>\n<div itemprop=\"articleBody\">\n<p>We often have the need to perform similar actions many times in a row. For example, when we need to output goods from a list one after <span id=\"more-37\"\/>other. Or just run the same code for each number from 1 to 10.<\/p>\n<p>Loops are a way of repeating the same part of code multiple times.<\/p>\n<h2><span class=\"ez-toc-section\" id=\"El-bucle-%C2%ABwhile%C2%BB\"><\/span>The &quot;while&quot; loop<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>The while loop has the following syntax:<\/p>\n<pre data-enlighter-language=\"php\" class=\"EnlighterJSRAW\">while (condition) {\/\/ code \/\/ the so-called &quot;loop body&quot;}\n<\/pre>\n<p>While the <strong>condition<\/strong> be <em>true<\/em> (true), the <strong>code<\/strong> runs from the <strong>loop body<\/strong>.<\/p>\n<p>For example, the loop below produces<strong> i<\/strong> while (while) <strong>i &lt;3<\/strong>:<\/p>\n<pre data-enlighter-language=\"php\" class=\"EnlighterJSRAW\">let i = 0; while (i &lt;3) {\/\/ returns 0, then 1, then 2 alert (i); i ++; }\n<\/pre>\n<p>A single execution of the body of the loop is called an iteration. The loop in the example above does three iterations.<\/p>\n<p>If there were not<strong> i ++<\/strong> In the example above, the loop would repeat itself (in theory) forever. In practice, the browser provides ways to stop such loops, and for the server-side JavaScript we can stop the process.<\/p>\n<p>Any expression or variable can be a loop condition, not just a comparison. They are evaluated and converted to a Boolean by while.<\/p>\n<p>For example, the shortest way to write <strong>while (i! = 0)<\/strong> could be <strong>while (i)<\/strong>:<\/p>\n<pre data-enlighter-language=\"php\" class=\"EnlighterJSRAW\">let i = 3; while (i) {\/\/ when i is 0, the condition is false, and the loop stops alert (i); i--; }\n<\/pre>\n<p>\nNo supports required for a single line body<br \/>\nIf the body of the loop has only one declaration, we can omit the brackets {\u2026}:<\/p>\n<pre data-enlighter-language=\"php\" class=\"EnlighterJSRAW\">let i = 3; while (i) alert (i--);\n<\/pre>\n<h3><span class=\"ez-toc-section\" id=\"El-bucle-%C2%ABhacer-%E2%80%A6-mientras%C2%BB-o-Do%E2%80%A6-While\"><\/span>The &quot;do ... while&quot; or Do ... While loop<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>The condition check can be moved under the body of the loop using the syntax <strong>do ... while<\/strong>:<\/p>\n<pre data-enlighter-language=\"php\" class=\"EnlighterJSRAW\">do {\/\/ Body of the loop} while (condition);\n<\/pre>\n<p>\nThe loop will execute the body first, then it will check the condition, and while it is true, it will execute it over and over again.<\/p>\n<p>For example:<\/p>\n<pre data-enlighter-language=\"php\" class=\"EnlighterJSRAW\">let i = 0; do {alert (i); i ++; } while (i &lt;3);\n<\/pre>\n<p>This form of syntax is rarely used, except when you want the body of the loop to run at least once, regardless of whether the condition is true. The other way is generally preferred: <strong>while (\u2026) {\u2026}<\/strong>.<\/p>\n<h3><span class=\"ez-toc-section\" id=\"El-bucle-For-o-%C2%ABpara%C2%BB\"><\/span>The For or &quot;for&quot; loop<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>The for loop is the most used.<\/p>\n<p>Does it look like this:<\/p>\n<pre data-enlighter-language=\"php\" class=\"EnlighterJSRAW\"> for (Start; Condition; Step) {\/\/ ... Body of the loop ...}\n<\/pre>\n<p>Let&#039;s learn the meaning of these parts by example. The loop below runs for alert (i) from 0 to i (but not including) 3:<\/p>\n<pre data-enlighter-language=\"php\" class=\"EnlighterJSRAW\">for (let i = 0; i &lt;3; i ++) {\/\/ return 0, then 1, then 2 alert (i); }\n<\/pre>\n<p>Let&#039;s examine the declaration for part by part:<\/p>\n<p><strong>Parts<\/strong><\/p>\n<ul>\n<li><strong>Start i = 0<\/strong> It runs once upon entering the loop.<\/li>\n<li><strong>Condition i &lt;3<\/strong> Checked before each loop iteration, if it fails the loop stops.<\/li>\n<li><strong>Step i ++<\/strong> It runs after the body in every iteration, but before the condition check.<\/li>\n<li><strong>Loop body<\/strong>, alert (i) Run over and over as long as the condition is true.<\/li>\n<\/ul>\n<p>The general loop algorithm works like this:<\/p>\n<p>Start of execution<br \/>\u2192 (if the condition \u2192 running body and running step)<br \/>\u2192 (if the condition \u2192 running body and running step)<br \/>\u2192 (if the condition \u2192 running body and running step)<br \/>\u2192 ...<\/p>\n<p>If you are not familiar with loops, it might help to go back to the example and reproduce how it is performed step by step on a piece of paper.<\/p>\n<p>This is exactly what happens in our case:<\/p>\n<pre data-enlighter-language=\"php\" class=\"EnlighterJSRAW\">\/\/ for (let i = 0; i &lt;3; i ++) alert (i) \/\/ start of execution let i = 0 \/\/ if the condition \u2192 run body and run step if (i &lt;3) {alert ( i); i ++} \/\/ if the condition \u2192 run body and run step if (i &lt;3) {alert (i); i ++} \/\/ if the condition \u2192 run body and run step if (i &lt;3) {alert (i); i ++} \/\/ ... ends, because now i == 3\n<\/pre>\n<h4><span class=\"ez-toc-section\" id=\"Declaracion-de-variable-en-linea\"><\/span>Online variable declaration<span class=\"ez-toc-section-end\"><\/span><\/h4>\n<p>Here the variable \u00abcounter\u00bb <strong>i<\/strong> it is declared right in the loop. That is called ad<em>declaration of variable \u00abonline\u00bb.<\/em> Such variables are visible only within the loop.<\/p>\n<pre data-enlighter-language=\"php\" class=\"EnlighterJSRAW\">for (let i = 0; i &lt;3; i ++) {alert (i); \/\/ 0, 1, 2} alert (i); \/\/ error, no such variable\n<\/pre>\n<p>Instead of defining a variable, we can use an existing one:<\/p>\n<pre data-enlighter-language=\"php\" class=\"EnlighterJSRAW\">let i = 0; for (i = 0; i &lt;3; i ++) {\/\/ use an existing variable alert (i); \/\/ 0, 1, 2} alert (i); \/\/ 3, visible, but declared outside the loop\n<\/pre>\n<h4><span class=\"ez-toc-section\" id=\"Saltando-partes\"><\/span>Skipping parts<span class=\"ez-toc-section-end\"><\/span><\/h4>\n<p>Any part of the for can be omitted.<\/p>\n<p>For example, we can omit <strong>beginning<\/strong> if we don&#039;t need to do anything at the beginning of the cycle.<\/p>\n<p>As here:<\/p>\n<pre data-enlighter-language=\"php\" class=\"EnlighterJSRAW\">let i = 0; \/\/ we have already declared and assigned for (; i &lt;3; i ++) {\/\/ no need to &quot;start&quot; alert (i); \/\/ 0, 1, 2}\n<\/pre>\n<p>We can also delete the step part:<\/p>\n<pre data-enlighter-language=\"php\" class=\"EnlighterJSRAW\">let i = 0; for (; i &lt;3;) {alert (i ++); }<\/pre>\n<p>The loop was made identical to <strong>while (i &lt;3)<\/strong>.<\/p>\n<p>We can remove everything, thus creating an infinite loop:<\/p>\n<pre data-enlighter-language=\"php\" class=\"EnlighterJSRAW\">for (;;) {\/\/ repeats infinite times}\n<\/pre>\n<p>Note that the colon; they must be present in the for, otherwise it would be a syntax error.<\/p>\n<h5><span class=\"ez-toc-section\" id=\"Rompiendo-el-bucle\"><\/span>Breaking the loop<span class=\"ez-toc-section-end\"><\/span><\/h5>\n<p>Normally the loop exits when the condition becomes false.<\/p>\n<p>But we can force the exit at any time.<\/p>\n<p><strong>There is a special break directive for that<\/strong>.<\/p>\n<p>For example, the following loop prompts the user for a series of numbers, but &quot;breaks&quot; when no number is entered:<\/p>\n<pre data-enlighter-language=\"php\" class=\"EnlighterJSRAW\">let sum = 0; while (true) {let value = + prompt (&quot;enter a number&quot;, &#039;&#039;); if (! value) break; \/\/ (*) sum + = value; } alert (&#039;Sum:&#039; + sum);\n<\/pre>\n<p>The break directive fires on the (*) line if the user enters an empty line or cancels the entry. Stops the loop immediately, passing control to the first line after the loop. Namely alert.<\/p>\n<p>The combination &quot;infinite loop + break as needed&quot; is ideal for situations where the condition needs to be checked not at the beginning \/ end of the loop, but in the middle, or even at various places on the body.<\/p>\n<h5><span class=\"ez-toc-section\" id=\"Continuar-a-la-siguiente-iteracion\"><\/span>Continue to the next iteration.<span class=\"ez-toc-section-end\"><\/span><\/h5>\n<p>Directive <strong>continue<\/strong> is a &quot;lighter version&quot; of <strong>break<\/strong>. It doesn&#039;t stop the entire loop. Instead, it stops the current iteration and forces the loop to start a new one (if the condition allows it).<\/p>\n<p>We can use it if we are done with the current iteration and would like to move on to the next one.<\/p>\n<p>The following loop is used continue to generate only odd values:<\/p>\n<pre data-enlighter-language=\"php\" class=\"EnlighterJSRAW\">for (let i = 0; i &lt;10; i ++) {\/\/ if true, skip the remaining part of the body if (i % 2 == 0) continue; alert (i); \/\/ 1, then 3, 5, 7, 9}\n<\/pre>\n<p>For even values of i the continue directive is used, the execution of the body is stopped, passing control to the next iteration of for (with the next number). So alert is only called for odd values.<\/p>\n<p>The continue directive helps decrease the level of nesting.<\/p>\n<p>A loop showing odd values might look like this:<\/p>\n<pre data-enlighter-language=\"php\" class=\"EnlighterJSRAW\">for (let i = 0; i &lt;10; i ++) {if (i % 2) {alert (i); }}\n<\/pre>\n<p>\nFrom a technical point of view, it is identical to the previous example. Surely, we can just wrap the code in the if block instead of <strong>continue<\/strong>.<\/p><\/div>","protected":false},"excerpt":{"rendered":"<p>A menudo tenemos la necesidad de realizar acciones similares muchas veces seguidas. Por ejemplo, cuando necesitamos dar salida a bienes de una lista uno tras otro. O simplemente ejecute el&#8230;<\/p>","protected":false},"author":1,"featured_media":95659,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1374],"tags":[],"class_list":["post-95658","post","type-post","status-publish","format-standard","has-post-thumbnail","category-javascript"],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v27.0 (Yoast SEO v28.2) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>Bucles utilizados en JavaScript - R Marketing Digital<\/title>\n<meta name=\"description\" content=\"A menudo tenemos la necesidad de realizar acciones similares muchas veces seguidas. Por ejemplo, cuando necesitamos dar salida a bienes de una lista uno\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/rmarketingdigital.com\/en\/javascript\/bucles-utilizados-en-javascript\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Bucles utilizados en JavaScript\" \/>\n<meta property=\"og:description\" content=\"A menudo tenemos la necesidad de realizar acciones similares muchas veces seguidas. Por ejemplo, cuando necesitamos dar salida a bienes de una lista uno\" \/>\n<meta property=\"og:url\" content=\"https:\/\/rmarketingdigital.com\/en\/javascript\/bucles-utilizados-en-javascript\/\" \/>\n<meta property=\"og:site_name\" content=\"R Marketing Digital\" \/>\n<meta property=\"article:published_time\" content=\"2022-08-23T20:52:39+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/rmarketingdigital.com\/wp-content\/uploads\/2020\/12\/Diseno-sin-titulo-9-1968437.png\" \/>\n\t<meta property=\"og:image:width\" content=\"810\" \/>\n\t<meta property=\"og:image:height\" content=\"450\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"R Marketing Digital\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/rmarketingdigital.com\\\/javascript\\\/bucles-utilizados-en-javascript\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/rmarketingdigital.com\\\/javascript\\\/bucles-utilizados-en-javascript\\\/\"},\"author\":{\"name\":\"R Marketing Digital\",\"@id\":\"https:\\\/\\\/rmarketingdigital.com\\\/#\\\/schema\\\/person\\\/7c0d9782b2977b840b3740f00c69a73e\"},\"headline\":\"Bucles utilizados en JavaScript\",\"datePublished\":\"2022-08-23T20:52:39+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/rmarketingdigital.com\\\/javascript\\\/bucles-utilizados-en-javascript\\\/\"},\"wordCount\":933,\"image\":{\"@id\":\"https:\\\/\\\/rmarketingdigital.com\\\/javascript\\\/bucles-utilizados-en-javascript\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/rmarketingdigital.com\\\/wp-content\\\/uploads\\\/2020\\\/12\\\/Diseno-sin-titulo-9-1968437.png\",\"articleSection\":[\"Javascript\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/rmarketingdigital.com\\\/javascript\\\/bucles-utilizados-en-javascript\\\/\",\"url\":\"https:\\\/\\\/rmarketingdigital.com\\\/javascript\\\/bucles-utilizados-en-javascript\\\/\",\"name\":\"Bucles utilizados en JavaScript - R Marketing Digital\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/rmarketingdigital.com\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/rmarketingdigital.com\\\/javascript\\\/bucles-utilizados-en-javascript\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/rmarketingdigital.com\\\/javascript\\\/bucles-utilizados-en-javascript\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/rmarketingdigital.com\\\/wp-content\\\/uploads\\\/2020\\\/12\\\/Diseno-sin-titulo-9-1968437.png\",\"datePublished\":\"2022-08-23T20:52:39+00:00\",\"author\":{\"@id\":\"https:\\\/\\\/rmarketingdigital.com\\\/#\\\/schema\\\/person\\\/7c0d9782b2977b840b3740f00c69a73e\"},\"description\":\"A menudo tenemos la necesidad de realizar acciones similares muchas veces seguidas. Por ejemplo, cuando necesitamos dar salida a bienes de una lista uno\",\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/rmarketingdigital.com\\\/javascript\\\/bucles-utilizados-en-javascript\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/rmarketingdigital.com\\\/javascript\\\/bucles-utilizados-en-javascript\\\/#primaryimage\",\"url\":\"https:\\\/\\\/rmarketingdigital.com\\\/wp-content\\\/uploads\\\/2020\\\/12\\\/Diseno-sin-titulo-9-1968437.png\",\"contentUrl\":\"https:\\\/\\\/rmarketingdigital.com\\\/wp-content\\\/uploads\\\/2020\\\/12\\\/Diseno-sin-titulo-9-1968437.png\",\"width\":810,\"height\":450,\"caption\":\"diseno-sin-titulo-9-1968437-6229579-png\"},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/rmarketingdigital.com\\\/#website\",\"url\":\"https:\\\/\\\/rmarketingdigital.com\\\/\",\"name\":\"R Marketing Digital\",\"description\":\"Agencia SEO | Publicidad redes sociales | Community Management\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/rmarketingdigital.com\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/rmarketingdigital.com\\\/#\\\/schema\\\/person\\\/7c0d9782b2977b840b3740f00c69a73e\",\"name\":\"R Marketing Digital\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/c5599c203e0120b8ccbff4666af86f35f9b3dcad468a8bc6295313a3964a80be?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/c5599c203e0120b8ccbff4666af86f35f9b3dcad468a8bc6295313a3964a80be?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/c5599c203e0120b8ccbff4666af86f35f9b3dcad468a8bc6295313a3964a80be?s=96&d=mm&r=g\",\"caption\":\"R Marketing Digital\"}}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Bucles utilizados en JavaScript - R Marketing Digital","description":"We often have the need to perform similar actions many times in a row. For example, when we need to output goods from a list one","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:\/\/rmarketingdigital.com\/en\/javascript\/bucles-utilizados-en-javascript\/","og_locale":"en_US","og_type":"article","og_title":"Bucles utilizados en JavaScript","og_description":"A menudo tenemos la necesidad de realizar acciones similares muchas veces seguidas. Por ejemplo, cuando necesitamos dar salida a bienes de una lista uno","og_url":"https:\/\/rmarketingdigital.com\/en\/javascript\/bucles-utilizados-en-javascript\/","og_site_name":"R Marketing Digital","article_published_time":"2022-08-23T20:52:39+00:00","og_image":[{"width":810,"height":450,"url":"https:\/\/rmarketingdigital.com\/wp-content\/uploads\/2020\/12\/Diseno-sin-titulo-9-1968437.png","type":"image\/png"}],"author":"R Marketing Digital","twitter_card":"summary_large_image","schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/rmarketingdigital.com\/javascript\/bucles-utilizados-en-javascript\/#article","isPartOf":{"@id":"https:\/\/rmarketingdigital.com\/javascript\/bucles-utilizados-en-javascript\/"},"author":{"name":"R Marketing Digital","@id":"https:\/\/rmarketingdigital.com\/#\/schema\/person\/7c0d9782b2977b840b3740f00c69a73e"},"headline":"Bucles utilizados en JavaScript","datePublished":"2022-08-23T20:52:39+00:00","mainEntityOfPage":{"@id":"https:\/\/rmarketingdigital.com\/javascript\/bucles-utilizados-en-javascript\/"},"wordCount":933,"image":{"@id":"https:\/\/rmarketingdigital.com\/javascript\/bucles-utilizados-en-javascript\/#primaryimage"},"thumbnailUrl":"https:\/\/rmarketingdigital.com\/wp-content\/uploads\/2020\/12\/Diseno-sin-titulo-9-1968437.png","articleSection":["Javascript"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/rmarketingdigital.com\/javascript\/bucles-utilizados-en-javascript\/","url":"https:\/\/rmarketingdigital.com\/javascript\/bucles-utilizados-en-javascript\/","name":"Bucles utilizados en JavaScript - R Marketing Digital","isPartOf":{"@id":"https:\/\/rmarketingdigital.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/rmarketingdigital.com\/javascript\/bucles-utilizados-en-javascript\/#primaryimage"},"image":{"@id":"https:\/\/rmarketingdigital.com\/javascript\/bucles-utilizados-en-javascript\/#primaryimage"},"thumbnailUrl":"https:\/\/rmarketingdigital.com\/wp-content\/uploads\/2020\/12\/Diseno-sin-titulo-9-1968437.png","datePublished":"2022-08-23T20:52:39+00:00","author":{"@id":"https:\/\/rmarketingdigital.com\/#\/schema\/person\/7c0d9782b2977b840b3740f00c69a73e"},"description":"We often have the need to perform similar actions many times in a row. For example, when we need to output goods from a list one","inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/rmarketingdigital.com\/javascript\/bucles-utilizados-en-javascript\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/rmarketingdigital.com\/javascript\/bucles-utilizados-en-javascript\/#primaryimage","url":"https:\/\/rmarketingdigital.com\/wp-content\/uploads\/2020\/12\/Diseno-sin-titulo-9-1968437.png","contentUrl":"https:\/\/rmarketingdigital.com\/wp-content\/uploads\/2020\/12\/Diseno-sin-titulo-9-1968437.png","width":810,"height":450,"caption":"diseno-sin-titulo-9-1968437-6229579-png"},{"@type":"WebSite","@id":"https:\/\/rmarketingdigital.com\/#website","url":"https:\/\/rmarketingdigital.com\/","name":"R Digital Marketing","description":"SEO Agency | Advertising social networks | Community Management","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/rmarketingdigital.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/rmarketingdigital.com\/#\/schema\/person\/7c0d9782b2977b840b3740f00c69a73e","name":"R Digital Marketing","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/c5599c203e0120b8ccbff4666af86f35f9b3dcad468a8bc6295313a3964a80be?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/c5599c203e0120b8ccbff4666af86f35f9b3dcad468a8bc6295313a3964a80be?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/c5599c203e0120b8ccbff4666af86f35f9b3dcad468a8bc6295313a3964a80be?s=96&d=mm&r=g","caption":"R Marketing Digital"}}]}},"_links":{"self":[{"href":"https:\/\/rmarketingdigital.com\/en\/wp-json\/wp\/v2\/posts\/95658","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/rmarketingdigital.com\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/rmarketingdigital.com\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/rmarketingdigital.com\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/rmarketingdigital.com\/en\/wp-json\/wp\/v2\/comments?post=95658"}],"version-history":[{"count":0,"href":"https:\/\/rmarketingdigital.com\/en\/wp-json\/wp\/v2\/posts\/95658\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/rmarketingdigital.com\/en\/wp-json\/wp\/v2\/media\/95659"}],"wp:attachment":[{"href":"https:\/\/rmarketingdigital.com\/en\/wp-json\/wp\/v2\/media?parent=95658"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/rmarketingdigital.com\/en\/wp-json\/wp\/v2\/categories?post=95658"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/rmarketingdigital.com\/en\/wp-json\/wp\/v2\/tags?post=95658"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}