<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>girgetto.it</title>
    <link>https://girgetto.it/newsletter/</link>
    <atom:link href="https://girgetto.it/rss.xml" rel="self" type="application/rss+xml" />
    <description>Guías prácticas de JavaScript, Git y desarrollo web.</description>
    <language>es</language>
    <lastBuildDate>Thu, 19 Nov 2026 17:19:57 GMT</lastBuildDate>
    <item>
      <title>Asincronía en JavaScript: Callbacks, Promesas y Async/Await</title>
      <link>https://girgetto.it/asincronia-javascript/</link>
      <guid isPermaLink="true">https://girgetto.it/asincronia-javascript/</guid>
      <pubDate>Sat, 21 Mar 2026 00:00:00 GMT</pubDate>
      <description>Entiende cómo funciona la asincronía en JavaScript desde cero: el Event Loop, callbacks, promesas, async/await y los patrones más comunes para manejar operaciones asíncronas.</description>
      <dc:language>es</dc:language>
      <category>javascript</category>
      <content:encoded><![CDATA[<p>JavaScript es un lenguaje <strong>single-threaded</strong> — solo puede ejecutar una cosa a la vez. Sin embargo, gestiona miles de operaciones concurrentes sin bloquearse: peticiones HTTP, lecturas de archivos, temporizadores... ¿Cómo es posible? La respuesta está en su modelo asíncrono. En este artículo vamos a desgranarlo desde los fundamentos hasta los patrones más modernos.</p>
<hr>
<h2 id="el-event-loop" style="position:relative;"><a href="#el-event-loop" aria-label="el event loop permalink" class="anchor before"><svg aria-hidden="true" focusable="false" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>El Event Loop</h2>
<p>El Event Loop es el corazón de la asincronía en JavaScript. Es el mecanismo que permite ejecutar código no bloqueante en un solo hilo.</p>
<div class="mermaid">
flowchart TD
    CS["📚 Call Stack\n(Pila de ejecución)\nEjecuta funciones una a una"]
    WA["⏳ Web APIs\n(setTimeout, fetch, DOM events)\nOperaciones delegadas al navegador"]
    TQ["📋 Task Queue\n(Cola de tareas)\nCallbacks esperando turno"]
    MQ["⚡ Microtask Queue\n(Cola de microtareas)\nPromesas, queueMicrotask"]
    EL["🔄 Event Loop\n¿Está el Call Stack vacío?"]

    CS -->|"Operación async"| WA
    WA -->|"Callback listo"| TQ
    WA -->|"Promesa resuelta"| MQ
    EL -->|"Sí → procesa microtasks primero"| MQ
    MQ -->|"Cola vacía → procesa tasks"| TQ
    TQ -->|"Mueve callback al"| CS

    style CS fill:#fef3c7,stroke:#f59e0b,color:#92400e
    style WA fill:#dbeafe,stroke:#3b82f6,color:#1e40af
    style TQ fill:#dcfce7,stroke:#22c55e,color:#166534
    style MQ fill:#f3e8ff,stroke:#a855f7,color:#6b21a8
    style EL fill:#fce7f3,stroke:#ec4899,color:#9d174d
</div>
<h3 id="cómo-funciona" style="position:relative;"><a href="#c%C3%B3mo-funciona" aria-label="cómo funciona permalink" class="anchor before"><svg aria-hidden="true" focusable="false" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>¿Cómo funciona?</h3>
<ol>
<li>JavaScript ejecuta código en el <strong>Call Stack</strong> (pila de ejecución), una función a la vez</li>
<li>Cuando encuentra una operación asíncrona (<code>setTimeout</code>, <code>fetch</code>, etc.), la delega a las <strong>Web APIs</strong> del navegador</li>
<li>Cuando la operación termina, su callback se coloca en una cola de espera</li>
<li>El <strong>Event Loop</strong> comprueba constantemente: si el Call Stack está vacío, mueve tareas de las colas al stack</li>
<li>Las <strong>microtareas</strong> (promesas) tienen prioridad sobre las <strong>macrotareas</strong> (setTimeout, eventos)</li>
</ol>
<h3 id="ejemplo-paso-a-paso" style="position:relative;"><a href="#ejemplo-paso-a-paso" aria-label="ejemplo paso a paso permalink" class="anchor before"><svg aria-hidden="true" focusable="false" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Ejemplo paso a paso</h3>
<div class="gatsby-highlight" data-language="javascript"><pre class="language-javascript"><code class="language-javascript">console<span class="token punctuation">.</span><span class="token function">log</span><span class="token punctuation">(</span><span class="token string">"1 - Inicio"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>

<span class="token function">setTimeout</span><span class="token punctuation">(</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token operator">=></span> <span class="token punctuation">{</span>
  console<span class="token punctuation">.</span><span class="token function">log</span><span class="token punctuation">(</span><span class="token string">"2 - Timeout"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token punctuation">}</span><span class="token punctuation">,</span> <span class="token number">0</span><span class="token punctuation">)</span><span class="token punctuation">;</span>

Promise<span class="token punctuation">.</span><span class="token function">resolve</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">.</span><span class="token function">then</span><span class="token punctuation">(</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token operator">=></span> <span class="token punctuation">{</span>
  console<span class="token punctuation">.</span><span class="token function">log</span><span class="token punctuation">(</span><span class="token string">"3 - Promesa"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">;</span>

console<span class="token punctuation">.</span><span class="token function">log</span><span class="token punctuation">(</span><span class="token string">"4 - Fin"</span><span class="token punctuation">)</span><span class="token punctuation">;</span></code></pre></div>
<p><strong>Salida:</strong></p>
<div class="gatsby-highlight" data-language="text"><pre class="language-text"><code class="language-text">1 - Inicio
4 - Fin
3 - Promesa
2 - Timeout</code></pre></div>
<p>¿Por qué este orden? Porque:</p>
<ul>
<li><code>"1 - Inicio"</code> y <code>"4 - Fin"</code> son síncronos → se ejecutan primero</li>
<li>La promesa va a la <strong>microtask queue</strong> → tiene prioridad</li>
<li>El <code>setTimeout</code> va a la <strong>task queue</strong> → se ejecuta después de las microtareas</li>
</ul>
<hr>
<h2 id="callbacks--el-origen" style="position:relative;"><a href="#callbacks--el-origen" aria-label="callbacks  el origen permalink" class="anchor before"><svg aria-hidden="true" focusable="false" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Callbacks — El origen</h2>
<p>Los callbacks fueron la primera forma de manejar asincronía en JavaScript. Un callback es simplemente una función que se pasa como argumento y se ejecuta cuando la operación termina.</p>
<div class="gatsby-highlight" data-language="javascript"><pre class="language-javascript"><code class="language-javascript"><span class="token comment">// Ejemplo básico: leer un archivo en Node.js</span>
<span class="token keyword">const</span> fs <span class="token operator">=</span> <span class="token function">require</span><span class="token punctuation">(</span><span class="token string">"fs"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>

fs<span class="token punctuation">.</span><span class="token function">readFile</span><span class="token punctuation">(</span><span class="token string">"datos.txt"</span><span class="token punctuation">,</span> <span class="token string">"utf8"</span><span class="token punctuation">,</span> <span class="token punctuation">(</span><span class="token parameter">error<span class="token punctuation">,</span> contenido</span><span class="token punctuation">)</span> <span class="token operator">=></span> <span class="token punctuation">{</span>
  <span class="token keyword">if</span> <span class="token punctuation">(</span>error<span class="token punctuation">)</span> <span class="token punctuation">{</span>
    console<span class="token punctuation">.</span><span class="token function">error</span><span class="token punctuation">(</span><span class="token string">"Error leyendo archivo:"</span><span class="token punctuation">,</span> error<span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token keyword">return</span><span class="token punctuation">;</span>
  <span class="token punctuation">}</span>
  console<span class="token punctuation">.</span><span class="token function">log</span><span class="token punctuation">(</span>contenido<span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">;</span>

console<span class="token punctuation">.</span><span class="token function">log</span><span class="token punctuation">(</span><span class="token string">"Esto se ejecuta ANTES de leer el archivo"</span><span class="token punctuation">)</span><span class="token punctuation">;</span></code></pre></div>
<h3 id="callback-hell" style="position:relative;"><a href="#callback-hell" aria-label="callback hell permalink" class="anchor before"><svg aria-hidden="true" focusable="false" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Callback Hell</h3>
<p>El problema de los callbacks es que, cuando encadenas operaciones asíncronas, el código crece horizontalmente y se vuelve ilegible:</p>
<div class="gatsby-highlight" data-language="javascript"><pre class="language-javascript"><code class="language-javascript"><span class="token comment">// ❌ Callback Hell — la pirámide del terror</span>
<span class="token function">obtenerUsuario</span><span class="token punctuation">(</span>id<span class="token punctuation">,</span> <span class="token punctuation">(</span><span class="token parameter">error<span class="token punctuation">,</span> usuario</span><span class="token punctuation">)</span> <span class="token operator">=></span> <span class="token punctuation">{</span>
  <span class="token keyword">if</span> <span class="token punctuation">(</span>error<span class="token punctuation">)</span> <span class="token keyword">return</span> <span class="token function">manejarError</span><span class="token punctuation">(</span>error<span class="token punctuation">)</span><span class="token punctuation">;</span>
  <span class="token function">obtenerPedidos</span><span class="token punctuation">(</span>usuario<span class="token punctuation">.</span>id<span class="token punctuation">,</span> <span class="token punctuation">(</span><span class="token parameter">error<span class="token punctuation">,</span> pedidos</span><span class="token punctuation">)</span> <span class="token operator">=></span> <span class="token punctuation">{</span>
    <span class="token keyword">if</span> <span class="token punctuation">(</span>error<span class="token punctuation">)</span> <span class="token keyword">return</span> <span class="token function">manejarError</span><span class="token punctuation">(</span>error<span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token function">obtenerDetalles</span><span class="token punctuation">(</span>pedidos<span class="token punctuation">[</span><span class="token number">0</span><span class="token punctuation">]</span><span class="token punctuation">.</span>id<span class="token punctuation">,</span> <span class="token punctuation">(</span><span class="token parameter">error<span class="token punctuation">,</span> detalles</span><span class="token punctuation">)</span> <span class="token operator">=></span> <span class="token punctuation">{</span>
      <span class="token keyword">if</span> <span class="token punctuation">(</span>error<span class="token punctuation">)</span> <span class="token keyword">return</span> <span class="token function">manejarError</span><span class="token punctuation">(</span>error<span class="token punctuation">)</span><span class="token punctuation">;</span>
      <span class="token function">obtenerEnvio</span><span class="token punctuation">(</span>detalles<span class="token punctuation">.</span>envioId<span class="token punctuation">,</span> <span class="token punctuation">(</span><span class="token parameter">error<span class="token punctuation">,</span> envio</span><span class="token punctuation">)</span> <span class="token operator">=></span> <span class="token punctuation">{</span>
        <span class="token keyword">if</span> <span class="token punctuation">(</span>error<span class="token punctuation">)</span> <span class="token keyword">return</span> <span class="token function">manejarError</span><span class="token punctuation">(</span>error<span class="token punctuation">)</span><span class="token punctuation">;</span>
        console<span class="token punctuation">.</span><span class="token function">log</span><span class="token punctuation">(</span><span class="token string">"Estado del envío:"</span><span class="token punctuation">,</span> envio<span class="token punctuation">.</span>estado<span class="token punctuation">)</span><span class="token punctuation">;</span>
      <span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
  <span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">;</span></code></pre></div>
<p>Cada operación depende de la anterior, así que se anida un nivel más. El resultado: código difícil de leer, mantener y depurar.</p>
<div class="mermaid">
flowchart TD
    A["obtenerUsuario()"] --> B["obtenerPedidos()"]
    B --> C["obtenerDetalles()"]
    C --> D["obtenerEnvio()"]
    D --> E["✅ Resultado final"]
    A -->|"❌ Error"| ERR["manejarError()"]
    B -->|"❌ Error"| ERR
    C -->|"❌ Error"| ERR
    D -->|"❌ Error"| ERR

    style A fill:#fef3c7,stroke:#f59e0b,color:#92400e
    style E fill:#dcfce7,stroke:#22c55e,color:#166534
    style ERR fill:#fee2e2,stroke:#ef4444,color:#991b1b
</div>
<p>Las promesas llegaron para solucionar exactamente este problema.</p>
<hr>
<h2 id="promesas" style="position:relative;"><a href="#promesas" aria-label="promesas permalink" class="anchor before"><svg aria-hidden="true" focusable="false" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Promesas</h2>
<p>Una promesa es un objeto que representa el resultado futuro de una operación asíncrona. Puede estar en uno de tres estados:</p>
<div class="mermaid">
stateDiagram-v2
    [*] --> Pending: Se crea la promesa
    Pending --> Fulfilled: resolve(valor)
    Pending --> Rejected: reject(error)
    Fulfilled --> [*]
    Rejected --> [*]
</div>
<ul>
<li><strong>Pending</strong> — En progreso, aún no tiene resultado</li>
<li><strong>Fulfilled</strong> — La operación se completó con éxito</li>
<li><strong>Rejected</strong> — La operación falló</li>
</ul>
<h3 id="crear-una-promesa" style="position:relative;"><a href="#crear-una-promesa" aria-label="crear una promesa permalink" class="anchor before"><svg aria-hidden="true" focusable="false" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Crear una promesa</h3>
<div class="gatsby-highlight" data-language="javascript"><pre class="language-javascript"><code class="language-javascript"><span class="token keyword">const</span> miPromesa <span class="token operator">=</span> <span class="token keyword">new</span> <span class="token class-name">Promise</span><span class="token punctuation">(</span><span class="token punctuation">(</span><span class="token parameter">resolve<span class="token punctuation">,</span> reject</span><span class="token punctuation">)</span> <span class="token operator">=></span> <span class="token punctuation">{</span>
  <span class="token keyword">const</span> exito <span class="token operator">=</span> <span class="token boolean">true</span><span class="token punctuation">;</span>

  <span class="token keyword">if</span> <span class="token punctuation">(</span>exito<span class="token punctuation">)</span> <span class="token punctuation">{</span>
    <span class="token function">resolve</span><span class="token punctuation">(</span><span class="token string">"Operación completada"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
  <span class="token punctuation">}</span> <span class="token keyword">else</span> <span class="token punctuation">{</span>
    <span class="token function">reject</span><span class="token punctuation">(</span><span class="token keyword">new</span> <span class="token class-name">Error</span><span class="token punctuation">(</span><span class="token string">"Algo salió mal"</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
  <span class="token punctuation">}</span>
<span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">;</span></code></pre></div>
<h3 id="consumir-promesas-con-then-y-catch" style="position:relative;"><a href="#consumir-promesas-con-then-y-catch" aria-label="consumir promesas con then y catch permalink" class="anchor before"><svg aria-hidden="true" focusable="false" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Consumir promesas con .then() y .catch()</h3>
<div class="gatsby-highlight" data-language="javascript"><pre class="language-javascript"><code class="language-javascript">miPromesa
  <span class="token punctuation">.</span><span class="token function">then</span><span class="token punctuation">(</span><span class="token parameter">resultado</span> <span class="token operator">=></span> <span class="token punctuation">{</span>
    console<span class="token punctuation">.</span><span class="token function">log</span><span class="token punctuation">(</span>resultado<span class="token punctuation">)</span><span class="token punctuation">;</span> <span class="token comment">// "Operación completada"</span>
  <span class="token punctuation">}</span><span class="token punctuation">)</span>
  <span class="token punctuation">.</span><span class="token function">catch</span><span class="token punctuation">(</span><span class="token parameter">error</span> <span class="token operator">=></span> <span class="token punctuation">{</span>
    console<span class="token punctuation">.</span><span class="token function">error</span><span class="token punctuation">(</span>error<span class="token punctuation">)</span><span class="token punctuation">;</span>
  <span class="token punctuation">}</span><span class="token punctuation">)</span>
  <span class="token punctuation">.</span><span class="token function">finally</span><span class="token punctuation">(</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token operator">=></span> <span class="token punctuation">{</span>
    console<span class="token punctuation">.</span><span class="token function">log</span><span class="token punctuation">(</span><span class="token string">"Siempre se ejecuta"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
  <span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">;</span></code></pre></div>
<h3 id="encadenar-promesas--adiós-al-callback-hell" style="position:relative;"><a href="#encadenar-promesas--adi%C3%B3s-al-callback-hell" aria-label="encadenar promesas  adiós al callback hell permalink" class="anchor before"><svg aria-hidden="true" focusable="false" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Encadenar promesas — Adiós al callback hell</h3>
<p>La magia de las promesas es que <code>.then()</code> devuelve una nueva promesa, permitiendo encadenarlas en vez de anidarlas:</p>
<div class="gatsby-highlight" data-language="javascript"><pre class="language-javascript"><code class="language-javascript"><span class="token comment">// ✅ Promesas encadenadas — plano y legible</span>
<span class="token function">obtenerUsuario</span><span class="token punctuation">(</span>id<span class="token punctuation">)</span>
  <span class="token punctuation">.</span><span class="token function">then</span><span class="token punctuation">(</span><span class="token parameter">usuario</span> <span class="token operator">=></span> <span class="token function">obtenerPedidos</span><span class="token punctuation">(</span>usuario<span class="token punctuation">.</span>id<span class="token punctuation">)</span><span class="token punctuation">)</span>
  <span class="token punctuation">.</span><span class="token function">then</span><span class="token punctuation">(</span><span class="token parameter">pedidos</span> <span class="token operator">=></span> <span class="token function">obtenerDetalles</span><span class="token punctuation">(</span>pedidos<span class="token punctuation">[</span><span class="token number">0</span><span class="token punctuation">]</span><span class="token punctuation">.</span>id<span class="token punctuation">)</span><span class="token punctuation">)</span>
  <span class="token punctuation">.</span><span class="token function">then</span><span class="token punctuation">(</span><span class="token parameter">detalles</span> <span class="token operator">=></span> <span class="token function">obtenerEnvio</span><span class="token punctuation">(</span>detalles<span class="token punctuation">.</span>envioId<span class="token punctuation">)</span><span class="token punctuation">)</span>
  <span class="token punctuation">.</span><span class="token function">then</span><span class="token punctuation">(</span><span class="token parameter">envio</span> <span class="token operator">=></span> <span class="token punctuation">{</span>
    console<span class="token punctuation">.</span><span class="token function">log</span><span class="token punctuation">(</span><span class="token string">"Estado del envío:"</span><span class="token punctuation">,</span> envio<span class="token punctuation">.</span>estado<span class="token punctuation">)</span><span class="token punctuation">;</span>
  <span class="token punctuation">}</span><span class="token punctuation">)</span>
  <span class="token punctuation">.</span><span class="token function">catch</span><span class="token punctuation">(</span><span class="token parameter">error</span> <span class="token operator">=></span> <span class="token punctuation">{</span>
    <span class="token comment">// Un solo catch maneja TODOS los errores de la cadena</span>
    console<span class="token punctuation">.</span><span class="token function">error</span><span class="token punctuation">(</span><span class="token string">"Error:"</span><span class="token punctuation">,</span> error<span class="token punctuation">)</span><span class="token punctuation">;</span>
  <span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">;</span></code></pre></div>
<p>Comparado con el callback hell, la mejora es enorme: el código es plano, secuencial y tiene un solo punto de manejo de errores.</p>
<h3 id="promesas-en-paralelo" style="position:relative;"><a href="#promesas-en-paralelo" aria-label="promesas en paralelo permalink" class="anchor before"><svg aria-hidden="true" focusable="false" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Promesas en paralelo</h3>
<div class="gatsby-highlight" data-language="javascript"><pre class="language-javascript"><code class="language-javascript"><span class="token comment">// Promise.all — espera a que TODAS se resuelvan (falla si una falla)</span>
<span class="token keyword">const</span> <span class="token punctuation">[</span>usuarios<span class="token punctuation">,</span> productos<span class="token punctuation">,</span> config<span class="token punctuation">]</span> <span class="token operator">=</span> <span class="token keyword">await</span> Promise<span class="token punctuation">.</span><span class="token function">all</span><span class="token punctuation">(</span><span class="token punctuation">[</span>
  <span class="token function">fetch</span><span class="token punctuation">(</span><span class="token string">"/api/usuarios"</span><span class="token punctuation">)</span><span class="token punctuation">.</span><span class="token function">then</span><span class="token punctuation">(</span><span class="token parameter">r</span> <span class="token operator">=></span> r<span class="token punctuation">.</span><span class="token function">json</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
  <span class="token function">fetch</span><span class="token punctuation">(</span><span class="token string">"/api/productos"</span><span class="token punctuation">)</span><span class="token punctuation">.</span><span class="token function">then</span><span class="token punctuation">(</span><span class="token parameter">r</span> <span class="token operator">=></span> r<span class="token punctuation">.</span><span class="token function">json</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
  <span class="token function">fetch</span><span class="token punctuation">(</span><span class="token string">"/api/config"</span><span class="token punctuation">)</span><span class="token punctuation">.</span><span class="token function">then</span><span class="token punctuation">(</span><span class="token parameter">r</span> <span class="token operator">=></span> r<span class="token punctuation">.</span><span class="token function">json</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">)</span>
<span class="token punctuation">]</span><span class="token punctuation">)</span><span class="token punctuation">;</span>

<span class="token comment">// Promise.allSettled — espera a TODAS, sin importar si fallan</span>
<span class="token keyword">const</span> resultados <span class="token operator">=</span> <span class="token keyword">await</span> Promise<span class="token punctuation">.</span><span class="token function">allSettled</span><span class="token punctuation">(</span><span class="token punctuation">[</span>
  <span class="token function">fetch</span><span class="token punctuation">(</span><span class="token string">"/api/servicio-a"</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
  <span class="token function">fetch</span><span class="token punctuation">(</span><span class="token string">"/api/servicio-b"</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
  <span class="token function">fetch</span><span class="token punctuation">(</span><span class="token string">"/api/servicio-c"</span><span class="token punctuation">)</span>
<span class="token punctuation">]</span><span class="token punctuation">)</span><span class="token punctuation">;</span>

resultados<span class="token punctuation">.</span><span class="token function">forEach</span><span class="token punctuation">(</span><span class="token parameter">r</span> <span class="token operator">=></span> <span class="token punctuation">{</span>
  <span class="token keyword">if</span> <span class="token punctuation">(</span>r<span class="token punctuation">.</span>status <span class="token operator">===</span> <span class="token string">"fulfilled"</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
    console<span class="token punctuation">.</span><span class="token function">log</span><span class="token punctuation">(</span><span class="token string">"Éxito:"</span><span class="token punctuation">,</span> r<span class="token punctuation">.</span>value<span class="token punctuation">)</span><span class="token punctuation">;</span>
  <span class="token punctuation">}</span> <span class="token keyword">else</span> <span class="token punctuation">{</span>
    console<span class="token punctuation">.</span><span class="token function">log</span><span class="token punctuation">(</span><span class="token string">"Error:"</span><span class="token punctuation">,</span> r<span class="token punctuation">.</span>reason<span class="token punctuation">)</span><span class="token punctuation">;</span>
  <span class="token punctuation">}</span>
<span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">;</span>

<span class="token comment">// Promise.race — devuelve la primera que se resuelva o rechace</span>
<span class="token keyword">const</span> masRapida <span class="token operator">=</span> <span class="token keyword">await</span> Promise<span class="token punctuation">.</span><span class="token function">race</span><span class="token punctuation">(</span><span class="token punctuation">[</span>
  <span class="token function">fetch</span><span class="token punctuation">(</span><span class="token string">"/api/servidor-1"</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
  <span class="token function">fetch</span><span class="token punctuation">(</span><span class="token string">"/api/servidor-2"</span><span class="token punctuation">)</span>
<span class="token punctuation">]</span><span class="token punctuation">)</span><span class="token punctuation">;</span>

<span class="token comment">// Promise.any — devuelve la primera que se RESUELVA (ignora rechazos)</span>
<span class="token keyword">const</span> primeraExitosa <span class="token operator">=</span> <span class="token keyword">await</span> Promise<span class="token punctuation">.</span><span class="token function">any</span><span class="token punctuation">(</span><span class="token punctuation">[</span>
  <span class="token function">fetch</span><span class="token punctuation">(</span><span class="token string">"/api/principal"</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
  <span class="token function">fetch</span><span class="token punctuation">(</span><span class="token string">"/api/respaldo"</span><span class="token punctuation">)</span>
<span class="token punctuation">]</span><span class="token punctuation">)</span><span class="token punctuation">;</span></code></pre></div>
<table>
<thead>
<tr>
<th>Método</th>
<th>Comportamiento</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>Promise.all</code></td>
<td>Espera todas. Falla si una falla</td>
</tr>
<tr>
<td><code>Promise.allSettled</code></td>
<td>Espera todas. Nunca falla</td>
</tr>
<tr>
<td><code>Promise.race</code></td>
<td>Devuelve la primera (éxito o error)</td>
</tr>
<tr>
<td><code>Promise.any</code></td>
<td>Devuelve la primera exitosa</td>
</tr>
</tbody>
</table>
<hr>
<h2 id="asyncawait" style="position:relative;"><a href="#asyncawait" aria-label="asyncawait permalink" class="anchor before"><svg aria-hidden="true" focusable="false" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Async/Await</h2>
<p>Async/await es azúcar sintáctico sobre las promesas. Hace que el código asíncrono se lea como si fuera síncrono, manteniendo toda la potencia de las promesas por debajo.</p>
<div class="gatsby-highlight" data-language="javascript"><pre class="language-javascript"><code class="language-javascript"><span class="token comment">// Con promesas</span>
<span class="token keyword">function</span> <span class="token function">cargarDatos</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
  <span class="token keyword">return</span> <span class="token function">fetch</span><span class="token punctuation">(</span><span class="token string">"/api/datos"</span><span class="token punctuation">)</span>
    <span class="token punctuation">.</span><span class="token function">then</span><span class="token punctuation">(</span><span class="token parameter">response</span> <span class="token operator">=></span> response<span class="token punctuation">.</span><span class="token function">json</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">)</span>
    <span class="token punctuation">.</span><span class="token function">then</span><span class="token punctuation">(</span><span class="token parameter">datos</span> <span class="token operator">=></span> <span class="token punctuation">{</span>
      console<span class="token punctuation">.</span><span class="token function">log</span><span class="token punctuation">(</span>datos<span class="token punctuation">)</span><span class="token punctuation">;</span>
      <span class="token keyword">return</span> datos<span class="token punctuation">;</span>
    <span class="token punctuation">}</span><span class="token punctuation">)</span>
    <span class="token punctuation">.</span><span class="token function">catch</span><span class="token punctuation">(</span><span class="token parameter">error</span> <span class="token operator">=></span> console<span class="token punctuation">.</span><span class="token function">error</span><span class="token punctuation">(</span>error<span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token punctuation">}</span>

<span class="token comment">// Con async/await — mismo resultado, más legible</span>
<span class="token keyword">async</span> <span class="token keyword">function</span> <span class="token function">cargarDatos</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
  <span class="token keyword">try</span> <span class="token punctuation">{</span>
    <span class="token keyword">const</span> response <span class="token operator">=</span> <span class="token keyword">await</span> <span class="token function">fetch</span><span class="token punctuation">(</span><span class="token string">"/api/datos"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token keyword">const</span> datos <span class="token operator">=</span> <span class="token keyword">await</span> response<span class="token punctuation">.</span><span class="token function">json</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
    console<span class="token punctuation">.</span><span class="token function">log</span><span class="token punctuation">(</span>datos<span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token keyword">return</span> datos<span class="token punctuation">;</span>
  <span class="token punctuation">}</span> <span class="token keyword">catch</span> <span class="token punctuation">(</span>error<span class="token punctuation">)</span> <span class="token punctuation">{</span>
    console<span class="token punctuation">.</span><span class="token function">error</span><span class="token punctuation">(</span>error<span class="token punctuation">)</span><span class="token punctuation">;</span>
  <span class="token punctuation">}</span>
<span class="token punctuation">}</span></code></pre></div>
<h3 id="reglas-de-asyncawait" style="position:relative;"><a href="#reglas-de-asyncawait" aria-label="reglas de asyncawait permalink" class="anchor before"><svg aria-hidden="true" focusable="false" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Reglas de async/await</h3>
<ol>
<li><code>async</code> antes de una función la convierte en una función que <strong>siempre devuelve una promesa</strong></li>
<li><code>await</code> solo se puede usar <strong>dentro</strong> de una función <code>async</code></li>
<li><code>await</code> pausa la ejecución de esa función hasta que la promesa se resuelva</li>
<li>Los errores se manejan con <code>try/catch</code> en vez de <code>.catch()</code></li>
</ol>
<h3 id="patrones-comunes" style="position:relative;"><a href="#patrones-comunes" aria-label="patrones comunes permalink" class="anchor before"><svg aria-hidden="true" focusable="false" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Patrones comunes</h3>
<h4 id="ejecución-secuencial-vs-paralela" style="position:relative;"><a href="#ejecuci%C3%B3n-secuencial-vs-paralela" aria-label="ejecución secuencial vs paralela permalink" class="anchor before"><svg aria-hidden="true" focusable="false" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Ejecución secuencial vs paralela</h4>
<div class="gatsby-highlight" data-language="javascript"><pre class="language-javascript"><code class="language-javascript"><span class="token comment">// ❌ Secuencial — cada petición espera a la anterior (lento)</span>
<span class="token keyword">async</span> <span class="token keyword">function</span> <span class="token function">secuencial</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
  <span class="token keyword">const</span> usuarios <span class="token operator">=</span> <span class="token keyword">await</span> <span class="token function">fetch</span><span class="token punctuation">(</span><span class="token string">"/api/usuarios"</span><span class="token punctuation">)</span><span class="token punctuation">.</span><span class="token function">then</span><span class="token punctuation">(</span><span class="token parameter">r</span> <span class="token operator">=></span> r<span class="token punctuation">.</span><span class="token function">json</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
  <span class="token keyword">const</span> productos <span class="token operator">=</span> <span class="token keyword">await</span> <span class="token function">fetch</span><span class="token punctuation">(</span><span class="token string">"/api/productos"</span><span class="token punctuation">)</span><span class="token punctuation">.</span><span class="token function">then</span><span class="token punctuation">(</span><span class="token parameter">r</span> <span class="token operator">=></span> r<span class="token punctuation">.</span><span class="token function">json</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
  <span class="token keyword">const</span> pedidos <span class="token operator">=</span> <span class="token keyword">await</span> <span class="token function">fetch</span><span class="token punctuation">(</span><span class="token string">"/api/pedidos"</span><span class="token punctuation">)</span><span class="token punctuation">.</span><span class="token function">then</span><span class="token punctuation">(</span><span class="token parameter">r</span> <span class="token operator">=></span> r<span class="token punctuation">.</span><span class="token function">json</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
  <span class="token comment">// Tiempo total: suma de las tres peticiones</span>
<span class="token punctuation">}</span>

<span class="token comment">// ✅ Paralelo — todas las peticiones se lanzan a la vez (rápido)</span>
<span class="token keyword">async</span> <span class="token keyword">function</span> <span class="token function">paralelo</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
  <span class="token keyword">const</span> <span class="token punctuation">[</span>usuarios<span class="token punctuation">,</span> productos<span class="token punctuation">,</span> pedidos<span class="token punctuation">]</span> <span class="token operator">=</span> <span class="token keyword">await</span> Promise<span class="token punctuation">.</span><span class="token function">all</span><span class="token punctuation">(</span><span class="token punctuation">[</span>
    <span class="token function">fetch</span><span class="token punctuation">(</span><span class="token string">"/api/usuarios"</span><span class="token punctuation">)</span><span class="token punctuation">.</span><span class="token function">then</span><span class="token punctuation">(</span><span class="token parameter">r</span> <span class="token operator">=></span> r<span class="token punctuation">.</span><span class="token function">json</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
    <span class="token function">fetch</span><span class="token punctuation">(</span><span class="token string">"/api/productos"</span><span class="token punctuation">)</span><span class="token punctuation">.</span><span class="token function">then</span><span class="token punctuation">(</span><span class="token parameter">r</span> <span class="token operator">=></span> r<span class="token punctuation">.</span><span class="token function">json</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
    <span class="token function">fetch</span><span class="token punctuation">(</span><span class="token string">"/api/pedidos"</span><span class="token punctuation">)</span><span class="token punctuation">.</span><span class="token function">then</span><span class="token punctuation">(</span><span class="token parameter">r</span> <span class="token operator">=></span> r<span class="token punctuation">.</span><span class="token function">json</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">)</span>
  <span class="token punctuation">]</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
  <span class="token comment">// Tiempo total: la petición más lenta</span>
<span class="token punctuation">}</span></code></pre></div>
<div class="mermaid">
sequenceDiagram
    participant A as App

    Note over A: ❌ Secuencial (3s total)
    A->>A: await usuarios (1s)
    A->>A: await productos (1s)
    A->>A: await pedidos (1s)

    Note over A: ✅ Paralelo (1s total)
    A->>A: Promise.all([usuarios, productos, pedidos])
    Note over A: Las tres peticiones se ejecutan a la vez
</div>
<h4 id="iterar-sobre-operaciones-asíncronas" style="position:relative;"><a href="#iterar-sobre-operaciones-as%C3%ADncronas" aria-label="iterar sobre operaciones asíncronas permalink" class="anchor before"><svg aria-hidden="true" focusable="false" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Iterar sobre operaciones asíncronas</h4>
<div class="gatsby-highlight" data-language="javascript"><pre class="language-javascript"><code class="language-javascript"><span class="token keyword">const</span> urls <span class="token operator">=</span> <span class="token punctuation">[</span><span class="token string">"/api/1"</span><span class="token punctuation">,</span> <span class="token string">"/api/2"</span><span class="token punctuation">,</span> <span class="token string">"/api/3"</span><span class="token punctuation">]</span><span class="token punctuation">;</span>

<span class="token comment">// Secuencial — una tras otra (cuando el orden importa)</span>
<span class="token keyword">for</span> <span class="token punctuation">(</span><span class="token keyword">const</span> url <span class="token keyword">of</span> urls<span class="token punctuation">)</span> <span class="token punctuation">{</span>
  <span class="token keyword">const</span> data <span class="token operator">=</span> <span class="token keyword">await</span> <span class="token function">fetch</span><span class="token punctuation">(</span>url<span class="token punctuation">)</span><span class="token punctuation">.</span><span class="token function">then</span><span class="token punctuation">(</span><span class="token parameter">r</span> <span class="token operator">=></span> r<span class="token punctuation">.</span><span class="token function">json</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
  console<span class="token punctuation">.</span><span class="token function">log</span><span class="token punctuation">(</span>data<span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token punctuation">}</span>

<span class="token comment">// Paralelo — todas a la vez (cuando el orden no importa)</span>
<span class="token keyword">const</span> resultados <span class="token operator">=</span> <span class="token keyword">await</span> Promise<span class="token punctuation">.</span><span class="token function">all</span><span class="token punctuation">(</span>
  urls<span class="token punctuation">.</span><span class="token function">map</span><span class="token punctuation">(</span><span class="token parameter">url</span> <span class="token operator">=></span> <span class="token function">fetch</span><span class="token punctuation">(</span>url<span class="token punctuation">)</span><span class="token punctuation">.</span><span class="token function">then</span><span class="token punctuation">(</span><span class="token parameter">r</span> <span class="token operator">=></span> r<span class="token punctuation">.</span><span class="token function">json</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">)</span>
<span class="token punctuation">)</span><span class="token punctuation">;</span></code></pre></div>
<h4 id="reintentos-con-asyncawait" style="position:relative;"><a href="#reintentos-con-asyncawait" aria-label="reintentos con asyncawait permalink" class="anchor before"><svg aria-hidden="true" focusable="false" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Reintentos con async/await</h4>
<div class="gatsby-highlight" data-language="javascript"><pre class="language-javascript"><code class="language-javascript"><span class="token keyword">async</span> <span class="token keyword">function</span> <span class="token function">fetchConReintentos</span><span class="token punctuation">(</span><span class="token parameter">url<span class="token punctuation">,</span> intentos <span class="token operator">=</span> <span class="token number">3</span></span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
  <span class="token keyword">for</span> <span class="token punctuation">(</span><span class="token keyword">let</span> i <span class="token operator">=</span> <span class="token number">0</span><span class="token punctuation">;</span> i <span class="token operator">&lt;</span> intentos<span class="token punctuation">;</span> i<span class="token operator">++</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
    <span class="token keyword">try</span> <span class="token punctuation">{</span>
      <span class="token keyword">const</span> response <span class="token operator">=</span> <span class="token keyword">await</span> <span class="token function">fetch</span><span class="token punctuation">(</span>url<span class="token punctuation">)</span><span class="token punctuation">;</span>
      <span class="token keyword">if</span> <span class="token punctuation">(</span><span class="token operator">!</span>response<span class="token punctuation">.</span>ok<span class="token punctuation">)</span> <span class="token keyword">throw</span> <span class="token keyword">new</span> <span class="token class-name">Error</span><span class="token punctuation">(</span><span class="token template-string"><span class="token template-punctuation string">`</span><span class="token string">HTTP </span><span class="token interpolation"><span class="token interpolation-punctuation punctuation">${</span>response<span class="token punctuation">.</span>status<span class="token interpolation-punctuation punctuation">}</span></span><span class="token template-punctuation string">`</span></span><span class="token punctuation">)</span><span class="token punctuation">;</span>
      <span class="token keyword">return</span> <span class="token keyword">await</span> response<span class="token punctuation">.</span><span class="token function">json</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token punctuation">}</span> <span class="token keyword">catch</span> <span class="token punctuation">(</span>error<span class="token punctuation">)</span> <span class="token punctuation">{</span>
      console<span class="token punctuation">.</span><span class="token function">warn</span><span class="token punctuation">(</span><span class="token template-string"><span class="token template-punctuation string">`</span><span class="token string">Intento </span><span class="token interpolation"><span class="token interpolation-punctuation punctuation">${</span>i <span class="token operator">+</span> <span class="token number">1</span><span class="token interpolation-punctuation punctuation">}</span></span><span class="token string"> fallido:</span><span class="token template-punctuation string">`</span></span><span class="token punctuation">,</span> error<span class="token punctuation">.</span>message<span class="token punctuation">)</span><span class="token punctuation">;</span>
      <span class="token keyword">if</span> <span class="token punctuation">(</span>i <span class="token operator">===</span> intentos <span class="token operator">-</span> <span class="token number">1</span><span class="token punctuation">)</span> <span class="token keyword">throw</span> error<span class="token punctuation">;</span>
      <span class="token keyword">await</span> <span class="token keyword">new</span> <span class="token class-name">Promise</span><span class="token punctuation">(</span><span class="token parameter">r</span> <span class="token operator">=></span> <span class="token function">setTimeout</span><span class="token punctuation">(</span>r<span class="token punctuation">,</span> <span class="token number">1000</span> <span class="token operator">*</span> <span class="token punctuation">(</span>i <span class="token operator">+</span> <span class="token number">1</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span> <span class="token comment">// backoff</span>
    <span class="token punctuation">}</span>
  <span class="token punctuation">}</span>
<span class="token punctuation">}</span></code></pre></div>
<h4 id="timeout-para-promesas" style="position:relative;"><a href="#timeout-para-promesas" aria-label="timeout para promesas permalink" class="anchor before"><svg aria-hidden="true" focusable="false" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Timeout para promesas</h4>
<div class="gatsby-highlight" data-language="javascript"><pre class="language-javascript"><code class="language-javascript"><span class="token keyword">function</span> <span class="token function">conTimeout</span><span class="token punctuation">(</span><span class="token parameter">promesa<span class="token punctuation">,</span> ms</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
  <span class="token keyword">const</span> timeout <span class="token operator">=</span> <span class="token keyword">new</span> <span class="token class-name">Promise</span><span class="token punctuation">(</span><span class="token punctuation">(</span><span class="token parameter">_<span class="token punctuation">,</span> reject</span><span class="token punctuation">)</span> <span class="token operator">=></span>
    <span class="token function">setTimeout</span><span class="token punctuation">(</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token operator">=></span> <span class="token function">reject</span><span class="token punctuation">(</span><span class="token keyword">new</span> <span class="token class-name">Error</span><span class="token punctuation">(</span><span class="token template-string"><span class="token template-punctuation string">`</span><span class="token string">Timeout después de </span><span class="token interpolation"><span class="token interpolation-punctuation punctuation">${</span>ms<span class="token interpolation-punctuation punctuation">}</span></span><span class="token string">ms</span><span class="token template-punctuation string">`</span></span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">,</span> ms<span class="token punctuation">)</span>
  <span class="token punctuation">)</span><span class="token punctuation">;</span>
  <span class="token keyword">return</span> Promise<span class="token punctuation">.</span><span class="token function">race</span><span class="token punctuation">(</span><span class="token punctuation">[</span>promesa<span class="token punctuation">,</span> timeout<span class="token punctuation">]</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token punctuation">}</span>

<span class="token comment">// Uso</span>
<span class="token keyword">try</span> <span class="token punctuation">{</span>
  <span class="token keyword">const</span> datos <span class="token operator">=</span> <span class="token keyword">await</span> <span class="token function">conTimeout</span><span class="token punctuation">(</span><span class="token function">fetch</span><span class="token punctuation">(</span><span class="token string">"/api/lenta"</span><span class="token punctuation">)</span><span class="token punctuation">,</span> <span class="token number">5000</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token punctuation">}</span> <span class="token keyword">catch</span> <span class="token punctuation">(</span>error<span class="token punctuation">)</span> <span class="token punctuation">{</span>
  console<span class="token punctuation">.</span><span class="token function">error</span><span class="token punctuation">(</span>error<span class="token punctuation">.</span>message<span class="token punctuation">)</span><span class="token punctuation">;</span> <span class="token comment">// "Timeout después de 5000ms"</span>
<span class="token punctuation">}</span></code></pre></div>
<hr>
<h2 id="errores-comunes" style="position:relative;"><a href="#errores-comunes" aria-label="errores comunes permalink" class="anchor before"><svg aria-hidden="true" focusable="false" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Errores comunes</h2>
<h3 id="1-olvidar-el-await" style="position:relative;"><a href="#1-olvidar-el-await" aria-label="1 olvidar el await permalink" class="anchor before"><svg aria-hidden="true" focusable="false" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>1. Olvidar el await</h3>
<div class="gatsby-highlight" data-language="javascript"><pre class="language-javascript"><code class="language-javascript"><span class="token comment">// ❌ Sin await — data es una Promesa, no los datos</span>
<span class="token keyword">async</span> <span class="token keyword">function</span> <span class="token function">obtener</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
  <span class="token keyword">const</span> data <span class="token operator">=</span> <span class="token function">fetch</span><span class="token punctuation">(</span><span class="token string">"/api/datos"</span><span class="token punctuation">)</span><span class="token punctuation">.</span><span class="token function">then</span><span class="token punctuation">(</span><span class="token parameter">r</span> <span class="token operator">=></span> r<span class="token punctuation">.</span><span class="token function">json</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
  console<span class="token punctuation">.</span><span class="token function">log</span><span class="token punctuation">(</span>data<span class="token punctuation">)</span><span class="token punctuation">;</span> <span class="token comment">// Promise {&lt;pending>}</span>
<span class="token punctuation">}</span>

<span class="token comment">// ✅ Con await — data son los datos reales</span>
<span class="token keyword">async</span> <span class="token keyword">function</span> <span class="token function">obtener</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
  <span class="token keyword">const</span> data <span class="token operator">=</span> <span class="token keyword">await</span> <span class="token function">fetch</span><span class="token punctuation">(</span><span class="token string">"/api/datos"</span><span class="token punctuation">)</span><span class="token punctuation">.</span><span class="token function">then</span><span class="token punctuation">(</span><span class="token parameter">r</span> <span class="token operator">=></span> r<span class="token punctuation">.</span><span class="token function">json</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
  console<span class="token punctuation">.</span><span class="token function">log</span><span class="token punctuation">(</span>data<span class="token punctuation">)</span><span class="token punctuation">;</span> <span class="token comment">// { ... }</span>
<span class="token punctuation">}</span></code></pre></div>
<h3 id="2-await-en-un-foreach-no-funciona" style="position:relative;"><a href="#2-await-en-un-foreach-no-funciona" aria-label="2 await en un foreach no funciona permalink" class="anchor before"><svg aria-hidden="true" focusable="false" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>2. await en un forEach (no funciona)</h3>
<div class="gatsby-highlight" data-language="javascript"><pre class="language-javascript"><code class="language-javascript"><span class="token keyword">const</span> ids <span class="token operator">=</span> <span class="token punctuation">[</span><span class="token number">1</span><span class="token punctuation">,</span> <span class="token number">2</span><span class="token punctuation">,</span> <span class="token number">3</span><span class="token punctuation">]</span><span class="token punctuation">;</span>

<span class="token comment">// ❌ forEach NO espera a los awaits</span>
ids<span class="token punctuation">.</span><span class="token function">forEach</span><span class="token punctuation">(</span><span class="token keyword">async</span> <span class="token punctuation">(</span><span class="token parameter">id</span><span class="token punctuation">)</span> <span class="token operator">=></span> <span class="token punctuation">{</span>
  <span class="token keyword">const</span> data <span class="token operator">=</span> <span class="token keyword">await</span> <span class="token function">fetch</span><span class="token punctuation">(</span><span class="token template-string"><span class="token template-punctuation string">`</span><span class="token string">/api/</span><span class="token interpolation"><span class="token interpolation-punctuation punctuation">${</span>id<span class="token interpolation-punctuation punctuation">}</span></span><span class="token template-punctuation string">`</span></span><span class="token punctuation">)</span><span class="token punctuation">;</span>
  console<span class="token punctuation">.</span><span class="token function">log</span><span class="token punctuation">(</span>data<span class="token punctuation">)</span><span class="token punctuation">;</span> <span class="token comment">// Se ejecuta en orden impredecible</span>
<span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">;</span>

<span class="token comment">// ✅ Usa for...of para ejecución secuencial</span>
<span class="token keyword">for</span> <span class="token punctuation">(</span><span class="token keyword">const</span> id <span class="token keyword">of</span> ids<span class="token punctuation">)</span> <span class="token punctuation">{</span>
  <span class="token keyword">const</span> data <span class="token operator">=</span> <span class="token keyword">await</span> <span class="token function">fetch</span><span class="token punctuation">(</span><span class="token template-string"><span class="token template-punctuation string">`</span><span class="token string">/api/</span><span class="token interpolation"><span class="token interpolation-punctuation punctuation">${</span>id<span class="token interpolation-punctuation punctuation">}</span></span><span class="token template-punctuation string">`</span></span><span class="token punctuation">)</span><span class="token punctuation">.</span><span class="token function">then</span><span class="token punctuation">(</span><span class="token parameter">r</span> <span class="token operator">=></span> r<span class="token punctuation">.</span><span class="token function">json</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
  console<span class="token punctuation">.</span><span class="token function">log</span><span class="token punctuation">(</span>data<span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token punctuation">}</span>

<span class="token comment">// ✅ O Promise.all para ejecución paralela</span>
<span class="token keyword">const</span> resultados <span class="token operator">=</span> <span class="token keyword">await</span> Promise<span class="token punctuation">.</span><span class="token function">all</span><span class="token punctuation">(</span>
  ids<span class="token punctuation">.</span><span class="token function">map</span><span class="token punctuation">(</span><span class="token parameter">id</span> <span class="token operator">=></span> <span class="token function">fetch</span><span class="token punctuation">(</span><span class="token template-string"><span class="token template-punctuation string">`</span><span class="token string">/api/</span><span class="token interpolation"><span class="token interpolation-punctuation punctuation">${</span>id<span class="token interpolation-punctuation punctuation">}</span></span><span class="token template-punctuation string">`</span></span><span class="token punctuation">)</span><span class="token punctuation">.</span><span class="token function">then</span><span class="token punctuation">(</span><span class="token parameter">r</span> <span class="token operator">=></span> r<span class="token punctuation">.</span><span class="token function">json</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">)</span>
<span class="token punctuation">)</span><span class="token punctuation">;</span></code></pre></div>
<h3 id="3-no-manejar-errores" style="position:relative;"><a href="#3-no-manejar-errores" aria-label="3 no manejar errores permalink" class="anchor before"><svg aria-hidden="true" focusable="false" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>3. No manejar errores</h3>
<div class="gatsby-highlight" data-language="javascript"><pre class="language-javascript"><code class="language-javascript"><span class="token comment">// ❌ Si la promesa se rechaza, el error se pierde silenciosamente</span>
<span class="token keyword">async</span> <span class="token keyword">function</span> <span class="token function">cargar</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
  <span class="token keyword">const</span> datos <span class="token operator">=</span> <span class="token keyword">await</span> <span class="token function">fetch</span><span class="token punctuation">(</span><span class="token string">"/api/datos"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token punctuation">}</span>

<span class="token comment">// ✅ Siempre maneja errores</span>
<span class="token keyword">async</span> <span class="token keyword">function</span> <span class="token function">cargar</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
  <span class="token keyword">try</span> <span class="token punctuation">{</span>
    <span class="token keyword">const</span> datos <span class="token operator">=</span> <span class="token keyword">await</span> <span class="token function">fetch</span><span class="token punctuation">(</span><span class="token string">"/api/datos"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
  <span class="token punctuation">}</span> <span class="token keyword">catch</span> <span class="token punctuation">(</span>error<span class="token punctuation">)</span> <span class="token punctuation">{</span>
    console<span class="token punctuation">.</span><span class="token function">error</span><span class="token punctuation">(</span><span class="token string">"Fallo al cargar:"</span><span class="token punctuation">,</span> error<span class="token punctuation">)</span><span class="token punctuation">;</span>
  <span class="token punctuation">}</span>
<span class="token punctuation">}</span></code></pre></div>
<hr>
<h2 id="evolución-de-la-asincronía-en-javascript" style="position:relative;"><a href="#evoluci%C3%B3n-de-la-asincron%C3%ADa-en-javascript" aria-label="evolución de la asincronía en javascript permalink" class="anchor before"><svg aria-hidden="true" focusable="false" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Evolución de la asincronía en JavaScript</h2>
<div class="mermaid">
flowchart LR
    A["1995\nCallbacks"] --> B["2012\nPromesas\n(librerías)"]
    B --> C["2015 — ES6\nPromesas nativas"]
    C --> D["2017 — ES8\nasync / await"]
    D --> E["2022+\nTop-level await\nArray.fromAsync"]

    style A fill:#fee2e2,stroke:#ef4444,color:#991b1b
    style B fill:#fef3c7,stroke:#f59e0b,color:#92400e
    style C fill:#dbeafe,stroke:#3b82f6,color:#1e40af
    style D fill:#dcfce7,stroke:#22c55e,color:#166534
    style E fill:#f3e8ff,stroke:#a855f7,color:#6b21a8
</div>
<table>
<thead>
<tr>
<th>Año</th>
<th>Feature</th>
<th>Mejora</th>
</tr>
</thead>
<tbody>
<tr>
<td>1995</td>
<td>Callbacks</td>
<td>Primera forma de async</td>
</tr>
<tr>
<td>2012</td>
<td>Promesas (librerías)</td>
<td>Evitan callback hell</td>
</tr>
<tr>
<td>2015</td>
<td>Promesas nativas (ES6)</td>
<td>Estándar del lenguaje</td>
</tr>
<tr>
<td>2017</td>
<td>async/await (ES8)</td>
<td>Sintaxis legible</td>
</tr>
<tr>
<td>2022+</td>
<td>Top-level await</td>
<td>await fuera de funciones async</td>
</tr>
</tbody>
</table>
<hr>
<h2 id="conclusión" style="position:relative;"><a href="#conclusi%C3%B3n" aria-label="conclusión permalink" class="anchor before"><svg aria-hidden="true" focusable="false" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Conclusión</h2>
<p>La asincronía es uno de los conceptos más importantes de JavaScript. Entender cómo funciona el Event Loop, las diferencias entre callbacks, promesas y async/await, y cuándo usar ejecución secuencial vs paralela te hará un desarrollador mucho más efectivo.</p>
<p><strong>Resumen rápido:</strong></p>
<ul>
<li><strong>Callbacks</strong> — Simples pero se anidan mal. Evítalos para operaciones encadenadas</li>
<li><strong>Promesas</strong> — Encadenables, un solo punto de error. La base de todo</li>
<li><strong>Async/await</strong> — Legible como código síncrono. Úsalo por defecto</li>
<li><strong>Promise.all</strong> — Cuando necesitas ejecutar varias operaciones en paralelo</li>
<li><strong>try/catch</strong> — Siempre maneja errores en funciones async</li>
</ul>
<p>¡Happy coding!</p>]]></content:encoded>
    </item>
    <item>
      <title>Guía esencial de ES6: Las features que transformaron JavaScript</title>
      <link>https://girgetto.it/es6-javascript/</link>
      <guid isPermaLink="true">https://girgetto.it/es6-javascript/</guid>
      <pubDate>Sat, 21 Mar 2026 00:00:00 GMT</pubDate>
      <description>Descubre las características más importantes de ECMAScript 2015 (ES6) que revolucionaron JavaScript: arrow functions, destructuring, template literals, promesas, módulos y mucho más.</description>
      <dc:language>es</dc:language>
      <category>javascript</category>
      <content:encoded><![CDATA[<p>ES6 (ECMAScript 2015) fue la mayor actualización de JavaScript en su historia. Introdujo una sintaxis más moderna, patrones más limpios y herramientas que hoy usamos a diario. En este artículo repasamos las features más importantes con ejemplos prácticos.</p>
<hr>
<h2 id="let-y-const--adiós-al-var" style="position:relative;"><a href="#let-y-const--adi%C3%B3s-al-var" aria-label="let y const  adiós al var permalink" class="anchor before"><svg aria-hidden="true" focusable="false" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>let y const — Adiós al var</h2>
<p>Antes de ES6, solo teníamos <code>var</code> para declarar variables. El problema era que <code>var</code> tiene <strong>scope de función</strong>, no de bloque, lo que causaba bugs inesperados.</p>
<div class="gatsby-highlight" data-language="javascript"><pre class="language-javascript"><code class="language-javascript"><span class="token comment">// ❌ var — scope de función, se puede redeclarar</span>
<span class="token keyword">var</span> nombre <span class="token operator">=</span> <span class="token string">"Ana"</span><span class="token punctuation">;</span>
<span class="token keyword">var</span> nombre <span class="token operator">=</span> <span class="token string">"Luis"</span><span class="token punctuation">;</span> <span class="token comment">// No da error</span>

<span class="token comment">// ✅ let — scope de bloque, reasignable</span>
<span class="token keyword">let</span> edad <span class="token operator">=</span> <span class="token number">25</span><span class="token punctuation">;</span>
edad <span class="token operator">=</span> <span class="token number">26</span><span class="token punctuation">;</span> <span class="token comment">// OK</span>

<span class="token comment">// ✅ const — scope de bloque, no reasignable</span>
<span class="token keyword">const</span> <span class="token constant">PI</span> <span class="token operator">=</span> <span class="token number">3.14159</span><span class="token punctuation">;</span>
<span class="token comment">// PI = 3; // ❌ TypeError: Assignment to constant variable</span></code></pre></div>
<h3 id="diferencias-clave" style="position:relative;"><a href="#diferencias-clave" aria-label="diferencias clave permalink" class="anchor before"><svg aria-hidden="true" focusable="false" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Diferencias clave</h3>
<table>
<thead>
<tr>
<th>Característica</th>
<th><code>var</code></th>
<th><code>let</code></th>
<th><code>const</code></th>
</tr>
</thead>
<tbody>
<tr>
<td>Scope</td>
<td>Función</td>
<td>Bloque</td>
<td>Bloque</td>
</tr>
<tr>
<td>Redeclarable</td>
<td>Sí</td>
<td>No</td>
<td>No</td>
</tr>
<tr>
<td>Reasignable</td>
<td>Sí</td>
<td>Sí</td>
<td>No</td>
</tr>
<tr>
<td>Hoisting</td>
<td>Sí (inicializado como <code>undefined</code>)</td>
<td>Sí (temporal dead zone)</td>
<td>Sí (temporal dead zone)</td>
</tr>
</tbody>
</table>
<blockquote>
<p><strong>Regla general:</strong> Usa <code>const</code> por defecto. Usa <code>let</code> solo cuando necesites reasignar. Nunca uses <code>var</code>.</p>
</blockquote>
<hr>
<h2 id="arrow-functions" style="position:relative;"><a href="#arrow-functions" aria-label="arrow functions permalink" class="anchor before"><svg aria-hidden="true" focusable="false" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Arrow Functions</h2>
<p>Las arrow functions son una forma más concisa de escribir funciones. Además, <strong>no crean su propio <code>this</code></strong>, lo que resuelve muchos problemas clásicos con callbacks.</p>
<div class="gatsby-highlight" data-language="javascript"><pre class="language-javascript"><code class="language-javascript"><span class="token comment">// Función tradicional</span>
<span class="token keyword">function</span> <span class="token function">sumar</span><span class="token punctuation">(</span><span class="token parameter">a<span class="token punctuation">,</span> b</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
  <span class="token keyword">return</span> a <span class="token operator">+</span> b<span class="token punctuation">;</span>
<span class="token punctuation">}</span>

<span class="token comment">// Arrow function</span>
<span class="token keyword">const</span> <span class="token function-variable function">sumar</span> <span class="token operator">=</span> <span class="token punctuation">(</span><span class="token parameter">a<span class="token punctuation">,</span> b</span><span class="token punctuation">)</span> <span class="token operator">=></span> a <span class="token operator">+</span> b<span class="token punctuation">;</span>

<span class="token comment">// Con un solo parámetro, los paréntesis son opcionales</span>
<span class="token keyword">const</span> <span class="token function-variable function">doble</span> <span class="token operator">=</span> <span class="token parameter">x</span> <span class="token operator">=></span> x <span class="token operator">*</span> <span class="token number">2</span><span class="token punctuation">;</span>

<span class="token comment">// Con cuerpo de múltiples líneas</span>
<span class="token keyword">const</span> <span class="token function-variable function">calcular</span> <span class="token operator">=</span> <span class="token punctuation">(</span><span class="token parameter">a<span class="token punctuation">,</span> b</span><span class="token punctuation">)</span> <span class="token operator">=></span> <span class="token punctuation">{</span>
  <span class="token keyword">const</span> resultado <span class="token operator">=</span> a <span class="token operator">*</span> b<span class="token punctuation">;</span>
  <span class="token keyword">return</span> resultado <span class="token operator">+</span> <span class="token number">10</span><span class="token punctuation">;</span>
<span class="token punctuation">}</span><span class="token punctuation">;</span></code></pre></div>
<h3 id="el-problema-del-this-resuelto" style="position:relative;"><a href="#el-problema-del-this-resuelto" aria-label="el problema del this resuelto permalink" class="anchor before"><svg aria-hidden="true" focusable="false" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>El problema del <code>this</code> resuelto</h3>
<div class="gatsby-highlight" data-language="javascript"><pre class="language-javascript"><code class="language-javascript"><span class="token comment">// ❌ Antes de ES6 — this se pierde en callbacks</span>
<span class="token keyword">function</span> <span class="token function">Contador</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
  <span class="token keyword">this</span><span class="token punctuation">.</span>count <span class="token operator">=</span> <span class="token number">0</span><span class="token punctuation">;</span>
  <span class="token function">setInterval</span><span class="token punctuation">(</span><span class="token keyword">function</span> <span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
    <span class="token keyword">this</span><span class="token punctuation">.</span>count<span class="token operator">++</span><span class="token punctuation">;</span> <span class="token comment">// 'this' NO es el Contador, es window/undefined</span>
  <span class="token punctuation">}</span><span class="token punctuation">,</span> <span class="token number">1000</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token punctuation">}</span>

<span class="token comment">// ✅ Con arrow function — this se hereda del scope padre</span>
<span class="token keyword">function</span> <span class="token function">Contador</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
  <span class="token keyword">this</span><span class="token punctuation">.</span>count <span class="token operator">=</span> <span class="token number">0</span><span class="token punctuation">;</span>
  <span class="token function">setInterval</span><span class="token punctuation">(</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token operator">=></span> <span class="token punctuation">{</span>
    <span class="token keyword">this</span><span class="token punctuation">.</span>count<span class="token operator">++</span><span class="token punctuation">;</span> <span class="token comment">// 'this' SÍ es el Contador</span>
  <span class="token punctuation">}</span><span class="token punctuation">,</span> <span class="token number">1000</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token punctuation">}</span></code></pre></div>
<hr>
<h2 id="template-literals" style="position:relative;"><a href="#template-literals" aria-label="template literals permalink" class="anchor before"><svg aria-hidden="true" focusable="false" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Template Literals</h2>
<p>Los template literals permiten crear strings con interpolación de variables y multilínea usando backticks.</p>
<div class="gatsby-highlight" data-language="javascript"><pre class="language-javascript"><code class="language-javascript"><span class="token keyword">const</span> nombre <span class="token operator">=</span> <span class="token string">"Carlos"</span><span class="token punctuation">;</span>
<span class="token keyword">const</span> edad <span class="token operator">=</span> <span class="token number">30</span><span class="token punctuation">;</span>

<span class="token comment">// ❌ Concatenación clásica</span>
<span class="token keyword">const</span> saludo <span class="token operator">=</span> <span class="token string">"Hola, me llamo "</span> <span class="token operator">+</span> nombre <span class="token operator">+</span> <span class="token string">" y tengo "</span> <span class="token operator">+</span> edad <span class="token operator">+</span> <span class="token string">" años."</span><span class="token punctuation">;</span>

<span class="token comment">// ✅ Template literal</span>
<span class="token keyword">const</span> saludo <span class="token operator">=</span> <span class="token template-string"><span class="token template-punctuation string">`</span><span class="token string">Hola, me llamo </span><span class="token interpolation"><span class="token interpolation-punctuation punctuation">${</span>nombre<span class="token interpolation-punctuation punctuation">}</span></span><span class="token string"> y tengo </span><span class="token interpolation"><span class="token interpolation-punctuation punctuation">${</span>edad<span class="token interpolation-punctuation punctuation">}</span></span><span class="token string"> años.</span><span class="token template-punctuation string">`</span></span><span class="token punctuation">;</span>

<span class="token comment">// Multilínea</span>
<span class="token keyword">const</span> html <span class="token operator">=</span> <span class="token template-string"><span class="token template-punctuation string">`</span><span class="token string">
  &lt;div class="card">
    &lt;h2></span><span class="token interpolation"><span class="token interpolation-punctuation punctuation">${</span>nombre<span class="token interpolation-punctuation punctuation">}</span></span><span class="token string">&lt;/h2>
    &lt;p>Edad: </span><span class="token interpolation"><span class="token interpolation-punctuation punctuation">${</span>edad<span class="token interpolation-punctuation punctuation">}</span></span><span class="token string">&lt;/p>
  &lt;/div>
</span><span class="token template-punctuation string">`</span></span><span class="token punctuation">;</span>

<span class="token comment">// Expresiones dentro de ${}</span>
<span class="token keyword">const</span> mensaje <span class="token operator">=</span> <span class="token template-string"><span class="token template-punctuation string">`</span><span class="token string">En 5 años tendré </span><span class="token interpolation"><span class="token interpolation-punctuation punctuation">${</span>edad <span class="token operator">+</span> <span class="token number">5</span><span class="token interpolation-punctuation punctuation">}</span></span><span class="token string"> años.</span><span class="token template-punctuation string">`</span></span><span class="token punctuation">;</span></code></pre></div>
<hr>
<h2 id="destructuring" style="position:relative;"><a href="#destructuring" aria-label="destructuring permalink" class="anchor before"><svg aria-hidden="true" focusable="false" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Destructuring</h2>
<p>El destructuring permite extraer valores de arrays y objetos en variables individuales de forma directa.</p>
<h3 id="destructuring-de-objetos" style="position:relative;"><a href="#destructuring-de-objetos" aria-label="destructuring de objetos permalink" class="anchor before"><svg aria-hidden="true" focusable="false" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Destructuring de objetos</h3>
<div class="gatsby-highlight" data-language="javascript"><pre class="language-javascript"><code class="language-javascript"><span class="token keyword">const</span> usuario <span class="token operator">=</span> <span class="token punctuation">{</span>
  <span class="token literal-property property">nombre</span><span class="token operator">:</span> <span class="token string">"María"</span><span class="token punctuation">,</span>
  <span class="token literal-property property">edad</span><span class="token operator">:</span> <span class="token number">28</span><span class="token punctuation">,</span>
  <span class="token literal-property property">ciudad</span><span class="token operator">:</span> <span class="token string">"Madrid"</span><span class="token punctuation">,</span>
  <span class="token literal-property property">trabajo</span><span class="token operator">:</span> <span class="token string">"Desarrolladora"</span>
<span class="token punctuation">}</span><span class="token punctuation">;</span>

<span class="token comment">// ❌ Sin destructuring</span>
<span class="token keyword">const</span> nombre <span class="token operator">=</span> usuario<span class="token punctuation">.</span>nombre<span class="token punctuation">;</span>
<span class="token keyword">const</span> edad <span class="token operator">=</span> usuario<span class="token punctuation">.</span>edad<span class="token punctuation">;</span>

<span class="token comment">// ✅ Con destructuring</span>
<span class="token keyword">const</span> <span class="token punctuation">{</span> nombre<span class="token punctuation">,</span> edad<span class="token punctuation">,</span> ciudad <span class="token punctuation">}</span> <span class="token operator">=</span> usuario<span class="token punctuation">;</span>

<span class="token comment">// Renombrar variables</span>
<span class="token keyword">const</span> <span class="token punctuation">{</span> <span class="token literal-property property">nombre</span><span class="token operator">:</span> userName<span class="token punctuation">,</span> <span class="token literal-property property">edad</span><span class="token operator">:</span> userAge <span class="token punctuation">}</span> <span class="token operator">=</span> usuario<span class="token punctuation">;</span>

<span class="token comment">// Valores por defecto</span>
<span class="token keyword">const</span> <span class="token punctuation">{</span> nombre<span class="token punctuation">,</span> pais <span class="token operator">=</span> <span class="token string">"España"</span> <span class="token punctuation">}</span> <span class="token operator">=</span> usuario<span class="token punctuation">;</span>

<span class="token comment">// Destructuring anidado</span>
<span class="token keyword">const</span> empresa <span class="token operator">=</span> <span class="token punctuation">{</span>
  <span class="token literal-property property">datos</span><span class="token operator">:</span> <span class="token punctuation">{</span>
    <span class="token literal-property property">nombre</span><span class="token operator">:</span> <span class="token string">"TechCorp"</span><span class="token punctuation">,</span>
    <span class="token literal-property property">direccion</span><span class="token operator">:</span> <span class="token punctuation">{</span> <span class="token literal-property property">ciudad</span><span class="token operator">:</span> <span class="token string">"Barcelona"</span><span class="token punctuation">,</span> <span class="token literal-property property">cp</span><span class="token operator">:</span> <span class="token string">"08001"</span> <span class="token punctuation">}</span>
  <span class="token punctuation">}</span>
<span class="token punctuation">}</span><span class="token punctuation">;</span>

<span class="token keyword">const</span> <span class="token punctuation">{</span> <span class="token literal-property property">datos</span><span class="token operator">:</span> <span class="token punctuation">{</span> <span class="token literal-property property">direccion</span><span class="token operator">:</span> <span class="token punctuation">{</span> ciudad <span class="token punctuation">}</span> <span class="token punctuation">}</span> <span class="token punctuation">}</span> <span class="token operator">=</span> empresa<span class="token punctuation">;</span></code></pre></div>
<h3 id="destructuring-de-arrays" style="position:relative;"><a href="#destructuring-de-arrays" aria-label="destructuring de arrays permalink" class="anchor before"><svg aria-hidden="true" focusable="false" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Destructuring de arrays</h3>
<div class="gatsby-highlight" data-language="javascript"><pre class="language-javascript"><code class="language-javascript"><span class="token keyword">const</span> colores <span class="token operator">=</span> <span class="token punctuation">[</span><span class="token string">"rojo"</span><span class="token punctuation">,</span> <span class="token string">"verde"</span><span class="token punctuation">,</span> <span class="token string">"azul"</span><span class="token punctuation">,</span> <span class="token string">"amarillo"</span><span class="token punctuation">]</span><span class="token punctuation">;</span>

<span class="token comment">// Extraer elementos</span>
<span class="token keyword">const</span> <span class="token punctuation">[</span>primero<span class="token punctuation">,</span> segundo<span class="token punctuation">]</span> <span class="token operator">=</span> colores<span class="token punctuation">;</span>
<span class="token comment">// primero → "rojo", segundo → "verde"</span>

<span class="token comment">// Saltar elementos</span>
<span class="token keyword">const</span> <span class="token punctuation">[</span><span class="token punctuation">,</span> <span class="token punctuation">,</span> tercero<span class="token punctuation">]</span> <span class="token operator">=</span> colores<span class="token punctuation">;</span>
<span class="token comment">// tercero → "azul"</span>

<span class="token comment">// Rest operator</span>
<span class="token keyword">const</span> <span class="token punctuation">[</span>cabeza<span class="token punctuation">,</span> <span class="token operator">...</span>resto<span class="token punctuation">]</span> <span class="token operator">=</span> colores<span class="token punctuation">;</span>
<span class="token comment">// cabeza → "rojo", resto → ["verde", "azul", "amarillo"]</span>

<span class="token comment">// Intercambiar variables</span>
<span class="token keyword">let</span> a <span class="token operator">=</span> <span class="token number">1</span><span class="token punctuation">,</span> b <span class="token operator">=</span> <span class="token number">2</span><span class="token punctuation">;</span>
<span class="token punctuation">[</span>a<span class="token punctuation">,</span> b<span class="token punctuation">]</span> <span class="token operator">=</span> <span class="token punctuation">[</span>b<span class="token punctuation">,</span> a<span class="token punctuation">]</span><span class="token punctuation">;</span>
<span class="token comment">// a → 2, b → 1</span></code></pre></div>
<hr>
<h2 id="spread-y-rest-operators-" style="position:relative;"><a href="#spread-y-rest-operators-" aria-label="spread y rest operators  permalink" class="anchor before"><svg aria-hidden="true" focusable="false" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Spread y Rest Operators (...)</h2>
<p>Los tres puntos (<code>...</code>) sirven para dos cosas: <strong>spread</strong> (expandir) y <strong>rest</strong> (recoger).</p>
<div class="gatsby-highlight" data-language="javascript"><pre class="language-javascript"><code class="language-javascript"><span class="token comment">// SPREAD — expandir arrays/objetos</span>

<span class="token keyword">const</span> nums <span class="token operator">=</span> <span class="token punctuation">[</span><span class="token number">1</span><span class="token punctuation">,</span> <span class="token number">2</span><span class="token punctuation">,</span> <span class="token number">3</span><span class="token punctuation">]</span><span class="token punctuation">;</span>
<span class="token keyword">const</span> masNums <span class="token operator">=</span> <span class="token punctuation">[</span><span class="token operator">...</span>nums<span class="token punctuation">,</span> <span class="token number">4</span><span class="token punctuation">,</span> <span class="token number">5</span><span class="token punctuation">]</span><span class="token punctuation">;</span> <span class="token comment">// [1, 2, 3, 4, 5]</span>

<span class="token comment">// Copiar un array (shallow copy)</span>
<span class="token keyword">const</span> copia <span class="token operator">=</span> <span class="token punctuation">[</span><span class="token operator">...</span>nums<span class="token punctuation">]</span><span class="token punctuation">;</span>

<span class="token comment">// Merge de objetos</span>
<span class="token keyword">const</span> base <span class="token operator">=</span> <span class="token punctuation">{</span> <span class="token literal-property property">color</span><span class="token operator">:</span> <span class="token string">"azul"</span><span class="token punctuation">,</span> <span class="token literal-property property">tamaño</span><span class="token operator">:</span> <span class="token string">"M"</span> <span class="token punctuation">}</span><span class="token punctuation">;</span>
<span class="token keyword">const</span> extra <span class="token operator">=</span> <span class="token punctuation">{</span> <span class="token literal-property property">tamaño</span><span class="token operator">:</span> <span class="token string">"L"</span><span class="token punctuation">,</span> <span class="token literal-property property">peso</span><span class="token operator">:</span> <span class="token string">"200g"</span> <span class="token punctuation">}</span><span class="token punctuation">;</span>
<span class="token keyword">const</span> merged <span class="token operator">=</span> <span class="token punctuation">{</span> <span class="token operator">...</span>base<span class="token punctuation">,</span> <span class="token operator">...</span>extra <span class="token punctuation">}</span><span class="token punctuation">;</span>
<span class="token comment">// { color: "azul", tamaño: "L", peso: "200g" }</span>

<span class="token comment">// REST — recoger argumentos</span>
<span class="token keyword">function</span> <span class="token function">sumarTodos</span><span class="token punctuation">(</span><span class="token parameter"><span class="token operator">...</span>numeros</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
  <span class="token keyword">return</span> numeros<span class="token punctuation">.</span><span class="token function">reduce</span><span class="token punctuation">(</span><span class="token punctuation">(</span><span class="token parameter">acc<span class="token punctuation">,</span> n</span><span class="token punctuation">)</span> <span class="token operator">=></span> acc <span class="token operator">+</span> n<span class="token punctuation">,</span> <span class="token number">0</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token punctuation">}</span>

<span class="token function">sumarTodos</span><span class="token punctuation">(</span><span class="token number">1</span><span class="token punctuation">,</span> <span class="token number">2</span><span class="token punctuation">,</span> <span class="token number">3</span><span class="token punctuation">,</span> <span class="token number">4</span><span class="token punctuation">)</span><span class="token punctuation">;</span> <span class="token comment">// 10</span></code></pre></div>
<hr>
<h2 id="promesas-y-asyncawait" style="position:relative;"><a href="#promesas-y-asyncawait" aria-label="promesas y asyncawait permalink" class="anchor before"><svg aria-hidden="true" focusable="false" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Promesas y Async/Await</h2>
<p>Las promesas son el mecanismo estándar para manejar operaciones asíncronas en JavaScript.</p>
<h3 id="promesas" style="position:relative;"><a href="#promesas" aria-label="promesas permalink" class="anchor before"><svg aria-hidden="true" focusable="false" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Promesas</h3>
<div class="gatsby-highlight" data-language="javascript"><pre class="language-javascript"><code class="language-javascript"><span class="token comment">// Crear una promesa</span>
<span class="token keyword">const</span> <span class="token function-variable function">obtenerDatos</span> <span class="token operator">=</span> <span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token operator">=></span> <span class="token punctuation">{</span>
  <span class="token keyword">return</span> <span class="token keyword">new</span> <span class="token class-name">Promise</span><span class="token punctuation">(</span><span class="token punctuation">(</span><span class="token parameter">resolve<span class="token punctuation">,</span> reject</span><span class="token punctuation">)</span> <span class="token operator">=></span> <span class="token punctuation">{</span>
    <span class="token function">setTimeout</span><span class="token punctuation">(</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token operator">=></span> <span class="token punctuation">{</span>
      <span class="token keyword">const</span> datos <span class="token operator">=</span> <span class="token punctuation">{</span> <span class="token literal-property property">id</span><span class="token operator">:</span> <span class="token number">1</span><span class="token punctuation">,</span> <span class="token literal-property property">nombre</span><span class="token operator">:</span> <span class="token string">"Producto"</span> <span class="token punctuation">}</span><span class="token punctuation">;</span>
      <span class="token function">resolve</span><span class="token punctuation">(</span>datos<span class="token punctuation">)</span><span class="token punctuation">;</span>
      <span class="token comment">// reject(new Error("Fallo al obtener datos"));</span>
    <span class="token punctuation">}</span><span class="token punctuation">,</span> <span class="token number">1000</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
  <span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token punctuation">}</span><span class="token punctuation">;</span>

<span class="token comment">// Consumir la promesa</span>
<span class="token function">obtenerDatos</span><span class="token punctuation">(</span><span class="token punctuation">)</span>
  <span class="token punctuation">.</span><span class="token function">then</span><span class="token punctuation">(</span><span class="token parameter">datos</span> <span class="token operator">=></span> console<span class="token punctuation">.</span><span class="token function">log</span><span class="token punctuation">(</span>datos<span class="token punctuation">)</span><span class="token punctuation">)</span>
  <span class="token punctuation">.</span><span class="token function">catch</span><span class="token punctuation">(</span><span class="token parameter">error</span> <span class="token operator">=></span> console<span class="token punctuation">.</span><span class="token function">error</span><span class="token punctuation">(</span>error<span class="token punctuation">)</span><span class="token punctuation">)</span>
  <span class="token punctuation">.</span><span class="token function">finally</span><span class="token punctuation">(</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token operator">=></span> console<span class="token punctuation">.</span><span class="token function">log</span><span class="token punctuation">(</span><span class="token string">"Operación completada"</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span></code></pre></div>
<h3 id="asyncawait-es2017-pero-complementa-las-promesas-de-es6" style="position:relative;"><a href="#asyncawait-es2017-pero-complementa-las-promesas-de-es6" aria-label="asyncawait es2017 pero complementa las promesas de es6 permalink" class="anchor before"><svg aria-hidden="true" focusable="false" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Async/Await (ES2017, pero complementa las promesas de ES6)</h3>
<div class="gatsby-highlight" data-language="javascript"><pre class="language-javascript"><code class="language-javascript"><span class="token comment">// Async/await hace que el código asíncrono parezca síncrono</span>
<span class="token keyword">async</span> <span class="token keyword">function</span> <span class="token function">cargarUsuario</span><span class="token punctuation">(</span><span class="token parameter">id</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
  <span class="token keyword">try</span> <span class="token punctuation">{</span>
    <span class="token keyword">const</span> response <span class="token operator">=</span> <span class="token keyword">await</span> <span class="token function">fetch</span><span class="token punctuation">(</span><span class="token template-string"><span class="token template-punctuation string">`</span><span class="token string">/api/usuarios/</span><span class="token interpolation"><span class="token interpolation-punctuation punctuation">${</span>id<span class="token interpolation-punctuation punctuation">}</span></span><span class="token template-punctuation string">`</span></span><span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token keyword">const</span> usuario <span class="token operator">=</span> <span class="token keyword">await</span> response<span class="token punctuation">.</span><span class="token function">json</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token keyword">return</span> usuario<span class="token punctuation">;</span>
  <span class="token punctuation">}</span> <span class="token keyword">catch</span> <span class="token punctuation">(</span>error<span class="token punctuation">)</span> <span class="token punctuation">{</span>
    console<span class="token punctuation">.</span><span class="token function">error</span><span class="token punctuation">(</span><span class="token string">"Error cargando usuario:"</span><span class="token punctuation">,</span> error<span class="token punctuation">)</span><span class="token punctuation">;</span>
  <span class="token punctuation">}</span>
<span class="token punctuation">}</span>

<span class="token comment">// Ejecutar varias promesas en paralelo</span>
<span class="token keyword">async</span> <span class="token keyword">function</span> <span class="token function">cargarTodo</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
  <span class="token keyword">const</span> <span class="token punctuation">[</span>usuarios<span class="token punctuation">,</span> productos<span class="token punctuation">]</span> <span class="token operator">=</span> <span class="token keyword">await</span> Promise<span class="token punctuation">.</span><span class="token function">all</span><span class="token punctuation">(</span><span class="token punctuation">[</span>
    <span class="token function">fetch</span><span class="token punctuation">(</span><span class="token string">"/api/usuarios"</span><span class="token punctuation">)</span><span class="token punctuation">.</span><span class="token function">then</span><span class="token punctuation">(</span><span class="token parameter">r</span> <span class="token operator">=></span> r<span class="token punctuation">.</span><span class="token function">json</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
    <span class="token function">fetch</span><span class="token punctuation">(</span><span class="token string">"/api/productos"</span><span class="token punctuation">)</span><span class="token punctuation">.</span><span class="token function">then</span><span class="token punctuation">(</span><span class="token parameter">r</span> <span class="token operator">=></span> r<span class="token punctuation">.</span><span class="token function">json</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">)</span>
  <span class="token punctuation">]</span><span class="token punctuation">)</span><span class="token punctuation">;</span>

  console<span class="token punctuation">.</span><span class="token function">log</span><span class="token punctuation">(</span>usuarios<span class="token punctuation">,</span> productos<span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token punctuation">}</span></code></pre></div>
<hr>
<h2 id="módulos-import--export" style="position:relative;"><a href="#m%C3%B3dulos-import--export" aria-label="módulos import  export permalink" class="anchor before"><svg aria-hidden="true" focusable="false" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Módulos (import / export)</h2>
<p>ES6 introdujo un sistema de módulos nativo para JavaScript, permitiendo organizar el código en archivos separados.</p>
<div class="gatsby-highlight" data-language="javascript"><pre class="language-javascript"><code class="language-javascript"><span class="token comment">// 📁 utils/math.js</span>
<span class="token keyword">export</span> <span class="token keyword">const</span> <span class="token constant">PI</span> <span class="token operator">=</span> <span class="token number">3.14159</span><span class="token punctuation">;</span>

<span class="token keyword">export</span> <span class="token keyword">function</span> <span class="token function">sumar</span><span class="token punctuation">(</span><span class="token parameter">a<span class="token punctuation">,</span> b</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
  <span class="token keyword">return</span> a <span class="token operator">+</span> b<span class="token punctuation">;</span>
<span class="token punctuation">}</span>

<span class="token keyword">export</span> <span class="token keyword">default</span> <span class="token keyword">function</span> <span class="token function">multiplicar</span><span class="token punctuation">(</span><span class="token parameter">a<span class="token punctuation">,</span> b</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
  <span class="token keyword">return</span> a <span class="token operator">*</span> b<span class="token punctuation">;</span>
<span class="token punctuation">}</span>

<span class="token comment">// 📁 app.js</span>
<span class="token keyword">import</span> multiplicar<span class="token punctuation">,</span> <span class="token punctuation">{</span> <span class="token constant">PI</span><span class="token punctuation">,</span> sumar <span class="token punctuation">}</span> <span class="token keyword">from</span> <span class="token string">"./utils/math.js"</span><span class="token punctuation">;</span>

console<span class="token punctuation">.</span><span class="token function">log</span><span class="token punctuation">(</span><span class="token function">sumar</span><span class="token punctuation">(</span><span class="token number">2</span><span class="token punctuation">,</span> <span class="token number">3</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>      <span class="token comment">// 5</span>
console<span class="token punctuation">.</span><span class="token function">log</span><span class="token punctuation">(</span><span class="token function">multiplicar</span><span class="token punctuation">(</span><span class="token number">4</span><span class="token punctuation">,</span> <span class="token number">5</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span> <span class="token comment">// 20</span>
console<span class="token punctuation">.</span><span class="token function">log</span><span class="token punctuation">(</span><span class="token constant">PI</span><span class="token punctuation">)</span><span class="token punctuation">;</span>                <span class="token comment">// 3.14159</span></code></pre></div>
<h3 id="tipos-de-exportimport" style="position:relative;"><a href="#tipos-de-exportimport" aria-label="tipos de exportimport permalink" class="anchor before"><svg aria-hidden="true" focusable="false" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Tipos de export/import</h3>
<div class="gatsby-highlight" data-language="javascript"><pre class="language-javascript"><code class="language-javascript"><span class="token comment">// Named exports — puedes tener varios por archivo</span>
<span class="token keyword">export</span> <span class="token keyword">const</span> nombre <span class="token operator">=</span> <span class="token string">"valor"</span><span class="token punctuation">;</span>
<span class="token keyword">export</span> <span class="token keyword">function</span> <span class="token function">fn</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token punctuation">{</span><span class="token punctuation">}</span>

<span class="token comment">// Default export — solo uno por archivo</span>
<span class="token keyword">export</span> <span class="token keyword">default</span> <span class="token keyword">function</span> <span class="token function">principal</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token punctuation">{</span><span class="token punctuation">}</span>

<span class="token comment">// Import con alias</span>
<span class="token keyword">import</span> <span class="token punctuation">{</span> sumar <span class="token keyword">as</span> add <span class="token punctuation">}</span> <span class="token keyword">from</span> <span class="token string">"./math.js"</span><span class="token punctuation">;</span>

<span class="token comment">// Import todo el módulo</span>
<span class="token keyword">import</span> <span class="token operator">*</span> <span class="token keyword">as</span> MathUtils <span class="token keyword">from</span> <span class="token string">"./math.js"</span><span class="token punctuation">;</span>
MathUtils<span class="token punctuation">.</span><span class="token function">sumar</span><span class="token punctuation">(</span><span class="token number">1</span><span class="token punctuation">,</span> <span class="token number">2</span><span class="token punctuation">)</span><span class="token punctuation">;</span></code></pre></div>
<hr>
<h2 id="clases" style="position:relative;"><a href="#clases" aria-label="clases permalink" class="anchor before"><svg aria-hidden="true" focusable="false" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Clases</h2>
<p>ES6 introdujo la sintaxis <code>class</code> como azúcar sintáctico sobre el sistema de prototipos de JavaScript.</p>
<div class="gatsby-highlight" data-language="javascript"><pre class="language-javascript"><code class="language-javascript"><span class="token keyword">class</span> <span class="token class-name">Animal</span> <span class="token punctuation">{</span>
  <span class="token function">constructor</span><span class="token punctuation">(</span><span class="token parameter">nombre<span class="token punctuation">,</span> sonido</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
    <span class="token keyword">this</span><span class="token punctuation">.</span>nombre <span class="token operator">=</span> nombre<span class="token punctuation">;</span>
    <span class="token keyword">this</span><span class="token punctuation">.</span>sonido <span class="token operator">=</span> sonido<span class="token punctuation">;</span>
  <span class="token punctuation">}</span>

  <span class="token function">hablar</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
    <span class="token keyword">return</span> <span class="token template-string"><span class="token template-punctuation string">`</span><span class="token interpolation"><span class="token interpolation-punctuation punctuation">${</span><span class="token keyword">this</span><span class="token punctuation">.</span>nombre<span class="token interpolation-punctuation punctuation">}</span></span><span class="token string"> hace </span><span class="token interpolation"><span class="token interpolation-punctuation punctuation">${</span><span class="token keyword">this</span><span class="token punctuation">.</span>sonido<span class="token interpolation-punctuation punctuation">}</span></span><span class="token template-punctuation string">`</span></span><span class="token punctuation">;</span>
  <span class="token punctuation">}</span>

  <span class="token comment">// Getter</span>
  <span class="token keyword">get</span> <span class="token function">info</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
    <span class="token keyword">return</span> <span class="token template-string"><span class="token template-punctuation string">`</span><span class="token interpolation"><span class="token interpolation-punctuation punctuation">${</span><span class="token keyword">this</span><span class="token punctuation">.</span>nombre<span class="token interpolation-punctuation punctuation">}</span></span><span class="token string"> (</span><span class="token interpolation"><span class="token interpolation-punctuation punctuation">${</span><span class="token keyword">this</span><span class="token punctuation">.</span>sonido<span class="token interpolation-punctuation punctuation">}</span></span><span class="token string">)</span><span class="token template-punctuation string">`</span></span><span class="token punctuation">;</span>
  <span class="token punctuation">}</span>

  <span class="token comment">// Método estático</span>
  <span class="token keyword">static</span> <span class="token function">crearPerro</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
    <span class="token keyword">return</span> <span class="token keyword">new</span> <span class="token class-name">Animal</span><span class="token punctuation">(</span><span class="token string">"Perro"</span><span class="token punctuation">,</span> <span class="token string">"Guau"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
  <span class="token punctuation">}</span>
<span class="token punctuation">}</span>

<span class="token comment">// Herencia</span>
<span class="token keyword">class</span> <span class="token class-name">Gato</span> <span class="token keyword">extends</span> <span class="token class-name">Animal</span> <span class="token punctuation">{</span>
  <span class="token function">constructor</span><span class="token punctuation">(</span><span class="token parameter">nombre<span class="token punctuation">,</span> color</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
    <span class="token keyword">super</span><span class="token punctuation">(</span>nombre<span class="token punctuation">,</span> <span class="token string">"Miau"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token keyword">this</span><span class="token punctuation">.</span>color <span class="token operator">=</span> color<span class="token punctuation">;</span>
  <span class="token punctuation">}</span>

  <span class="token function">hablar</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
    <span class="token keyword">return</span> <span class="token template-string"><span class="token template-punctuation string">`</span><span class="token interpolation"><span class="token interpolation-punctuation punctuation">${</span><span class="token keyword">super</span><span class="token punctuation">.</span><span class="token function">hablar</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token interpolation-punctuation punctuation">}</span></span><span class="token string"> 🐱</span><span class="token template-punctuation string">`</span></span><span class="token punctuation">;</span>
  <span class="token punctuation">}</span>
<span class="token punctuation">}</span>

<span class="token keyword">const</span> michi <span class="token operator">=</span> <span class="token keyword">new</span> <span class="token class-name">Gato</span><span class="token punctuation">(</span><span class="token string">"Luna"</span><span class="token punctuation">,</span> <span class="token string">"negro"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
michi<span class="token punctuation">.</span><span class="token function">hablar</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span> <span class="token comment">// "Luna hace Miau 🐱"</span></code></pre></div>
<hr>
<h2 id="otras-features-importantes" style="position:relative;"><a href="#otras-features-importantes" aria-label="otras features importantes permalink" class="anchor before"><svg aria-hidden="true" focusable="false" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Otras features importantes</h2>
<h3 id="map-y-set" style="position:relative;"><a href="#map-y-set" aria-label="map y set permalink" class="anchor before"><svg aria-hidden="true" focusable="false" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Map y Set</h3>
<div class="gatsby-highlight" data-language="javascript"><pre class="language-javascript"><code class="language-javascript"><span class="token comment">// Map — diccionario con claves de cualquier tipo</span>
<span class="token keyword">const</span> mapa <span class="token operator">=</span> <span class="token keyword">new</span> <span class="token class-name">Map</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
mapa<span class="token punctuation">.</span><span class="token function">set</span><span class="token punctuation">(</span><span class="token string">"nombre"</span><span class="token punctuation">,</span> <span class="token string">"Ana"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
mapa<span class="token punctuation">.</span><span class="token function">set</span><span class="token punctuation">(</span><span class="token number">42</span><span class="token punctuation">,</span> <span class="token string">"la respuesta"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
mapa<span class="token punctuation">.</span><span class="token function">set</span><span class="token punctuation">(</span><span class="token boolean">true</span><span class="token punctuation">,</span> <span class="token string">"booleano como clave"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>

mapa<span class="token punctuation">.</span><span class="token function">get</span><span class="token punctuation">(</span><span class="token string">"nombre"</span><span class="token punctuation">)</span><span class="token punctuation">;</span> <span class="token comment">// "Ana"</span>
mapa<span class="token punctuation">.</span>size<span class="token punctuation">;</span>           <span class="token comment">// 3</span>

<span class="token comment">// Set — colección de valores únicos</span>
<span class="token keyword">const</span> unicos <span class="token operator">=</span> <span class="token keyword">new</span> <span class="token class-name">Set</span><span class="token punctuation">(</span><span class="token punctuation">[</span><span class="token number">1</span><span class="token punctuation">,</span> <span class="token number">2</span><span class="token punctuation">,</span> <span class="token number">2</span><span class="token punctuation">,</span> <span class="token number">3</span><span class="token punctuation">,</span> <span class="token number">3</span><span class="token punctuation">,</span> <span class="token number">3</span><span class="token punctuation">]</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token comment">// Set {1, 2, 3}</span>

unicos<span class="token punctuation">.</span><span class="token function">add</span><span class="token punctuation">(</span><span class="token number">4</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
unicos<span class="token punctuation">.</span><span class="token function">has</span><span class="token punctuation">(</span><span class="token number">2</span><span class="token punctuation">)</span><span class="token punctuation">;</span>    <span class="token comment">// true</span>
unicos<span class="token punctuation">.</span><span class="token function">delete</span><span class="token punctuation">(</span><span class="token number">1</span><span class="token punctuation">)</span><span class="token punctuation">;</span></code></pre></div>
<h3 id="símbolos" style="position:relative;"><a href="#s%C3%ADmbolos" aria-label="símbolos permalink" class="anchor before"><svg aria-hidden="true" focusable="false" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Símbolos</h3>
<div class="gatsby-highlight" data-language="javascript"><pre class="language-javascript"><code class="language-javascript"><span class="token comment">// Symbol — identificador único e inmutable</span>
<span class="token keyword">const</span> id <span class="token operator">=</span> <span class="token function">Symbol</span><span class="token punctuation">(</span><span class="token string">"id"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token keyword">const</span> usuario <span class="token operator">=</span> <span class="token punctuation">{</span>
  <span class="token punctuation">[</span>id<span class="token punctuation">]</span><span class="token operator">:</span> <span class="token number">123</span><span class="token punctuation">,</span>
  <span class="token literal-property property">nombre</span><span class="token operator">:</span> <span class="token string">"Pedro"</span>
<span class="token punctuation">}</span><span class="token punctuation">;</span>

usuario<span class="token punctuation">[</span>id<span class="token punctuation">]</span><span class="token punctuation">;</span> <span class="token comment">// 123</span>
<span class="token comment">// El símbolo no aparece en for...in ni Object.keys()</span></code></pre></div>
<h3 id="valores-por-defecto-en-parámetros" style="position:relative;"><a href="#valores-por-defecto-en-par%C3%A1metros" aria-label="valores por defecto en parámetros permalink" class="anchor before"><svg aria-hidden="true" focusable="false" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Valores por defecto en parámetros</h3>
<div class="gatsby-highlight" data-language="javascript"><pre class="language-javascript"><code class="language-javascript"><span class="token keyword">function</span> <span class="token function">crearUsuario</span><span class="token punctuation">(</span>nombre<span class="token punctuation">,</span> rol <span class="token operator">=</span> <span class="token string">"usuario"</span><span class="token punctuation">,</span> activo <span class="token operator">=</span> <span class="token boolean">true</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
  <span class="token keyword">return</span> <span class="token punctuation">{</span> nombre<span class="token punctuation">,</span> rol<span class="token punctuation">,</span> activo <span class="token punctuation">}</span><span class="token punctuation">;</span>
<span class="token punctuation">}</span>

<span class="token function">crearUsuario</span><span class="token punctuation">(</span><span class="token string">"Ana"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>              <span class="token comment">// { nombre: "Ana", rol: "usuario", activo: true }</span>
<span class="token function">crearUsuario</span><span class="token punctuation">(</span><span class="token string">"Luis"</span><span class="token punctuation">,</span> <span class="token string">"admin"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>    <span class="token comment">// { nombre: "Luis", rol: "admin", activo: true }</span></code></pre></div>
<h3 id="shorthand-en-objetos" style="position:relative;"><a href="#shorthand-en-objetos" aria-label="shorthand en objetos permalink" class="anchor before"><svg aria-hidden="true" focusable="false" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Shorthand en objetos</h3>
<div class="gatsby-highlight" data-language="javascript"><pre class="language-javascript"><code class="language-javascript"><span class="token keyword">const</span> nombre <span class="token operator">=</span> <span class="token string">"Sara"</span><span class="token punctuation">;</span>
<span class="token keyword">const</span> edad <span class="token operator">=</span> <span class="token number">25</span><span class="token punctuation">;</span>

<span class="token comment">// ❌ Antes</span>
<span class="token keyword">const</span> persona <span class="token operator">=</span> <span class="token punctuation">{</span> <span class="token literal-property property">nombre</span><span class="token operator">:</span> nombre<span class="token punctuation">,</span> <span class="token literal-property property">edad</span><span class="token operator">:</span> edad <span class="token punctuation">}</span><span class="token punctuation">;</span>

<span class="token comment">// ✅ ES6 shorthand</span>
<span class="token keyword">const</span> persona <span class="token operator">=</span> <span class="token punctuation">{</span> nombre<span class="token punctuation">,</span> edad <span class="token punctuation">}</span><span class="token punctuation">;</span>

<span class="token comment">// Métodos shorthand</span>
<span class="token keyword">const</span> calc <span class="token operator">=</span> <span class="token punctuation">{</span>
  <span class="token function">sumar</span><span class="token punctuation">(</span><span class="token parameter">a<span class="token punctuation">,</span> b</span><span class="token punctuation">)</span> <span class="token punctuation">{</span> <span class="token keyword">return</span> a <span class="token operator">+</span> b<span class="token punctuation">;</span> <span class="token punctuation">}</span><span class="token punctuation">,</span>
  <span class="token function">restar</span><span class="token punctuation">(</span><span class="token parameter">a<span class="token punctuation">,</span> b</span><span class="token punctuation">)</span> <span class="token punctuation">{</span> <span class="token keyword">return</span> a <span class="token operator">-</span> b<span class="token punctuation">;</span> <span class="token punctuation">}</span>
<span class="token punctuation">}</span><span class="token punctuation">;</span></code></pre></div>
<hr>
<h2 id="conclusión" style="position:relative;"><a href="#conclusi%C3%B3n" aria-label="conclusión permalink" class="anchor before"><svg aria-hidden="true" focusable="false" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Conclusión</h2>
<p>ES6 transformó JavaScript de un lenguaje con muchas limitaciones a uno moderno y expresivo. Estas features no son solo azúcar sintáctico — cambian la forma en la que estructuramos, organizamos y pensamos nuestro código.</p>
<p>Si aún no estás usando todas estas características, el mejor momento para empezar es ahora. La mayoría de navegadores modernos y Node.js las soportan nativamente, así que no hay excusas.</p>
<p>¡Happy coding!</p>]]></content:encoded>
    </item>
    <item>
      <title>Git desde cero: Guía práctica de los comandos básicos</title>
      <link>https://girgetto.it/git-comandos-basicos/</link>
      <guid isPermaLink="true">https://girgetto.it/git-comandos-basicos/</guid>
      <pubDate>Sat, 21 Mar 2026 00:00:00 GMT</pubDate>
      <description>Aprende los comandos esenciales de Git para controlar versiones de tu código: init, add, commit, branch, merge, rebase y más. Con diagramas para entender visualmente cómo funciona cada operación.</description>
      <dc:language>es</dc:language>
      <category>git</category>
      <content:encoded><![CDATA[<p>Git es el sistema de control de versiones más usado en el mundo del desarrollo de software. Te permite llevar un historial de cambios, trabajar en equipo sin conflictos y volver a cualquier punto anterior de tu proyecto. En esta guía aprenderás los comandos más importantes con diagramas que te ayudarán a visualizar cada operación.</p>
<hr>
<h2 id="cómo-funciona-git-internamente" style="position:relative;"><a href="#c%C3%B3mo-funciona-git-internamente" aria-label="cómo funciona git internamente permalink" class="anchor before"><svg aria-hidden="true" focusable="false" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Cómo funciona Git internamente</h2>
<p>Antes de ver los comandos, es fundamental entender las tres áreas principales de Git:</p>
<div class="mermaid">
flowchart LR
    WD["📁 Working Directory\n(Directorio de trabajo)"]
    SA["📋 Staging Area\n(Área de preparación)"]
    LR["📦 Local Repository\n(Repositorio local)"]
    RR["☁️ Remote Repository\n(Repositorio remoto)"]

    WD -->|"git add"| SA
    SA -->|"git commit"| LR
    LR -->|"git push"| RR
    RR -->|"git pull"| WD
    RR -->|"git fetch"| LR

    style WD fill:#fef3c7,stroke:#f59e0b,color:#92400e
    style SA fill:#dbeafe,stroke:#3b82f6,color:#1e40af
    style LR fill:#dcfce7,stroke:#22c55e,color:#166534
    style RR fill:#f3e8ff,stroke:#a855f7,color:#6b21a8
</div>
<ol>
<li><strong>Working Directory</strong> — Los archivos que ves y editas en tu editor</li>
<li><strong>Staging Area</strong> — Los cambios que has marcado para incluir en el próximo commit</li>
<li><strong>Local Repository</strong> — El historial completo de commits en tu máquina</li>
<li><strong>Remote Repository</strong> — La copia en el servidor (GitHub, GitLab, etc.)</li>
</ol>
<hr>
<h2 id="configuración-inicial" style="position:relative;"><a href="#configuraci%C3%B3n-inicial" aria-label="configuración inicial permalink" class="anchor before"><svg aria-hidden="true" focusable="false" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Configuración inicial</h2>
<p>Antes de empezar, configura tu identidad:</p>
<div class="gatsby-highlight" data-language="bash"><pre class="language-bash"><code class="language-bash"><span class="token comment"># Configurar nombre y email (obligatorio para commits)</span>
<span class="token function">git</span> config <span class="token parameter variable">--global</span> user.name <span class="token string">"Tu Nombre"</span>
<span class="token function">git</span> config <span class="token parameter variable">--global</span> user.email <span class="token string">"tu@email.com"</span>

<span class="token comment"># Ver la configuración actual</span>
<span class="token function">git</span> config <span class="token parameter variable">--list</span>

<span class="token comment"># Configurar el editor por defecto</span>
<span class="token function">git</span> config <span class="token parameter variable">--global</span> core.editor <span class="token string">"code --wait"</span></code></pre></div>
<hr>
<h2 id="crear-y-clonar-repositorios" style="position:relative;"><a href="#crear-y-clonar-repositorios" aria-label="crear y clonar repositorios permalink" class="anchor before"><svg aria-hidden="true" focusable="false" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Crear y clonar repositorios</h2>
<div class="gatsby-highlight" data-language="bash"><pre class="language-bash"><code class="language-bash"><span class="token comment"># Inicializar un repositorio nuevo en el directorio actual</span>
<span class="token function">git</span> init

<span class="token comment"># Clonar un repositorio existente</span>
<span class="token function">git</span> clone https://github.com/usuario/proyecto.git

<span class="token comment"># Clonar en un directorio específico</span>
<span class="token function">git</span> clone https://github.com/usuario/proyecto.git mi-proyecto</code></pre></div>
<hr>
<h2 id="el-ciclo-básico-add-commit-push" style="position:relative;"><a href="#el-ciclo-b%C3%A1sico-add-commit-push" aria-label="el ciclo básico add commit push permalink" class="anchor before"><svg aria-hidden="true" focusable="false" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>El ciclo básico: add, commit, push</h2>
<p>Este es el flujo que usarás el 90% del tiempo:</p>
<div class="mermaid">
sequenceDiagram
    participant D as 📁 Directorio
    participant S as 📋 Staging
    participant R as 📦 Repo Local
    participant G as ☁️ GitHub

    Note over D: Editas archivos
    D->>S: git add archivo.js
    Note over S: Cambios preparados
    S->>R: git commit -m "mensaje"
    Note over R: Cambios guardados localmente
    R->>G: git push
    Note over G: Cambios en el remoto
</div>
<h3 id="git-status--ver-el-estado-actual" style="position:relative;"><a href="#git-status--ver-el-estado-actual" aria-label="git status  ver el estado actual permalink" class="anchor before"><svg aria-hidden="true" focusable="false" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>git status — Ver el estado actual</h3>
<div class="gatsby-highlight" data-language="bash"><pre class="language-bash"><code class="language-bash"><span class="token comment"># Muestra archivos modificados, en staging y sin rastrear</span>
<span class="token function">git</span> status

<span class="token comment"># Versión compacta</span>
<span class="token function">git</span> status <span class="token parameter variable">-s</span></code></pre></div>
<p>La salida te muestra:</p>
<ul>
<li><strong>Rojo</strong> — Archivos modificados o nuevos que NO están en staging</li>
<li><strong>Verde</strong> — Archivos en staging, listos para commit</li>
</ul>
<h3 id="git-add--preparar-cambios" style="position:relative;"><a href="#git-add--preparar-cambios" aria-label="git add  preparar cambios permalink" class="anchor before"><svg aria-hidden="true" focusable="false" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>git add — Preparar cambios</h3>
<div class="gatsby-highlight" data-language="bash"><pre class="language-bash"><code class="language-bash"><span class="token comment"># Añadir un archivo específico</span>
<span class="token function">git</span> <span class="token function">add</span> index.html

<span class="token comment"># Añadir varios archivos</span>
<span class="token function">git</span> <span class="token function">add</span> index.html style.css app.js

<span class="token comment"># Añadir todos los archivos modificados</span>
<span class="token function">git</span> <span class="token function">add</span> <span class="token builtin class-name">.</span>

<span class="token comment"># Añadir solo archivos con cierta extensión</span>
<span class="token function">git</span> <span class="token function">add</span> *.js</code></pre></div>
<h3 id="git-commit--guardar-cambios" style="position:relative;"><a href="#git-commit--guardar-cambios" aria-label="git commit  guardar cambios permalink" class="anchor before"><svg aria-hidden="true" focusable="false" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>git commit — Guardar cambios</h3>
<div class="gatsby-highlight" data-language="bash"><pre class="language-bash"><code class="language-bash"><span class="token comment"># Commit con mensaje inline</span>
<span class="token function">git</span> commit <span class="token parameter variable">-m</span> <span class="token string">"Añadir página de contacto"</span>

<span class="token comment"># Commit con mensaje multilínea</span>
<span class="token function">git</span> commit <span class="token parameter variable">-m</span> <span class="token string">"Añadir página de contacto

- Crear formulario con validación
- Añadir estilos responsive
- Integrar con API de email"</span>

<span class="token comment"># Añadir al staging y hacer commit en un paso (solo archivos ya rastreados)</span>
<span class="token function">git</span> commit <span class="token parameter variable">-am</span> <span class="token string">"Corregir bug en el formulario"</span></code></pre></div>
<blockquote>
<p><strong>Buenas prácticas para mensajes de commit:</strong></p>
<ul>
<li>Usa imperativo: "Añadir feature" en vez de "Añadida feature"</li>
<li>Primera línea: máximo 50 caracteres</li>
<li>Si necesitas más detalle, deja una línea en blanco y añade el cuerpo</li>
</ul>
</blockquote>
<h3 id="git-push--subir-cambios-al-remoto" style="position:relative;"><a href="#git-push--subir-cambios-al-remoto" aria-label="git push  subir cambios al remoto permalink" class="anchor before"><svg aria-hidden="true" focusable="false" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>git push — Subir cambios al remoto</h3>
<div class="gatsby-highlight" data-language="bash"><pre class="language-bash"><code class="language-bash"><span class="token comment"># Subir la rama actual</span>
<span class="token function">git</span> push

<span class="token comment"># Subir y vincular la rama al remoto</span>
<span class="token function">git</span> push <span class="token parameter variable">-u</span> origin main

<span class="token comment"># Subir una rama específica</span>
<span class="token function">git</span> push origin mi-feature</code></pre></div>
<h3 id="git-pull--descargar-cambios-del-remoto" style="position:relative;"><a href="#git-pull--descargar-cambios-del-remoto" aria-label="git pull  descargar cambios del remoto permalink" class="anchor before"><svg aria-hidden="true" focusable="false" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>git pull — Descargar cambios del remoto</h3>
<div class="gatsby-highlight" data-language="bash"><pre class="language-bash"><code class="language-bash"><span class="token comment"># Descargar y fusionar cambios</span>
<span class="token function">git</span> pull

<span class="token comment"># Equivalente a:</span>
<span class="token function">git</span> fetch + <span class="token function">git</span> merge

<span class="token comment"># Pull con rebase (historial más limpio)</span>
<span class="token function">git</span> pull <span class="token parameter variable">--rebase</span></code></pre></div>
<hr>
<h2 id="ramas-branches" style="position:relative;"><a href="#ramas-branches" aria-label="ramas branches permalink" class="anchor before"><svg aria-hidden="true" focusable="false" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Ramas (branches)</h2>
<p>Las ramas son la herramienta más poderosa de Git. Te permiten trabajar en features, fixes o experimentos de forma aislada.</p>
<div class="mermaid">
gitGraph
    commit id: "v1.0"
    commit id: "Setup"
    branch feature/login
    commit id: "Formulario"
    commit id: "Validación"
    checkout main
    commit id: "Hotfix"
    merge feature/login id: "Merge login"
    commit id: "v1.1"
</div>
<h3 id="comandos-de-ramas" style="position:relative;"><a href="#comandos-de-ramas" aria-label="comandos de ramas permalink" class="anchor before"><svg aria-hidden="true" focusable="false" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Comandos de ramas</h3>
<div class="gatsby-highlight" data-language="bash"><pre class="language-bash"><code class="language-bash"><span class="token comment"># Ver todas las ramas locales</span>
<span class="token function">git</span> branch

<span class="token comment"># Ver ramas locales y remotas</span>
<span class="token function">git</span> branch <span class="token parameter variable">-a</span>

<span class="token comment"># Crear una rama nueva</span>
<span class="token function">git</span> branch feature/login

<span class="token comment"># Crear y cambiar a la nueva rama</span>
<span class="token function">git</span> checkout <span class="token parameter variable">-b</span> feature/login
<span class="token comment"># o con el comando más moderno:</span>
<span class="token function">git</span> switch <span class="token parameter variable">-c</span> feature/login

<span class="token comment"># Cambiar de rama</span>
<span class="token function">git</span> checkout main
<span class="token comment"># o:</span>
<span class="token function">git</span> switch main

<span class="token comment"># Eliminar una rama (ya mergeada)</span>
<span class="token function">git</span> branch <span class="token parameter variable">-d</span> feature/login

<span class="token comment"># Eliminar una rama (forzar)</span>
<span class="token function">git</span> branch <span class="token parameter variable">-D</span> feature/experimental

<span class="token comment"># Renombrar la rama actual</span>
<span class="token function">git</span> branch <span class="token parameter variable">-m</span> nuevo-nombre</code></pre></div>
<hr>
<h2 id="merge--fusionar-ramas" style="position:relative;"><a href="#merge--fusionar-ramas" aria-label="merge  fusionar ramas permalink" class="anchor before"><svg aria-hidden="true" focusable="false" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Merge — Fusionar ramas</h2>
<p>El merge combina los cambios de una rama en otra.</p>
<div class="mermaid">
gitGraph
    commit id: "A"
    commit id: "B"
    branch feature
    commit id: "C"
    commit id: "D"
    checkout main
    commit id: "E"
    merge feature id: "Merge commit"
    commit id: "F"
</div>
<div class="gatsby-highlight" data-language="bash"><pre class="language-bash"><code class="language-bash"><span class="token comment"># Primero, cambia a la rama destino</span>
<span class="token function">git</span> checkout main

<span class="token comment"># Fusionar una rama en la actual</span>
<span class="token function">git</span> merge feature/login

<span class="token comment"># Merge sin fast-forward (siempre crea un commit de merge)</span>
<span class="token function">git</span> merge --no-ff feature/login</code></pre></div>
<h3 id="resolver-conflictos-de-merge" style="position:relative;"><a href="#resolver-conflictos-de-merge" aria-label="resolver conflictos de merge permalink" class="anchor before"><svg aria-hidden="true" focusable="false" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Resolver conflictos de merge</h3>
<p>Cuando dos ramas modifican las mismas líneas, Git no puede decidir cuál mantener y marca un <strong>conflicto</strong>:</p>
<div class="gatsby-highlight" data-language="text"><pre class="language-text"><code class="language-text">&lt;&lt;&lt;&lt;&lt;&lt;&lt; HEAD
const color = "azul";
=======
const color = "rojo";
>>>>>>> feature/tema</code></pre></div>
<p>Para resolverlo:</p>
<ol>
<li>Abre el archivo y elige qué código mantener</li>
<li>Elimina los marcadores (<code>&#x3C;&#x3C;&#x3C;&#x3C;&#x3C;&#x3C;&#x3C;</code>, <code>=======</code>, <code>>>>>>>></code>)</li>
<li>Haz <code>git add</code> del archivo resuelto</li>
<li>Haz <code>git commit</code> para completar el merge</li>
</ol>
<hr>
<h2 id="rebase--reescribir-el-historial" style="position:relative;"><a href="#rebase--reescribir-el-historial" aria-label="rebase  reescribir el historial permalink" class="anchor before"><svg aria-hidden="true" focusable="false" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Rebase — Reescribir el historial</h2>
<p>El rebase mueve tus commits al final de otra rama, creando un historial lineal y más limpio.</p>
<div class="mermaid">
sequenceDiagram
    participant M as main
    participant F as feature

    Note over M,F: Antes del rebase
    Note over M: A → B → E
    Note over F: A → B → C → D

    Note over M,F: Después de git rebase main (en feature)
    Note over M: A → B → E
    Note over F: A → B → E → C' → D'
    Note over F: Los commits C y D se "reaplican" sobre E
</div>
<div class="gatsby-highlight" data-language="bash"><pre class="language-bash"><code class="language-bash"><span class="token comment"># Estando en la rama feature:</span>
<span class="token function">git</span> rebase main

<span class="token comment"># Si hay conflictos, resuélvelos y continúa:</span>
<span class="token function">git</span> <span class="token function">add</span> <span class="token builtin class-name">.</span>
<span class="token function">git</span> rebase <span class="token parameter variable">--continue</span>

<span class="token comment"># Cancelar un rebase en progreso:</span>
<span class="token function">git</span> rebase <span class="token parameter variable">--abort</span></code></pre></div>
<blockquote>
<p><strong>Merge vs Rebase:</strong> Usa merge para ramas compartidas (preserva la historia real). Usa rebase para ramas locales de trabajo (historial más limpio). <strong>Nunca hagas rebase de ramas que ya están en el remoto y otros usan.</strong></p>
</blockquote>
<hr>
<h2 id="inspeccionar-el-historial" style="position:relative;"><a href="#inspeccionar-el-historial" aria-label="inspeccionar el historial permalink" class="anchor before"><svg aria-hidden="true" focusable="false" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Inspeccionar el historial</h2>
<div class="gatsby-highlight" data-language="bash"><pre class="language-bash"><code class="language-bash"><span class="token comment"># Ver el log de commits</span>
<span class="token function">git</span> log

<span class="token comment"># Log compacto en una línea</span>
<span class="token function">git</span> log <span class="token parameter variable">--oneline</span>

<span class="token comment"># Log con gráfico de ramas</span>
<span class="token function">git</span> log <span class="token parameter variable">--oneline</span> <span class="token parameter variable">--graph</span> <span class="token parameter variable">--all</span>

<span class="token comment"># Ver los cambios de un commit específico</span>
<span class="token function">git</span> show abc1234

<span class="token comment"># Ver diferencias entre el working directory y el staging</span>
<span class="token function">git</span> <span class="token function">diff</span>

<span class="token comment"># Ver diferencias en el staging (lo que va en el próximo commit)</span>
<span class="token function">git</span> <span class="token function">diff</span> <span class="token parameter variable">--staged</span>

<span class="token comment"># Ver diferencias entre dos ramas</span>
<span class="token function">git</span> <span class="token function">diff</span> main<span class="token punctuation">..</span>feature/login</code></pre></div>
<hr>
<h2 id="deshacer-cambios" style="position:relative;"><a href="#deshacer-cambios" aria-label="deshacer cambios permalink" class="anchor before"><svg aria-hidden="true" focusable="false" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Deshacer cambios</h2>
<div class="mermaid">
flowchart TD
    A{"¿Qué quieres deshacer?"}
    B["Cambios en el\nworking directory"]
    C["Cambios en el\nstaging area"]
    D["Un commit ya hecho"]
    E["git checkout -- archivo\ngit restore archivo"]
    F["git reset HEAD archivo\ngit restore --staged archivo"]
    G["git revert abc1234"]

    A --> B
    A --> C
    A --> D
    B --> E
    C --> F
    D --> G

    style A fill:#fef3c7,stroke:#f59e0b,color:#92400e
    style E fill:#dcfce7,stroke:#22c55e,color:#166534
    style F fill:#dbeafe,stroke:#3b82f6,color:#1e40af
    style G fill:#f3e8ff,stroke:#a855f7,color:#6b21a8
</div>
<div class="gatsby-highlight" data-language="bash"><pre class="language-bash"><code class="language-bash"><span class="token comment"># Descartar cambios en un archivo (volver a la versión del último commit)</span>
<span class="token function">git</span> restore archivo.js

<span class="token comment"># Quitar un archivo del staging (pero mantener los cambios)</span>
<span class="token function">git</span> restore <span class="token parameter variable">--staged</span> archivo.js

<span class="token comment"># Revertir un commit (crea un nuevo commit que deshace los cambios)</span>
<span class="token function">git</span> revert abc1234

<span class="token comment"># Volver a un commit anterior (mantiene los cambios en working directory)</span>
<span class="token function">git</span> reset <span class="token parameter variable">--soft</span> abc1234

<span class="token comment"># Volver a un commit anterior (descarta todos los cambios)</span>
<span class="token function">git</span> reset <span class="token parameter variable">--hard</span> abc1234</code></pre></div>
<blockquote>
<p><strong>Cuidado con <code>git reset --hard</code></strong>: elimina cambios de forma irreversible. Úsalo solo si estás seguro de que no necesitas esos cambios.</p>
</blockquote>
<hr>
<h2 id="stash--guardar-cambios-temporalmente" style="position:relative;"><a href="#stash--guardar-cambios-temporalmente" aria-label="stash  guardar cambios temporalmente permalink" class="anchor before"><svg aria-hidden="true" focusable="false" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Stash — Guardar cambios temporalmente</h2>
<p>El stash te permite guardar cambios sin hacer commit, ideal para cuando necesitas cambiar de rama rápidamente.</p>
<div class="gatsby-highlight" data-language="bash"><pre class="language-bash"><code class="language-bash"><span class="token comment"># Guardar cambios actuales en el stash</span>
<span class="token function">git</span> stash

<span class="token comment"># Guardar con un mensaje descriptivo</span>
<span class="token function">git</span> stash save <span class="token string">"WIP: formulario de registro"</span>

<span class="token comment"># Ver la lista de stashes</span>
<span class="token function">git</span> stash list

<span class="token comment"># Recuperar el último stash (y eliminarlo del stash)</span>
<span class="token function">git</span> stash pop

<span class="token comment"># Recuperar un stash específico</span>
<span class="token function">git</span> stash apply stash@<span class="token punctuation">{</span><span class="token number">2</span><span class="token punctuation">}</span>

<span class="token comment"># Eliminar un stash</span>
<span class="token function">git</span> stash drop stash@<span class="token punctuation">{</span><span class="token number">0</span><span class="token punctuation">}</span></code></pre></div>
<hr>
<h2 id="flujo-de-trabajo-con-git" style="position:relative;"><a href="#flujo-de-trabajo-con-git" aria-label="flujo de trabajo con git permalink" class="anchor before"><svg aria-hidden="true" focusable="false" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Flujo de trabajo con Git</h2>
<p>Un flujo de trabajo típico para trabajar en equipo:</p>
<div class="mermaid">
flowchart TD
    A["1. git pull origin main\nActualizar rama principal"] --> B["2. git checkout -b feature/nueva\nCrear rama para la feature"]
    B --> C["3. Escribir código\nHacer cambios"]
    C --> D["4. git add . + git commit\nGuardar cambios"]
    D --> E{"¿Feature\nterminada?"}
    E -->|No| C
    E -->|Sí| F["5. git push -u origin feature/nueva\nSubir la rama"]
    F --> G["6. Crear Pull Request\nen GitHub"]
    G --> H["7. Code Review\nRevisión por el equipo"]
    H --> I["8. Merge a main\nFusionar los cambios"]

    style A fill:#dbeafe,stroke:#3b82f6,color:#1e40af
    style B fill:#fef3c7,stroke:#f59e0b,color:#92400e
    style D fill:#dcfce7,stroke:#22c55e,color:#166534
    style F fill:#f3e8ff,stroke:#a855f7,color:#6b21a8
    style G fill:#fce7f3,stroke:#ec4899,color:#9d174d
    style I fill:#dcfce7,stroke:#22c55e,color:#166534
</div>
<hr>
<h2 id="resumen-de-comandos" style="position:relative;"><a href="#resumen-de-comandos" aria-label="resumen de comandos permalink" class="anchor before"><svg aria-hidden="true" focusable="false" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Resumen de comandos</h2>
<table>
<thead>
<tr>
<th>Comando</th>
<th>Descripción</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>git init</code></td>
<td>Inicializar un repositorio</td>
</tr>
<tr>
<td><code>git clone url</code></td>
<td>Clonar un repositorio</td>
</tr>
<tr>
<td><code>git status</code></td>
<td>Ver estado de los archivos</td>
</tr>
<tr>
<td><code>git add archivo</code></td>
<td>Añadir al staging</td>
</tr>
<tr>
<td><code>git commit -m "msg"</code></td>
<td>Guardar cambios</td>
</tr>
<tr>
<td><code>git push</code></td>
<td>Subir al remoto</td>
</tr>
<tr>
<td><code>git pull</code></td>
<td>Descargar del remoto</td>
</tr>
<tr>
<td><code>git branch nombre</code></td>
<td>Crear rama</td>
</tr>
<tr>
<td><code>git checkout -b rama</code></td>
<td>Crear y cambiar de rama</td>
</tr>
<tr>
<td><code>git merge rama</code></td>
<td>Fusionar una rama</td>
</tr>
<tr>
<td><code>git rebase rama</code></td>
<td>Rebase sobre otra rama</td>
</tr>
<tr>
<td><code>git log --oneline</code></td>
<td>Ver historial compacto</td>
</tr>
<tr>
<td><code>git stash</code></td>
<td>Guardar cambios temporales</td>
</tr>
<tr>
<td><code>git diff</code></td>
<td>Ver diferencias</td>
</tr>
<tr>
<td><code>git restore archivo</code></td>
<td>Descartar cambios</td>
</tr>
<tr>
<td><code>git revert hash</code></td>
<td>Revertir un commit</td>
</tr>
</tbody>
</table>
<hr>
<h2 id="conclusión" style="position:relative;"><a href="#conclusi%C3%B3n" aria-label="conclusión permalink" class="anchor before"><svg aria-hidden="true" focusable="false" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Conclusión</h2>
<p>Git puede parecer intimidante al principio, pero con práctica estos comandos se vuelven naturales. Lo más importante es entender el flujo: <strong>editar → preparar (add) → guardar (commit) → compartir (push)</strong>. Una vez que domines este ciclo básico, las ramas, merges y rebases se convertirán en herramientas que usarás sin pensar.</p>
<p>El mejor consejo: no tengas miedo de experimentar. Mientras no hagas <code>push</code>, tus cambios son locales y puedes deshacerlos fácilmente. Crea un repositorio de prueba y practica con todos estos comandos.</p>
<p>¡Happy coding!</p>]]></content:encoded>
    </item>
    <item>
      <title>Seguridad de Contraseñas - Cómo se hackean y cómo protegerte</title>
      <link>https://girgetto.it/password-seguridad/</link>
      <guid isPermaLink="true">https://girgetto.it/password-seguridad/</guid>
      <pubDate>Thu, 19 Mar 2026 00:00:00 GMT</pubDate>
      <description>Aprende cómo funcionan los ataques de fuerza bruta, cuánto tiempo tarda en crackearse tu contraseña según su longitud, y qué técnicas usan los hackers para robar credenciales. Incluye consejos prácticos para crear contraseñas seguras.</description>
      <dc:language>es</dc:language>
      <category>security</category>
      <content:encoded><![CDATA[<h2 id="por-qué-importa-la-seguridad-de-tu-contraseña" style="position:relative;"><a href="#por-qu%C3%A9-importa-la-seguridad-de-tu-contrase%C3%B1a" aria-label="por qué importa la seguridad de tu contraseña permalink" class="anchor before"><svg aria-hidden="true" focusable="false" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>¿Por qué importa la seguridad de tu contraseña?</h2>
<p>En el mundo digital actual, tu contraseña es la primera —y a veces única— barrera entre tus datos y un atacante. Cada año millones de cuentas son comprometidas no por exploits sofisticados, sino simplemente porque las contraseñas son débiles o reutilizadas.</p>
<p>Entender cómo funcionan los ataques te ayuda a defenderte mejor.</p>
<hr>
<h2 id="qué-es-un-ataque-de-fuerza-bruta" style="position:relative;"><a href="#qu%C3%A9-es-un-ataque-de-fuerza-bruta" aria-label="qué es un ataque de fuerza bruta permalink" class="anchor before"><svg aria-hidden="true" focusable="false" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>¿Qué es un ataque de Fuerza Bruta?</h2>
<p>Un <strong>ataque de fuerza bruta</strong> (brute force) consiste en probar sistemáticamente todas las combinaciones posibles de caracteres hasta encontrar la contraseña correcta.</p>
<p>Es el método más básico, pero con hardware moderno (GPUs, clusters distribuidos) resulta devastadoramente efectivo contra contraseñas cortas o simples.</p>
<h3 id="variantes-del-ataque" style="position:relative;"><a href="#variantes-del-ataque" aria-label="variantes del ataque permalink" class="anchor before"><svg aria-hidden="true" focusable="false" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Variantes del ataque</h3>
<table>
<thead>
<tr>
<th>Tipo</th>
<th>Descripción</th>
</tr>
</thead>
<tbody>
<tr>
<td><strong>Fuerza bruta pura</strong></td>
<td>Prueba todas las combinaciones posibles</td>
</tr>
<tr>
<td><strong>Diccionario</strong></td>
<td>Usa listas de palabras comunes y contraseñas filtradas</td>
</tr>
<tr>
<td><strong>Híbrido</strong></td>
<td>Combina palabras de diccionario con números y símbolos</td>
</tr>
<tr>
<td><strong>Rainbow tables</strong></td>
<td>Tablas precomputadas de hashes para acelerar el crackeo</td>
</tr>
<tr>
<td><strong>Credential stuffing</strong></td>
<td>Usa credenciales robadas de otras brechas de datos</td>
</tr>
</tbody>
</table>
<hr>
<h2 id="tiempo-para-crackear-una-contraseña-según-su-longitud" style="position:relative;"><a href="#tiempo-para-crackear-una-contrase%C3%B1a-seg%C3%BAn-su-longitud" aria-label="tiempo para crackear una contraseña según su longitud permalink" class="anchor before"><svg aria-hidden="true" focusable="false" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Tiempo para crackear una contraseña según su longitud</h2>
<p>El tiempo varía drásticamente según la longitud y los tipos de caracteres usados. La siguiente tabla asume un ataque offline con hardware moderno (~100 mil millones de intentos por segundo con GPU):</p>
<h3 id="solo-letras-minúsculas-26-caracteres" style="position:relative;"><a href="#solo-letras-min%C3%BAsculas-26-caracteres" aria-label="solo letras minúsculas 26 caracteres permalink" class="anchor before"><svg aria-hidden="true" focusable="false" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Solo letras minúsculas (26 caracteres)</h3>
<table>
<thead>
<tr>
<th>Longitud</th>
<th>Combinaciones posibles</th>
<th>Tiempo estimado</th>
</tr>
</thead>
<tbody>
<tr>
<td>4 caracteres</td>
<td>456,976</td>
<td>Instantáneo</td>
</tr>
<tr>
<td>6 caracteres</td>
<td>308,915,776</td>
<td>&#x3C; 1 segundo</td>
</tr>
<tr>
<td>8 caracteres</td>
<td>~208 mil millones</td>
<td>~2 segundos</td>
</tr>
<tr>
<td>10 caracteres</td>
<td>~141 billones</td>
<td>~24 minutos</td>
</tr>
<tr>
<td>12 caracteres</td>
<td>~95 cuatrillones</td>
<td>~11 días</td>
</tr>
<tr>
<td>16 caracteres</td>
<td>~43 septillones</td>
<td>~14 millones de años</td>
</tr>
</tbody>
</table>
<h3 id="letras-minúsculas--mayúsculas--números-62-caracteres" style="position:relative;"><a href="#letras-min%C3%BAsculas--may%C3%BAsculas--n%C3%BAmeros-62-caracteres" aria-label="letras minúsculas  mayúsculas  números 62 caracteres permalink" class="anchor before"><svg aria-hidden="true" focusable="false" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Letras minúsculas + mayúsculas + números (62 caracteres)</h3>
<table>
<thead>
<tr>
<th>Longitud</th>
<th>Combinaciones posibles</th>
<th>Tiempo estimado</th>
</tr>
</thead>
<tbody>
<tr>
<td>6 caracteres</td>
<td>~56 mil millones</td>
<td>&#x3C; 1 segundo</td>
</tr>
<tr>
<td>8 caracteres</td>
<td>~218 billones</td>
<td>~37 minutos</td>
</tr>
<tr>
<td>10 caracteres</td>
<td>~839 cuatrillones</td>
<td>~96 días</td>
</tr>
<tr>
<td>12 caracteres</td>
<td>~3.2 sextillones</td>
<td>~1,000 años</td>
</tr>
<tr>
<td>16 caracteres</td>
<td>~4.7 nonillones</td>
<td>Prácticamente imposible</td>
</tr>
</tbody>
</table>
<h3 id="letras--números--símbolos-especiales-95-caracteres" style="position:relative;"><a href="#letras--n%C3%BAmeros--s%C3%ADmbolos-especiales-95-caracteres" aria-label="letras  números  símbolos especiales 95 caracteres permalink" class="anchor before"><svg aria-hidden="true" focusable="false" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Letras + números + símbolos especiales (~95 caracteres)</h3>
<table>
<thead>
<tr>
<th>Longitud</th>
<th>Combinaciones posibles</th>
<th>Tiempo estimado</th>
</tr>
</thead>
<tbody>
<tr>
<td>6 caracteres</td>
<td>~735 mil millones</td>
<td>~7 segundos</td>
</tr>
<tr>
<td>8 caracteres</td>
<td>~6.6 cuatrillones</td>
<td>~19 horas</td>
</tr>
<tr>
<td>10 caracteres</td>
<td>~5.9 sextillones</td>
<td>~1,900 años</td>
</tr>
<tr>
<td>12 caracteres</td>
<td>~540 octillones</td>
<td>~171 millones de años</td>
</tr>
</tbody>
</table>
<blockquote>
<p><strong>Conclusión clave:</strong> cada carácter adicional multiplica exponencialmente el tiempo de crackeo. La longitud es tu mejor aliada.</p>
</blockquote>
<hr>
<h2 id="métodos-más-comunes-para-robar-contraseñas" style="position:relative;"><a href="#m%C3%A9todos-m%C3%A1s-comunes-para-robar-contrase%C3%B1as" aria-label="métodos más comunes para robar contraseñas permalink" class="anchor before"><svg aria-hidden="true" focusable="false" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Métodos más comunes para robar contraseñas</h2>
<h3 id="1-phishing" style="position:relative;"><a href="#1-phishing" aria-label="1 phishing permalink" class="anchor before"><svg aria-hidden="true" focusable="false" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>1. Phishing</h3>
<p>El atacante crea una página falsa idéntica a la real (banco, red social, email) y te engaña para que introduzcas tus credenciales. Es el método <strong>#1 más usado</strong> porque no requiere potencia computacional, solo engañarte a ti.</p>
<p><strong>Señales de alerta:</strong></p>
<ul>
<li>URL diferente al dominio oficial</li>
<li>Emails urgentes con enlaces sospechosos</li>
<li>Certificado SSL ausente o incorrecto</li>
</ul>
<h3 id="2-filtraciones-de-bases-de-datos-data-breaches" style="position:relative;"><a href="#2-filtraciones-de-bases-de-datos-data-breaches" aria-label="2 filtraciones de bases de datos data breaches permalink" class="anchor before"><svg aria-hidden="true" focusable="false" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>2. Filtraciones de bases de datos (Data Breaches)</h3>
<p>Cuando un servicio web es hackeado, los atacantes obtienen la base de datos de usuarios con contraseñas (muchas veces en texto plano o con hashes débiles). Estas listas se venden en la dark web.</p>
<p>Puedes comprobar si tu email ha sido filtrado en <a href="https://haveibeenpwned.com">haveibeenpwned.com</a>.</p>
<h3 id="3-keyloggers" style="position:relative;"><a href="#3-keyloggers" aria-label="3 keyloggers permalink" class="anchor before"><svg aria-hidden="true" focusable="false" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>3. Keyloggers</h3>
<p>Software malicioso que registra todo lo que escribes en el teclado, capturando contraseñas en tiempo real sin que lo notes.</p>
<h3 id="4-man-in-the-middle-mitm" style="position:relative;"><a href="#4-man-in-the-middle-mitm" aria-label="4 man in the middle mitm permalink" class="anchor before"><svg aria-hidden="true" focusable="false" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>4. Man-in-the-Middle (MitM)</h3>
<p>El atacante se interpone en la comunicación entre tú y el servidor, interceptando datos en redes WiFi públicas no seguras.</p>
<h3 id="5-ingeniería-social" style="position:relative;"><a href="#5-ingenier%C3%ADa-social" aria-label="5 ingeniería social permalink" class="anchor before"><svg aria-hidden="true" focusable="false" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>5. Ingeniería Social</h3>
<p>Manipulación psicológica para obtener la contraseña directamente: haciéndose pasar por soporte técnico, compañeros de trabajo, o entidades de confianza.</p>
<h3 id="6-password-spraying" style="position:relative;"><a href="#6-password-spraying" aria-label="6 password spraying permalink" class="anchor before"><svg aria-hidden="true" focusable="false" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>6. Password Spraying</h3>
<p>En lugar de probar miles de contraseñas para un usuario, prueba una misma contraseña común (<code>123456</code>, <code>password</code>) contra miles de cuentas. Evita los bloqueos por intentos fallidos.</p>
<hr>
<h2 id="qué-hace-débil-a-una-contraseña" style="position:relative;"><a href="#qu%C3%A9-hace-d%C3%A9bil-a-una-contrase%C3%B1a" aria-label="qué hace débil a una contraseña permalink" class="anchor before"><svg aria-hidden="true" focusable="false" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>¿Qué hace débil a una contraseña?</h2>
<ul>
<li><strong>Corta</strong> (menos de 8 caracteres)</li>
<li><strong>Solo letras minúsculas</strong> o solo números</li>
<li><strong>Palabras del diccionario</strong>: <code>dragon</code>, <code>sunshine</code>, <code>football</code></li>
<li><strong>Patrones predecibles</strong>: <code>123456</code>, <code>qwerty</code>, <code>abcdef</code></li>
<li><strong>Información personal</strong>: nombre, fecha de nacimiento, nombre de mascota</li>
<li><strong>Reutilización</strong> en múltiples sitios (si una cae, caen todas)</li>
</ul>
<hr>
<h2 id="buenas-prácticas-para-contraseñas-seguras" style="position:relative;"><a href="#buenas-pr%C3%A1cticas-para-contrase%C3%B1as-seguras" aria-label="buenas prácticas para contraseñas seguras permalink" class="anchor before"><svg aria-hidden="true" focusable="false" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Buenas prácticas para contraseñas seguras</h2>
<h3 id="reglas-de-oro" style="position:relative;"><a href="#reglas-de-oro" aria-label="reglas de oro permalink" class="anchor before"><svg aria-hidden="true" focusable="false" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Reglas de oro</h3>
<ol>
<li><strong>Mínimo 12 caracteres</strong> — preferiblemente 16 o más</li>
<li><strong>Mezcla</strong> letras mayúsculas, minúsculas, números y símbolos</li>
<li><strong>Nunca reutilices</strong> la misma contraseña en distintos servicios</li>
<li><strong>Usa un gestor de contraseñas</strong> (Bitwarden, 1Password, KeePass)</li>
<li><strong>Activa el 2FA</strong> (autenticación en dos factores) siempre que sea posible</li>
<li><strong>Cambia contraseñas</strong> si sospechas que han sido comprometidas</li>
</ol>
<h3 id="frase-o-contraseña" style="position:relative;"><a href="#frase-o-contrase%C3%B1a" aria-label="frase o contraseña permalink" class="anchor before"><svg aria-hidden="true" focusable="false" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>¿Frase o contraseña?</h3>
<p>Una <strong>frase de contraseña</strong> (passphrase) puede ser más segura Y más fácil de recordar:</p>
<div class="gatsby-highlight" data-language="text"><pre class="language-text"><code class="language-text">correctocaballobateríaclip   ← 28 caracteres, fácil de recordar</code></pre></div>
<p>vs.</p>
<div class="gatsby-highlight" data-language="text"><pre class="language-text"><code class="language-text">X9#mK2!p   ← 8 caracteres, difícil de recordar y relativamente débil</code></pre></div>
<hr>
<h2 id="herramientas-para-generar-contraseñas-seguras" style="position:relative;"><a href="#herramientas-para-generar-contrase%C3%B1as-seguras" aria-label="herramientas para generar contraseñas seguras permalink" class="anchor before"><svg aria-hidden="true" focusable="false" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Herramientas para generar contraseñas seguras</h2>
<p>Generar contraseñas fuertes manualmente es tedioso y propenso a errores. Lo mejor es usar un <strong>generador de contraseñas</strong>.</p>
<p>En <strong>girgetto.it</strong> tenemos un generador gratuito donde puedes crear contraseñas seguras con la longitud y complejidad que necesites:</p>
<h3 id="generador-de-contraseñas-seguras---girgettoit" style="position:relative;"><a href="#generador-de-contrase%C3%B1as-seguras---girgettoit" aria-label="generador de contraseñas seguras   girgettoit permalink" class="anchor before"><svg aria-hidden="true" focusable="false" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a><a href="https://girgetto.it/apps/password-generator/">Generador de Contraseñas Seguras - girgetto.it</a></h3>
<p>Con él puedes:</p>
<ul>
<li>Elegir la <strong>longitud</strong> de la contraseña</li>
<li>Incluir o excluir <strong>mayúsculas, números y símbolos</strong></li>
<li>Generar contraseñas <strong>aleatorias y criptográficamente seguras</strong></li>
<li>Copiar con un solo clic</li>
</ul>
<hr>
<h2 id="resumen-la-regla-de-los-3-ls" style="position:relative;"><a href="#resumen-la-regla-de-los-3-ls" aria-label="resumen la regla de los 3 ls permalink" class="anchor before"><svg aria-hidden="true" focusable="false" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Resumen: La regla de los 3 L's</h2>
<p><strong>Larga, Loca y Libre de repetición.</strong></p>
<ul>
<li><strong>Larga</strong>: mínimo 12 caracteres, mejor 16+</li>
<li><strong>Loca</strong>: combinación aleatoria de caracteres sin sentido predecible</li>
<li><strong>Libre de repetición</strong>: contraseña única para cada servicio</li>
</ul>
<p>Con estas tres reglas y un buen gestor de contraseñas, reduces drásticamente el riesgo de ser víctima de un ataque.</p>
<hr>
<p><em>La seguridad perfecta no existe, pero una buena contraseña es la diferencia entre ser un objetivo fácil y ser uno que no vale la pena atacar.</em></p>]]></content:encoded>
    </item>
    <item>
      <title>Rendering Methods Explained: CSR, SSR, SSG &amp; Hydration</title>
      <link>https://girgetto.it/en/rendering-methods/</link>
      <guid isPermaLink="true">https://girgetto.it/en/rendering-methods/</guid>
      <pubDate>Thu, 19 Mar 2026 00:00:00 GMT</pubDate>
      <description>A deep dive into the main frontend rendering strategies — Client-Side Rendering, Server-Side Rendering, Static Site Generation, and Hydration — with diagrams for each.</description>
      <dc:language>en</dc:language>
      <category>web</category>
      <content:encoded><![CDATA[<p>Modern frontend frameworks give developers several strategies for delivering content to the browser. Choosing the right one dramatically affects performance, SEO, and user experience. This post covers the four most important rendering methods — <strong>CSR</strong>, <strong>SSR</strong>, <strong>SSG</strong>, and <strong>Hydration</strong> — with a diagram for each.</p>
<hr>
<h2 id="client-side-rendering-csr" style="position:relative;"><a href="#client-side-rendering-csr" aria-label="client side rendering csr permalink" class="anchor before"><svg aria-hidden="true" focusable="false" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Client-Side Rendering (CSR)</h2>
<p>In CSR the browser downloads a minimal HTML shell and a JavaScript bundle. The JS then runs in the browser, fetches data, and constructs the full page on the client.</p>
<p><strong>Frameworks:</strong> React (CRA / Vite SPA), Vue (Vite SPA), Angular</p>
<div class="mermaid">
sequenceDiagram
    participant B as 🌐 Browser
    participant S as 🖥️ Server

    B->>S: GET /index.html
    S-->>B: Empty HTML ⟨div id="root"⟩⟨/div⟩
    B->>S: GET /bundle.js
    S-->>B: bundle.js (~500 KB)
    Note over B: JS executes — builds the DOM
    B->>S: fetch('/api/data')
    S-->>B: JSON data
    Note over B: UI fully rendered ✅
</div>
<h3 id="how-csr-works-step-by-step" style="position:relative;"><a href="#how-csr-works-step-by-step" aria-label="how csr works step by step permalink" class="anchor before"><svg aria-hidden="true" focusable="false" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>How CSR works step by step</h3>
<ol>
<li>Browser requests the page → server returns a nearly empty HTML file</li>
<li>Browser downloads the JavaScript bundle</li>
<li>JS runs in the browser and builds the DOM</li>
<li>Data is fetched from APIs and the UI is rendered</li>
</ol>
<blockquote>
<p><strong>⚠️ The page is completely blank until the JS bundle has downloaded and executed.</strong> This hurts both perceived performance and SEO crawlers that don't run JS.</p>
</blockquote>
<h3 id="pros-and-cons" style="position:relative;"><a href="#pros-and-cons" aria-label="pros and cons permalink" class="anchor before"><svg aria-hidden="true" focusable="false" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Pros and Cons</h3>
<table>
<thead>
<tr>
<th>✅ Pros</th>
<th>❌ Cons</th>
</tr>
</thead>
<tbody>
<tr>
<td>Rich, app-like interactions</td>
<td>Slow initial load (blank screen)</td>
</tr>
<tr>
<td>Low server load</td>
<td>Poor SEO out of the box</td>
</tr>
<tr>
<td>Simple deployment (static host)</td>
<td>Large JS bundles</td>
</tr>
<tr>
<td>Fast navigation after first load</td>
<td>Requires JS enabled</td>
</tr>
</tbody>
</table>
<blockquote>
<p><strong>Best for:</strong> Dashboards, admin panels, apps behind a login, real-time tools.</p>
</blockquote>
<hr>
<h2 id="server-side-rendering-ssr" style="position:relative;"><a href="#server-side-rendering-ssr" aria-label="server side rendering ssr permalink" class="anchor before"><svg aria-hidden="true" focusable="false" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Server-Side Rendering (SSR)</h2>
<p>With SSR the server generates the full HTML for each request. The browser receives a complete, readable page immediately. JavaScript then runs to make the page interactive.</p>
<p><strong>Frameworks:</strong> Next.js (<code>getServerSideProps</code>), Nuxt.js, SvelteKit, Remix</p>
<div class="mermaid">
sequenceDiagram
    participant B as 🌐 Browser
    participant S as 🖥️ Server
    participant D as 🗄️ Database / API

    B->>S: GET /page
    S->>D: Query data
    D-->>S: Data response
    Note over S: Renders full HTML on server
    S-->>B: Full HTML page ✅
    Note over B: Content visible immediately (fast FCP)
    B->>S: GET /bundle.js
    S-->>B: JS bundle
    Note over B: Hydration — page becomes interactive ✅
</div>
<h3 id="how-ssr-works-step-by-step" style="position:relative;"><a href="#how-ssr-works-step-by-step" aria-label="how ssr works step by step permalink" class="anchor before"><svg aria-hidden="true" focusable="false" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>How SSR works step by step</h3>
<ol>
<li>Browser sends a request for a page</li>
<li>Server fetches data from the database or API</li>
<li>Server renders the full HTML and sends it to the browser</li>
<li>Browser displays the HTML immediately (fast First Contentful Paint)</li>
<li>Browser downloads JS and <strong>hydrates</strong> the page to add interactivity</li>
</ol>
<blockquote>
<p><strong>⚠️ This entire cycle runs on every request.</strong> The server must be available, fast, and horizontally scalable.</p>
</blockquote>
<h3 id="pros-and-cons-1" style="position:relative;"><a href="#pros-and-cons-1" aria-label="pros and cons 1 permalink" class="anchor before"><svg aria-hidden="true" focusable="false" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Pros and Cons</h3>
<table>
<thead>
<tr>
<th>✅ Pros</th>
<th>❌ Cons</th>
</tr>
</thead>
<tbody>
<tr>
<td>Excellent SEO</td>
<td>Higher server load per request</td>
</tr>
<tr>
<td>Fast initial paint (content visible)</td>
<td>More complex infrastructure</td>
</tr>
<tr>
<td>Dynamic, always-fresh data</td>
<td>Cold start delays (serverless)</td>
</tr>
<tr>
<td>Works without JS</td>
<td>Slower than static file serving</td>
</tr>
</tbody>
</table>
<blockquote>
<p><strong>Best for:</strong> E-commerce product pages, news articles, pages that need fresh data on every request.</p>
</blockquote>
<hr>
<h2 id="static-site-generation-ssg" style="position:relative;"><a href="#static-site-generation-ssg" aria-label="static site generation ssg permalink" class="anchor before"><svg aria-hidden="true" focusable="false" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Static Site Generation (SSG)</h2>
<p>SSG pre-renders all pages at <strong>build time</strong>. The result is a set of plain HTML files deployed to a CDN. No server is needed at request time.</p>
<p><strong>Frameworks:</strong> Next.js (<code>getStaticProps</code>), Gatsby, Astro, Hugo, Eleventy</p>
<div class="mermaid">
flowchart TD
    subgraph Build["🔨 Build Time — runs once"]
        C["📁 Content\nMD / JSON / CMS"] --> BT["⚙️ Build Tool\nNext.js / Gatsby"]
        BT --> H["📄 Static HTML Files"]
        H --> D["🚀 Deploy to CDN\nVercel / Netlify / S3"]
    end

    subgraph Runtime["🌍 Request Time — instant"]
        Browser["🌐 Browser"] -->|"GET /page"| Edge["☁️ CDN Edge Node\ncached globally"]
        Edge -->|"Pre-built HTML ⚡"| Browser
    end

    D --> Edge
</div>
<h3 id="how-ssg-works-step-by-step" style="position:relative;"><a href="#how-ssg-works-step-by-step" aria-label="how ssg works step by step permalink" class="anchor before"><svg aria-hidden="true" focusable="false" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>How SSG works step by step</h3>
<ol>
<li>At <strong>build time</strong>, the framework fetches all data and renders every page to HTML</li>
<li>The HTML files are uploaded to a CDN</li>
<li>At <strong>request time</strong>, the browser gets the pre-built HTML from the nearest CDN edge node — no server execution needed</li>
</ol>
<blockquote>
<p><strong>⚠️ Data can become stale between builds.</strong> A new deploy is required for content changes unless ISR (Incremental Static Regeneration) is used.</p>
</blockquote>
<h3 id="pros-and-cons-2" style="position:relative;"><a href="#pros-and-cons-2" aria-label="pros and cons 2 permalink" class="anchor before"><svg aria-hidden="true" focusable="false" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Pros and Cons</h3>
<table>
<thead>
<tr>
<th>✅ Pros</th>
<th>❌ Cons</th>
</tr>
</thead>
<tbody>
<tr>
<td>Blazing fast (files from CDN edge)</td>
<td>Data can become stale</td>
</tr>
<tr>
<td>Excellent SEO</td>
<td>Rebuild required for content changes</td>
</tr>
<tr>
<td>Highly scalable (no server)</td>
<td>Long build times for large sites</td>
</tr>
<tr>
<td>Very secure</td>
<td>Not suitable for user-specific pages</td>
</tr>
</tbody>
</table>
<blockquote>
<p><strong>Best for:</strong> Blogs, documentation sites, marketing pages, portfolios.</p>
</blockquote>
<hr>
<h2 id="hydration" style="position:relative;"><a href="#hydration" aria-label="hydration permalink" class="anchor before"><svg aria-hidden="true" focusable="false" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Hydration</h2>
<p>Hydration is the process that makes a server-rendered or statically generated HTML page <strong>interactive</strong>. The browser receives full HTML (fast paint), then JS is loaded and "wired up" to the existing DOM — attaching event listeners and state without re-rendering.</p>
<div class="mermaid">
flowchart TD
    A["① Server HTML\n📄 Full HTML sent\nVisible ✅\nNot Interactive ❌"]
    B["② JS Bundle Loads\n⬇️ Downloading...\nVisible ✅\nNot Interactive ❌"]
    C["③ Hydrating\n💧 Attaching events\nVisible ✅\nPartial ⚠️"]
    D["④ Interactive\n✅ Framework controls DOM\nVisible ✅\nInteractive ✅"]

    A -->|Browser receives| B
    B -->|JS executes| C
    C -->|Complete| D

    style A fill:#f1f5f9,stroke:#94a3b8,color:#334155
    style B fill:#dbeafe,stroke:#3b82f6,color:#1e40af
    style C fill:#fef9c3,stroke:#eab308,color:#713f12
    style D fill:#dcfce7,stroke:#22c55e,color:#166534
</div>
<h3 id="the-hydration-problem" style="position:relative;"><a href="#the-hydration-problem" aria-label="the hydration problem permalink" class="anchor before"><svg aria-hidden="true" focusable="false" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>The Hydration problem</h3>
<p>Hydration introduces <strong>Time To Interactive (TTI)</strong>: the page <em>looks</em> ready but is <strong>not clickable</strong> until JS finishes hydrating. On slow networks or heavy JS bundles, this gap frustrates users.</p>
<div class="gatsby-highlight" data-language="text"><pre class="language-text"><code class="language-text">FCP ─────────────────────────────────► TTI
(page visible)                        (page usable)
     │◄─── JS downloads + hydrates ──►│</code></pre></div>
<h3 id="modern-solutions" style="position:relative;"><a href="#modern-solutions" aria-label="modern solutions permalink" class="anchor before"><svg aria-hidden="true" focusable="false" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Modern solutions</h3>
<ul>
<li><strong>Partial Hydration</strong> — only hydrate interactive components (Astro Islands)</li>
<li><strong>Progressive Hydration</strong> — hydrate as components enter the viewport</li>
<li><strong>Resumability</strong> — skip hydration entirely by serializing state (Qwik)</li>
</ul>
<hr>
<h2 id="all-methods-compared" style="position:relative;"><a href="#all-methods-compared" aria-label="all methods compared permalink" class="anchor before"><svg aria-hidden="true" focusable="false" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>All Methods Compared</h2>
<div class="mermaid">
quadrantChart
    title Speed vs SEO — Where each method lands
    x-axis Slow Initial Load --> Fast Initial Load
    y-axis Poor SEO --> Great SEO
    quadrant-1 Ideal
    quadrant-2 Good for content
    quadrant-3 Limited use
    quadrant-4 App-focused
    CSR: [0.40, 0.15]
    SSR: [0.58, 0.88]
    SSG: [0.92, 0.92]
    Hybrid SSR+SSG: [0.75, 0.88]
</div>
<table>
<thead>
<tr>
<th></th>
<th>CSR</th>
<th>SSR</th>
<th>SSG</th>
<th>Hybrid (SSR+SSG)</th>
</tr>
</thead>
<tbody>
<tr>
<td><strong>First Load Speed</strong></td>
<td>🔴 Slow</td>
<td>🟡 Medium</td>
<td>🟢 Fast</td>
<td>🟢 Fast</td>
</tr>
<tr>
<td><strong>SEO</strong></td>
<td>🔴 Poor</td>
<td>🟢 Excellent</td>
<td>🟢 Excellent</td>
<td>🟢 Excellent</td>
</tr>
<tr>
<td><strong>Data Freshness</strong></td>
<td>🟢 Real-time</td>
<td>🟢 Per-request</td>
<td>🔴 Build-time</td>
<td>🟡 Configurable</td>
</tr>
<tr>
<td><strong>Server Cost</strong></td>
<td>🟢 Low</td>
<td>🔴 High</td>
<td>🟢 None</td>
<td>🟡 Medium</td>
</tr>
<tr>
<td><strong>Scalability</strong></td>
<td>🟡 Medium</td>
<td>🔴 Harder</td>
<td>🟢 Excellent</td>
<td>🟢 Good</td>
</tr>
<tr>
<td><strong>Interactivity</strong></td>
<td>🟢 Rich</td>
<td>🟡 After hydration</td>
<td>🟡 After hydration</td>
<td>🟡 After hydration</td>
</tr>
<tr>
<td><strong>Complexity</strong></td>
<td>🟢 Simple</td>
<td>🟡 Medium</td>
<td>🟢 Simple</td>
<td>🔴 Complex</td>
</tr>
</tbody>
</table>
<hr>
<h2 id="when-to-use-each-method" style="position:relative;"><a href="#when-to-use-each-method" aria-label="when to use each method permalink" class="anchor before"><svg aria-hidden="true" focusable="false" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>When to use each method</h2>
<p><strong>Use CSR when:</strong></p>
<ul>
<li>Building authenticated apps (dashboards, admin panels)</li>
<li>Data changes frequently and SEO doesn't matter</li>
<li>You need rich, complex client-side interactions</li>
</ul>
<p><strong>Use SSR when:</strong></p>
<ul>
<li>Pages need fresh data on every request</li>
<li>SEO is critical and content changes frequently</li>
<li>You're building e-commerce or social platforms</li>
</ul>
<p><strong>Use SSG when:</strong></p>
<ul>
<li>Content doesn't change often (blogs, docs, portfolios)</li>
<li>You want maximum speed and zero server cost</li>
<li>Pages are the same for every user</li>
</ul>
<p><strong>Use Hybrid (SSG + SSR + ISR) when:</strong></p>
<ul>
<li>Some pages are static, some are dynamic</li>
<li>You need incremental rebuilds (ISR) to keep static pages fresh</li>
<li>You want per-page control over the rendering strategy</li>
</ul>
<hr>
<blockquote>
<p><strong>The modern consensus:</strong> Most production apps benefit from a hybrid approach. Frameworks like Next.js, Nuxt.js, and SvelteKit let you choose the rendering strategy <strong>per page</strong>, so you can statically generate your marketing pages while server-rendering your product listings and client-rendering your dashboard.</p>
</blockquote>]]></content:encoded>
    </item>
    <item>
      <title>Métodos de Renderizado: CSR, SSR, SSG e Hidratación</title>
      <link>https://girgetto.it/metodos-de-renderizado/</link>
      <guid isPermaLink="true">https://girgetto.it/metodos-de-renderizado/</guid>
      <pubDate>Thu, 19 Mar 2026 00:00:00 GMT</pubDate>
      <description>Un análisis profundo de las principales estrategias de renderizado en frontend — Client-Side Rendering, Server-Side Rendering, Static Site Generation e Hidratación — con diagramas para cada una.</description>
      <dc:language>es</dc:language>
      <category>web</category>
      <content:encoded><![CDATA[<p>Los frameworks modernos de frontend ofrecen varias estrategias para entregar contenido al navegador. Elegir la correcta puede afectar drásticamente el rendimiento, el SEO y la experiencia del usuario. Este artículo cubre los cuatro métodos de renderizado más importantes — <strong>CSR</strong>, <strong>SSR</strong>, <strong>SSG</strong> e <strong>Hidratación</strong> — con un diagrama para cada uno.</p>
<hr>
<h2 id="client-side-rendering-csr" style="position:relative;"><a href="#client-side-rendering-csr" aria-label="client side rendering csr permalink" class="anchor before"><svg aria-hidden="true" focusable="false" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Client-Side Rendering (CSR)</h2>
<p>En CSR el navegador descarga una carcasa HTML mínima y un bundle de JavaScript. El JS se ejecuta en el navegador, obtiene los datos y construye la página completa en el cliente.</p>
<p><strong>Frameworks:</strong> React (CRA / Vite SPA), Vue (Vite SPA), Angular</p>
<div class="mermaid">
sequenceDiagram
    participant B as 🌐 Navegador
    participant S as 🖥️ Servidor

    B->>S: GET /index.html
    S-->>B: HTML vacío ⟨div id="root"⟩⟨/div⟩
    B->>S: GET /bundle.js
    S-->>B: bundle.js (~500 KB)
    Note over B: El JS se ejecuta — construye el DOM
    B->>S: fetch('/api/datos')
    S-->>B: Datos JSON
    Note over B: UI completamente renderizada ✅
</div>
<h3 id="cómo-funciona-el-csr-paso-a-paso" style="position:relative;"><a href="#c%C3%B3mo-funciona-el-csr-paso-a-paso" aria-label="cómo funciona el csr paso a paso permalink" class="anchor before"><svg aria-hidden="true" focusable="false" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Cómo funciona el CSR paso a paso</h3>
<ol>
<li>El navegador solicita la página → el servidor devuelve un archivo HTML casi vacío</li>
<li>El navegador descarga el bundle de JavaScript</li>
<li>El JS se ejecuta en el navegador y construye el DOM</li>
<li>Se obtienen datos de las APIs y se renderiza la interfaz</li>
</ol>
<blockquote>
<p><strong>⚠️ La página está completamente en blanco hasta que el bundle de JS se ha descargado y ejecutado.</strong> Esto perjudica tanto el rendimiento percibido como los crawlers de SEO que no ejecutan JS.</p>
</blockquote>
<h3 id="ventajas-y-desventajas" style="position:relative;"><a href="#ventajas-y-desventajas" aria-label="ventajas y desventajas permalink" class="anchor before"><svg aria-hidden="true" focusable="false" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Ventajas y desventajas</h3>
<table>
<thead>
<tr>
<th>✅ Ventajas</th>
<th>❌ Desventajas</th>
</tr>
</thead>
<tbody>
<tr>
<td>Interacciones ricas, tipo aplicación</td>
<td>Carga inicial lenta (pantalla en blanco)</td>
</tr>
<tr>
<td>Baja carga en el servidor</td>
<td>SEO deficiente por defecto</td>
</tr>
<tr>
<td>Despliegue sencillo (hosting estático)</td>
<td>Bundles de JS grandes</td>
</tr>
<tr>
<td>Navegación rápida tras la primera carga</td>
<td>Requiere JS habilitado</td>
</tr>
</tbody>
</table>
<blockquote>
<p><strong>Ideal para:</strong> Dashboards, paneles de administración, apps detrás de un login, herramientas en tiempo real.</p>
</blockquote>
<hr>
<h2 id="server-side-rendering-ssr" style="position:relative;"><a href="#server-side-rendering-ssr" aria-label="server side rendering ssr permalink" class="anchor before"><svg aria-hidden="true" focusable="false" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Server-Side Rendering (SSR)</h2>
<p>Con SSR el servidor genera el HTML completo en cada solicitud. El navegador recibe una página completa y legible de inmediato. Después el JavaScript se ejecuta para hacer la página interactiva.</p>
<p><strong>Frameworks:</strong> Next.js (<code>getServerSideProps</code>), Nuxt.js, SvelteKit, Remix</p>
<div class="mermaid">
sequenceDiagram
    participant B as 🌐 Navegador
    participant S as 🖥️ Servidor
    participant D as 🗄️ Base de datos / API

    B->>S: GET /pagina
    S->>D: Consulta de datos
    D-->>S: Respuesta con datos
    Note over S: Renderiza el HTML completo en el servidor
    S-->>B: Página HTML completa ✅
    Note over B: Contenido visible de inmediato (FCP rápido)
    B->>S: GET /bundle.js
    S-->>B: Bundle JS
    Note over B: Hidratación — la página se vuelve interactiva ✅
</div>
<h3 id="cómo-funciona-el-ssr-paso-a-paso" style="position:relative;"><a href="#c%C3%B3mo-funciona-el-ssr-paso-a-paso" aria-label="cómo funciona el ssr paso a paso permalink" class="anchor before"><svg aria-hidden="true" focusable="false" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Cómo funciona el SSR paso a paso</h3>
<ol>
<li>El navegador envía una solicitud para una página</li>
<li>El servidor obtiene datos de la base de datos o API</li>
<li>El servidor renderiza el HTML completo y lo envía al navegador</li>
<li>El navegador muestra el HTML de inmediato (First Contentful Paint rápido)</li>
<li>El navegador descarga el JS e <strong>hidrata</strong> la página para agregar interactividad</li>
</ol>
<blockquote>
<p><strong>⚠️ Todo este ciclo se ejecuta en cada solicitud.</strong> El servidor debe estar disponible, ser rápido y escalar horizontalmente.</p>
</blockquote>
<h3 id="ventajas-y-desventajas-1" style="position:relative;"><a href="#ventajas-y-desventajas-1" aria-label="ventajas y desventajas 1 permalink" class="anchor before"><svg aria-hidden="true" focusable="false" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Ventajas y desventajas</h3>
<table>
<thead>
<tr>
<th>✅ Ventajas</th>
<th>❌ Desventajas</th>
</tr>
</thead>
<tbody>
<tr>
<td>Excelente SEO</td>
<td>Mayor carga en el servidor por solicitud</td>
</tr>
<tr>
<td>Pintura inicial rápida (contenido visible)</td>
<td>Infraestructura más compleja</td>
</tr>
<tr>
<td>Datos dinámicos y siempre frescos</td>
<td>Retrasos de arranque en frío (serverless)</td>
</tr>
<tr>
<td>Funciona sin JS</td>
<td>Más lento que servir archivos estáticos</td>
</tr>
</tbody>
</table>
<blockquote>
<p><strong>Ideal para:</strong> Páginas de productos en e-commerce, artículos de noticias, páginas que necesitan datos frescos en cada visita.</p>
</blockquote>
<hr>
<h2 id="static-site-generation-ssg" style="position:relative;"><a href="#static-site-generation-ssg" aria-label="static site generation ssg permalink" class="anchor before"><svg aria-hidden="true" focusable="false" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Static Site Generation (SSG)</h2>
<p>SSG pre-renderiza todas las páginas en <strong>tiempo de compilación</strong>. El resultado es un conjunto de archivos HTML estáticos desplegados en una CDN. No se necesita servidor en tiempo de solicitud.</p>
<p><strong>Frameworks:</strong> Next.js (<code>getStaticProps</code>), Gatsby, Astro, Hugo, Eleventy</p>
<div class="mermaid">
flowchart TD
    subgraph Build["🔨 Tiempo de Compilación — se ejecuta una vez"]
        C["📁 Contenido\nMD / JSON / CMS"] --> BT["⚙️ Herramienta de Build\nNext.js / Gatsby"]
        BT --> H["📄 Archivos HTML Estáticos"]
        H --> D["🚀 Despliegue a CDN\nVercel / Netlify / S3"]
    end

    subgraph Runtime["🌍 Tiempo de Solicitud — instantáneo"]
        Browser["🌐 Navegador"] -->|"GET /pagina"| Edge["☁️ Nodo CDN Edge\ncaché global"]
        Edge -->|"HTML pre-construido ⚡"| Browser
    end

    D --> Edge
</div>
<h3 id="cómo-funciona-el-ssg-paso-a-paso" style="position:relative;"><a href="#c%C3%B3mo-funciona-el-ssg-paso-a-paso" aria-label="cómo funciona el ssg paso a paso permalink" class="anchor before"><svg aria-hidden="true" focusable="false" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Cómo funciona el SSG paso a paso</h3>
<ol>
<li>En <strong>tiempo de compilación</strong>, el framework obtiene todos los datos y renderiza cada página a HTML</li>
<li>Los archivos HTML se suben a una CDN</li>
<li>En <strong>tiempo de solicitud</strong>, el navegador obtiene el HTML pre-construido del nodo CDN más cercano — sin ejecución en el servidor</li>
</ol>
<blockquote>
<p><strong>⚠️ Los datos pueden quedar desactualizados entre compilaciones.</strong> Se requiere un nuevo despliegue para cambios de contenido, a menos que se use ISR (Incremental Static Regeneration).</p>
</blockquote>
<h3 id="ventajas-y-desventajas-2" style="position:relative;"><a href="#ventajas-y-desventajas-2" aria-label="ventajas y desventajas 2 permalink" class="anchor before"><svg aria-hidden="true" focusable="false" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Ventajas y desventajas</h3>
<table>
<thead>
<tr>
<th>✅ Ventajas</th>
<th>❌ Desventajas</th>
</tr>
</thead>
<tbody>
<tr>
<td>Extremadamente rápido (archivos desde CDN)</td>
<td>Los datos pueden quedar desactualizados</td>
</tr>
<tr>
<td>Excelente SEO</td>
<td>Se requiere recompilar para cambios de contenido</td>
</tr>
<tr>
<td>Altamente escalable (sin servidor)</td>
<td>Tiempos de build largos en sitios grandes</td>
</tr>
<tr>
<td>Muy seguro</td>
<td>No apto para páginas personalizadas por usuario</td>
</tr>
</tbody>
</table>
<blockquote>
<p><strong>Ideal para:</strong> Blogs, sitios de documentación, páginas de marketing, portfolios.</p>
</blockquote>
<hr>
<h2 id="hidratación" style="position:relative;"><a href="#hidrataci%C3%B3n" aria-label="hidratación permalink" class="anchor before"><svg aria-hidden="true" focusable="false" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Hidratación</h2>
<p>La hidratación es el proceso que hace <strong>interactiva</strong> una página renderizada en el servidor o generada estáticamente. El navegador recibe el HTML completo (pintura rápida), luego se carga el JS y se "conecta" al DOM existente — adjuntando event listeners y estado sin volver a renderizar.</p>
<div class="mermaid">
flowchart TD
    A["① HTML del Servidor\n📄 HTML completo enviado\nVisible ✅\nNo Interactivo ❌"]
    B["② Bundle JS Cargando\n⬇️ Descargando...\nVisible ✅\nNo Interactivo ❌"]
    C["③ Hidratando\n💧 Adjuntando eventos\nVisible ✅\nParcial ⚠️"]
    D["④ Interactivo\n✅ El framework controla el DOM\nVisible ✅\nInteractivo ✅"]

    A -->|El navegador recibe| B
    B -->|JS se ejecuta| C
    C -->|Completo| D

    style A fill:#f1f5f9,stroke:#94a3b8,color:#334155
    style B fill:#dbeafe,stroke:#3b82f6,color:#1e40af
    style C fill:#fef9c3,stroke:#eab308,color:#713f12
    style D fill:#dcfce7,stroke:#22c55e,color:#166534
</div>
<h3 id="el-problema-de-la-hidratación" style="position:relative;"><a href="#el-problema-de-la-hidrataci%C3%B3n" aria-label="el problema de la hidratación permalink" class="anchor before"><svg aria-hidden="true" focusable="false" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>El problema de la Hidratación</h3>
<p>La hidratación introduce el concepto de <strong>Time To Interactive (TTI)</strong>: la página <em>parece</em> lista pero <strong>no es clicable</strong> hasta que el JS termina de hidratarse. En redes lentas o bundles de JS grandes, esta brecha frustra a los usuarios.</p>
<div class="gatsby-highlight" data-language="text"><pre class="language-text"><code class="language-text">FCP ─────────────────────────────────► TTI
(página visible)                      (página usable)
     │◄─── JS descarga + hidrata ────►│</code></pre></div>
<h3 id="soluciones-modernas" style="position:relative;"><a href="#soluciones-modernas" aria-label="soluciones modernas permalink" class="anchor before"><svg aria-hidden="true" focusable="false" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Soluciones modernas</h3>
<ul>
<li><strong>Hidratación Parcial</strong> — solo hidratar componentes interactivos (Astro Islands)</li>
<li><strong>Hidratación Progresiva</strong> — hidratar a medida que los componentes entran en el viewport</li>
<li><strong>Resumability</strong> — saltar la hidratación completamente serializando el estado (Qwik)</li>
</ul>
<hr>
<h2 id="comparación-de-todos-los-métodos" style="position:relative;"><a href="#comparaci%C3%B3n-de-todos-los-m%C3%A9todos" aria-label="comparación de todos los métodos permalink" class="anchor before"><svg aria-hidden="true" focusable="false" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Comparación de todos los métodos</h2>
<div class="mermaid">
quadrantChart
    title Velocidad vs SEO — Dónde se sitúa cada método
    x-axis "Carga inicial lenta" --> "Carga inicial rápida"
    y-axis "SEO deficiente" --> "SEO excelente"
    quadrant-1 Ideal
    quadrant-2 Bueno para contenido
    quadrant-3 Uso limitado
    quadrant-4 Orientado a apps
    CSR: [0.40, 0.15]
    SSR: [0.58, 0.88]
    SSG: [0.92, 0.92]
    Hybrid SSR+SSG: [0.75, 0.88]
</div>
<table>
<thead>
<tr>
<th></th>
<th>CSR</th>
<th>SSR</th>
<th>SSG</th>
<th>Híbrido (SSR+SSG)</th>
</tr>
</thead>
<tbody>
<tr>
<td><strong>Velocidad de carga inicial</strong></td>
<td>🔴 Lenta</td>
<td>🟡 Media</td>
<td>🟢 Rápida</td>
<td>🟢 Rápida</td>
</tr>
<tr>
<td><strong>SEO</strong></td>
<td>🔴 Deficiente</td>
<td>🟢 Excelente</td>
<td>🟢 Excelente</td>
<td>🟢 Excelente</td>
</tr>
<tr>
<td><strong>Frescura de datos</strong></td>
<td>🟢 Tiempo real</td>
<td>🟢 Por solicitud</td>
<td>🔴 Tiempo de build</td>
<td>🟡 Configurable</td>
</tr>
<tr>
<td><strong>Coste de servidor</strong></td>
<td>🟢 Bajo</td>
<td>🔴 Alto</td>
<td>🟢 Ninguno</td>
<td>🟡 Medio</td>
</tr>
<tr>
<td><strong>Escalabilidad</strong></td>
<td>🟡 Media</td>
<td>🔴 Más difícil</td>
<td>🟢 Excelente</td>
<td>🟢 Buena</td>
</tr>
<tr>
<td><strong>Interactividad</strong></td>
<td>🟢 Rica</td>
<td>🟡 Tras hidratación</td>
<td>🟡 Tras hidratación</td>
<td>🟡 Tras hidratación</td>
</tr>
<tr>
<td><strong>Complejidad</strong></td>
<td>🟢 Simple</td>
<td>🟡 Media</td>
<td>🟢 Simple</td>
<td>🔴 Compleja</td>
</tr>
</tbody>
</table>
<hr>
<h2 id="cuándo-usar-cada-método" style="position:relative;"><a href="#cu%C3%A1ndo-usar-cada-m%C3%A9todo" aria-label="cuándo usar cada método permalink" class="anchor before"><svg aria-hidden="true" focusable="false" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Cuándo usar cada método</h2>
<p><strong>Usa CSR cuando:</strong></p>
<ul>
<li>Construyes apps con autenticación (dashboards, paneles de administración)</li>
<li>Los datos cambian frecuentemente y el SEO no importa</li>
<li>Necesitas interacciones complejas del lado del cliente</li>
</ul>
<p><strong>Usa SSR cuando:</strong></p>
<ul>
<li>Las páginas necesitan datos frescos en cada solicitud</li>
<li>El SEO es crítico y el contenido cambia frecuentemente</li>
<li>Construyes plataformas de e-commerce o redes sociales</li>
</ul>
<p><strong>Usa SSG cuando:</strong></p>
<ul>
<li>El contenido no cambia frecuentemente (blogs, docs, portfolios)</li>
<li>Quieres máxima velocidad y coste de servidor cero</li>
<li>Las páginas son iguales para todos los usuarios</li>
</ul>
<p><strong>Usa Híbrido (SSG + SSR + ISR) cuando:</strong></p>
<ul>
<li>Algunas páginas son estáticas y otras dinámicas</li>
<li>Necesitas reconstrucciones incrementales (ISR) para mantener las páginas estáticas actualizadas</li>
<li>Quieres control del método de renderizado por página</li>
</ul>
<hr>
<blockquote>
<p><strong>El consenso moderno:</strong> La mayoría de las apps en producción se benefician de un enfoque híbrido. Frameworks como Next.js, Nuxt.js y SvelteKit permiten elegir la estrategia de renderizado <strong>por página</strong>, de forma que puedes generar estáticamente tus páginas de marketing mientras renderizas en servidor tus listados de productos y en cliente tu dashboard.</p>
</blockquote>]]></content:encoded>
    </item>
    <item>
      <title>Cómo resolver la secuencia de Fibonacci en JavaScript</title>
      <link>https://girgetto.it/fibonacci/</link>
      <guid isPermaLink="true">https://girgetto.it/fibonacci/</guid>
      <pubDate>Mon, 09 Oct 2023 00:00:00 GMT</pubDate>
      <description>La secuencia de Fibonacci es un problema clásico en la programación que a menudo se utiliza para enseñar conceptos fundamentales. En este tutorial, aprenderás cómo resolver la secuencia de Fibonacci en JavaScript de manera eficiente y paso a paso. Después de dominar este concepto, estarás mejor preparado para enfrentar desafíos de programación más complejos.</description>
      <dc:language>es</dc:language>
      <category>javascript</category>
      <category>algorithms</category>
      <content:encoded><![CDATA[<h2 id="introducción" style="position:relative;"><a href="#introducci%C3%B3n" aria-label="introducción permalink" class="anchor before"><svg aria-hidden="true" focusable="false" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Introducción</h2>
<p>La secuencia de Fibonacci es un problema clásico en la programación que a menudo se utiliza para enseñar conceptos fundamentales. En este tutorial, aprenderás cómo resolver la secuencia de Fibonacci en JavaScript de manera eficiente y paso a paso. Después de dominar este concepto, estarás mejor preparado para enfrentar desafíos de programación más complejos.</p>
<h2 id="qué-es-la-secuencia-de-fibonacci" style="position:relative;"><a href="#qu%C3%A9-es-la-secuencia-de-fibonacci" aria-label="qué es la secuencia de fibonacci permalink" class="anchor before"><svg aria-hidden="true" focusable="false" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>¿Qué es la Secuencia de Fibonacci?</h2>
<p>La secuencia de Fibonacci es una serie de números en la que cada número es la suma de los dos números anteriores. Comienza con 0 y 1, y los primeros números de la secuencia son: 0, 1, 1, 2, 3, 5, 8, 13, 21 y así sucesivamente. Esta secuencia tiene aplicaciones en una variedad de campos, desde la biología hasta las finanzas.</p>
<h2 id="resolución-en-javascript" style="position:relative;"><a href="#resoluci%C3%B3n-en-javascript" aria-label="resolución en javascript permalink" class="anchor before"><svg aria-hidden="true" focusable="false" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Resolución en JavaScript</h2>
<p>Para resolver la secuencia de Fibonacci en JavaScript, podemos utilizar dos enfoques: el enfoque recursivo y el enfoque iterativo.</p>
<h3 id="enfoque-recursivo" style="position:relative;"><a href="#enfoque-recursivo" aria-label="enfoque recursivo permalink" class="anchor before"><svg aria-hidden="true" focusable="false" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Enfoque Recursivo</h3>
<div class="gatsby-highlight" data-language="javascript"><pre class="language-javascript"><code class="language-javascript"><span class="token keyword">function</span> <span class="token function">fibonacciRecursivo</span><span class="token punctuation">(</span><span class="token parameter">n</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
  <span class="token keyword">if</span> <span class="token punctuation">(</span>n <span class="token operator">&lt;=</span> <span class="token number">1</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
    <span class="token keyword">return</span> n<span class="token punctuation">;</span>
  <span class="token punctuation">}</span>
  <span class="token keyword">return</span> <span class="token function">fibonacciRecursivo</span><span class="token punctuation">(</span>n <span class="token operator">-</span> <span class="token number">1</span><span class="token punctuation">)</span> <span class="token operator">+</span> <span class="token function">fibonacciRecursivo</span><span class="token punctuation">(</span>n <span class="token operator">-</span> <span class="token number">2</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token punctuation">}</span></code></pre></div>
<p>El enfoque recursivo es simple pero puede volverse ineficiente para números grandes debido a la repetición de cálculos.</p>
<h3 id="enfoque-iterativo" style="position:relative;"><a href="#enfoque-iterativo" aria-label="enfoque iterativo permalink" class="anchor before"><svg aria-hidden="true" focusable="false" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Enfoque Iterativo</h3>
<div class="gatsby-highlight" data-language="javascript"><pre class="language-javascript"><code class="language-javascript"><span class="token keyword">function</span> <span class="token function">fibonacciIterativo</span><span class="token punctuation">(</span><span class="token parameter">n</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
  <span class="token keyword">let</span> fib <span class="token operator">=</span> <span class="token punctuation">[</span><span class="token number">0</span><span class="token punctuation">,</span> <span class="token number">1</span><span class="token punctuation">]</span><span class="token punctuation">;</span>
  <span class="token keyword">for</span> <span class="token punctuation">(</span><span class="token keyword">let</span> i <span class="token operator">=</span> <span class="token number">2</span><span class="token punctuation">;</span> i <span class="token operator">&lt;=</span> n<span class="token punctuation">;</span> i<span class="token operator">++</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
    fib<span class="token punctuation">[</span>i<span class="token punctuation">]</span> <span class="token operator">=</span> fib<span class="token punctuation">[</span>i <span class="token operator">-</span> <span class="token number">1</span><span class="token punctuation">]</span> <span class="token operator">+</span> fib<span class="token punctuation">[</span>i <span class="token operator">-</span> <span class="token number">2</span><span class="token punctuation">]</span><span class="token punctuation">;</span>
  <span class="token punctuation">}</span>
  <span class="token keyword">return</span> fib<span class="token punctuation">[</span>n<span class="token punctuation">]</span><span class="token punctuation">;</span>
<span class="token punctuation">}</span></code></pre></div>
<p>El enfoque iterativo es más eficiente, ya que evita la repetición de cálculos y utiliza un arreglo para almacenar los valores de Fibonacci previamente calculados.</p>
<h2 id="conclusión" style="position:relative;"><a href="#conclusi%C3%B3n" aria-label="conclusión permalink" class="anchor before"><svg aria-hidden="true" focusable="false" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Conclusión</h2>
<p>En este tutorial, hemos explorado cómo resolver la secuencia de Fibonacci en JavaScript utilizando dos enfoques: el enfoque recursivo y el enfoque iterativo. Si bien ambos métodos son válidos, el enfoque iterativo suele ser más eficiente en términos de rendimiento.</p>
<p>Dominar la resolución de problemas clásicos como la secuencia de Fibonacci es esencial para convertirse en un programador competente. Con estos conocimientos, estarás mejor preparado para abordar desafíos más complejos en el mundo de la programación.</p>
<p>Esperamos que este tutorial te haya ayudado a comprender cómo resolver la secuencia de Fibonacci en JavaScript y que lo encuentres útil en tus futuros proyectos de programación.</p>
<p>¡Happy coding!</p>]]></content:encoded>
    </item>
    <item>
      <title>Sintaxis de Markdown: guía rápida con ejemplos 📝</title>
      <link>https://girgetto.it/md-sintaxis/</link>
      <guid isPermaLink="true">https://girgetto.it/md-sintaxis/</guid>
      <pubDate>Thu, 09 Jun 2022 00:00:00 GMT</pubDate>
      <description>Chuleta de Markdown con ejemplos: encabezados, negrita y cursiva, listas, enlaces, imágenes, código, tablas, citas y más. Todo lo que necesitas para escribir un README.</description>
      <dc:language>es</dc:language>
      <category>markdown</category>
      <content:encoded><![CDATA[<p>Markdown es un lenguaje de marcado ligero: escribes texto plano con unos pocos símbolos y se convierte en HTML con formato. Es lo que usan los <code>README.md</code> de GitHub, la documentación de muchos proyectos, Notion, Obsidian, Discord o Reddit.</p>
<p>Esta guía empieza con una chuleta para consultar rápido y después explica cada elemento con un ejemplo.</p>
<h2 id="chuleta-de-markdown" style="position:relative;"><a href="#chuleta-de-markdown" aria-label="chuleta de markdown permalink" class="anchor before"><svg aria-hidden="true" focusable="false" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Chuleta de Markdown</h2>
<table>
<thead>
<tr>
<th>Elemento</th>
<th>Sintaxis</th>
</tr>
</thead>
<tbody>
<tr>
<td>Encabezado</td>
<td><code># H1</code>, <code>## H2</code>, <code>### H3</code></td>
</tr>
<tr>
<td>Negrita</td>
<td><code>**texto**</code></td>
</tr>
<tr>
<td>Cursiva</td>
<td><code>*texto*</code></td>
</tr>
<tr>
<td>Negrita y cursiva</td>
<td><code>***texto***</code></td>
</tr>
<tr>
<td>Tachado</td>
<td><code>~~texto~~</code></td>
</tr>
<tr>
<td>Cita</td>
<td><code>> texto</code></td>
</tr>
<tr>
<td>Lista</td>
<td><code>- elemento</code></td>
</tr>
<tr>
<td>Lista numerada</td>
<td><code>1. elemento</code></td>
</tr>
<tr>
<td>Lista de tareas</td>
<td><code>- [ ] tarea</code></td>
</tr>
<tr>
<td>Enlace</td>
<td><code>[texto](https://url.com)</code></td>
</tr>
<tr>
<td>Imagen</td>
<td><code>![texto alternativo](imagen.png)</code></td>
</tr>
<tr>
<td>Código en línea</td>
<td><code>`código`</code></td>
</tr>
<tr>
<td>Bloque de código</td>
<td><code>```</code> en una línea antes y otra después</td>
</tr>
<tr>
<td>Línea horizontal</td>
<td><code>---</code></td>
</tr>
</tbody>
</table>
<h2 id="cómo-escribir-un-encabezado-en-markdown" style="position:relative;"><a href="#c%C3%B3mo-escribir-un-encabezado-en-markdown" aria-label="cómo escribir un encabezado en markdown permalink" class="anchor before"><svg aria-hidden="true" focusable="false" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Cómo escribir un encabezado en Markdown</h2>
<p>Usa almohadillas (<code>#</code>) al principio de la línea. El número de almohadillas indica el nivel, de <code>#</code> (el más grande) a <code>######</code> (el más pequeño). Deja un espacio entre las almohadillas y el texto.</p>
<div class="gatsby-highlight" data-language="markdown"><pre class="language-markdown"><code class="language-markdown"><span class="token title important"><span class="token punctuation">#</span> Encabezado de nivel 1</span>
<span class="token title important"><span class="token punctuation">##</span> Encabezado de nivel 2</span>
<span class="token title important"><span class="token punctuation">###</span> Encabezado de nivel 3</span>
<span class="token title important"><span class="token punctuation">####</span> Encabezado de nivel 4</span></code></pre></div>
<p>Usa un solo <code>#</code> por documento, para el título principal, y organiza el resto con <code>##</code> y <code>###</code>.</p>
<h2 id="párrafos-y-saltos-de-línea" style="position:relative;"><a href="#p%C3%A1rrafos-y-saltos-de-l%C3%ADnea" aria-label="párrafos y saltos de línea permalink" class="anchor before"><svg aria-hidden="true" focusable="false" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Párrafos y saltos de línea</h2>
<p>Para crear un párrafo nuevo, deja una línea en blanco entre los dos bloques de texto.</p>
<p>Si solo pulsas Intro, Markdown une las dos líneas en el mismo párrafo. Para forzar un salto de línea sin empezar otro párrafo, termina la línea con dos espacios o con una barra invertida (<code>\</code>):</p>
<div class="gatsby-highlight" data-language="markdown"><pre class="language-markdown"><code class="language-markdown">Primera línea\
Segunda línea, en el mismo párrafo</code></pre></div>
<h2 id="cómo-escribir-en-negrita-y-cursiva-en-markdown" style="position:relative;"><a href="#c%C3%B3mo-escribir-en-negrita-y-cursiva-en-markdown" aria-label="cómo escribir en negrita y cursiva en markdown permalink" class="anchor before"><svg aria-hidden="true" focusable="false" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Cómo escribir en negrita y cursiva en Markdown</h2>
<ul>
<li><strong>Negrita:</strong> dos asteriscos (<code>**</code>) o dos guiones bajos (<code>__</code>) a cada lado.</li>
<li><em>Cursiva:</em> un asterisco (<code>*</code>) o un guion bajo (<code>_</code>) a cada lado.</li>
<li><em><strong>Negrita y cursiva:</strong></em> tres asteriscos (<code>***</code>) a cada lado.</li>
</ul>
<div class="gatsby-highlight" data-language="markdown"><pre class="language-markdown"><code class="language-markdown"><span class="token bold"><span class="token punctuation">**</span><span class="token content">Negrita</span><span class="token punctuation">**</span></span> o <span class="token bold"><span class="token punctuation">__</span><span class="token content">Negrita</span><span class="token punctuation">__</span></span>
<span class="token italic"><span class="token punctuation">*</span><span class="token content">Cursiva</span><span class="token punctuation">*</span></span> o <span class="token italic"><span class="token punctuation">_</span><span class="token content">Cursiva</span><span class="token punctuation">_</span></span>
<span class="token bold"><span class="token punctuation">**</span><span class="token content"><span class="token italic"><span class="token punctuation">*</span><span class="token content">Negrita y cursiva</span><span class="token punctuation">*</span></span></span><span class="token punctuation">**</span></span></code></pre></div>
<p>Resultado: <strong>Negrita</strong>, <em>Cursiva</em> y <em><strong>Negrita y cursiva</strong></em>.</p>
<p>Para marcar solo una parte de una palabra, usa asteriscos: <code>super**importante**</code> funciona, mientras que con guiones bajos muchos editores no lo aplican.</p>
<h2 id="cómo-tachar-texto-en-markdown" style="position:relative;"><a href="#c%C3%B3mo-tachar-texto-en-markdown" aria-label="cómo tachar texto en markdown permalink" class="anchor before"><svg aria-hidden="true" focusable="false" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Cómo tachar texto en Markdown</h2>
<p>Pon dos virgulillas (<code>~~</code>) al principio y al final del texto.</p>
<div class="gatsby-highlight" data-language="markdown"><pre class="language-markdown"><code class="language-markdown"><span class="token strike"><span class="token punctuation">~~</span><span class="token content">Texto tachado</span><span class="token punctuation">~~</span></span></code></pre></div>
<p>Resultado: <del>Texto tachado</del></p>
<h2 id="cómo-escribir-una-cita-en-markdown" style="position:relative;"><a href="#c%C3%B3mo-escribir-una-cita-en-markdown" aria-label="cómo escribir una cita en markdown permalink" class="anchor before"><svg aria-hidden="true" focusable="false" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Cómo escribir una cita en Markdown</h2>
<p>Empieza la línea con el símbolo mayor que (<code>></code>). Para una cita dentro de otra, usa <code>>></code>.</p>
<div class="gatsby-highlight" data-language="markdown"><pre class="language-markdown"><code class="language-markdown"><span class="token blockquote punctuation">></span> Esta es una cita
<span class="token blockquote punctuation">></span>
<span class="token blockquote punctuation">>></span> Y esta es una cita anidada</code></pre></div>
<blockquote>
<p>Esta es una cita</p>
<blockquote>
<p>Y esta es una cita anidada</p>
</blockquote>
</blockquote>
<h2 id="cómo-hacer-una-lista-en-markdown" style="position:relative;"><a href="#c%C3%B3mo-hacer-una-lista-en-markdown" aria-label="cómo hacer una lista en markdown permalink" class="anchor before"><svg aria-hidden="true" focusable="false" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Cómo hacer una lista en Markdown</h2>
<h3 id="lista-con-viñetas" style="position:relative;"><a href="#lista-con-vi%C3%B1etas" aria-label="lista con viñetas permalink" class="anchor before"><svg aria-hidden="true" focusable="false" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Lista con viñetas</h3>
<p>Empieza cada línea con un guion (<code>-</code>), un asterisco (<code>*</code>) o un signo más (<code>+</code>) seguido de un espacio. Intenta usar siempre el mismo símbolo.</p>
<div class="gatsby-highlight" data-language="markdown"><pre class="language-markdown"><code class="language-markdown"><span class="token list punctuation">-</span> Manzanas
<span class="token list punctuation">-</span> Peras
<span class="token list punctuation">-</span> Naranjas</code></pre></div>
<ul>
<li>Manzanas</li>
<li>Peras</li>
<li>Naranjas</li>
</ul>
<h3 id="lista-numerada" style="position:relative;"><a href="#lista-numerada" aria-label="lista numerada permalink" class="anchor before"><svg aria-hidden="true" focusable="false" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Lista numerada</h3>
<p>Escribe un número seguido de un punto. Los números no tienen que ser correlativos: Markdown numera la lista por ti, así que puedes escribir <code>1.</code> en todas las líneas.</p>
<div class="gatsby-highlight" data-language="markdown"><pre class="language-markdown"><code class="language-markdown"><span class="token list punctuation">1.</span> Clona el repositorio
<span class="token list punctuation">2.</span> Instala las dependencias
<span class="token list punctuation">3.</span> Arranca el proyecto</code></pre></div>
<ol>
<li>Clona el repositorio</li>
<li>Instala las dependencias</li>
<li>Arranca el proyecto</li>
</ol>
<h3 id="listas-anidadas" style="position:relative;"><a href="#listas-anidadas" aria-label="listas anidadas permalink" class="anchor before"><svg aria-hidden="true" focusable="false" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Listas anidadas</h3>
<p>Para meter una lista dentro de otra, indenta los elementos con dos o cuatro espacios.</p>
<div class="gatsby-highlight" data-language="markdown"><pre class="language-markdown"><code class="language-markdown"><span class="token list punctuation">-</span> Frontend
  <span class="token list punctuation">-</span> React
  <span class="token list punctuation">-</span> Vue
<span class="token list punctuation">-</span> Backend
  <span class="token list punctuation">-</span> Node.js</code></pre></div>
<ul>
<li>Frontend
<ul>
<li>React</li>
<li>Vue</li>
</ul>
</li>
<li>Backend
<ul>
<li>Node.js</li>
</ul>
</li>
</ul>
<h3 id="lista-de-tareas" style="position:relative;"><a href="#lista-de-tareas" aria-label="lista de tareas permalink" class="anchor before"><svg aria-hidden="true" focusable="false" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Lista de tareas</h3>
<p>Añade <code>[ ]</code> para una tarea pendiente y <code>[x]</code> para una completada. Funciona en GitHub, GitLab y la mayoría de editores.</p>
<div class="gatsby-highlight" data-language="markdown"><pre class="language-markdown"><code class="language-markdown"><span class="token list punctuation">-</span> [x] Escribir el README
<span class="token list punctuation">-</span> [ ] Añadir capturas de pantalla
<span class="token list punctuation">-</span> [ ] Publicar la primera versión</code></pre></div>
<ul class="contains-task-list">
<li class="task-list-item"><input type="checkbox" checked disabled> Escribir el README</li>
<li class="task-list-item"><input type="checkbox" disabled> Añadir capturas de pantalla</li>
<li class="task-list-item"><input type="checkbox" disabled> Publicar la primera versión</li>
</ul>
<h2 id="cómo-poner-un-enlace-en-markdown" style="position:relative;"><a href="#c%C3%B3mo-poner-un-enlace-en-markdown" aria-label="cómo poner un enlace en markdown permalink" class="anchor before"><svg aria-hidden="true" focusable="false" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Cómo poner un enlace en Markdown</h2>
<p>Escribe el texto del enlace entre corchetes y la URL entre paréntesis, sin espacio entre ellos. Opcionalmente, añade un título entre comillas que aparece al pasar el ratón.</p>
<div class="gatsby-highlight" data-language="markdown"><pre class="language-markdown"><code class="language-markdown"><span class="token url">[<span class="token content">Mi web</span>](<span class="token url">https://girgetto.it</span>)</span>
<span class="token url">[<span class="token content">Mi web</span>](<span class="token url">https://girgetto.it</span> <span class="token string">"Página de inicio"</span>)</span>
&lt;https://girgetto.it></code></pre></div>
<p>Resultado: <a href="https://girgetto.it">Mi web</a></p>
<p>Para enlazar a una sección del mismo documento, usa el nombre del encabezado en minúsculas y con guiones: <code>[Ir a tablas](#cómo-hacer-una-tabla-en-markdown)</code>.</p>
<h2 id="cómo-poner-una-imagen-en-markdown" style="position:relative;"><a href="#c%C3%B3mo-poner-una-imagen-en-markdown" aria-label="cómo poner una imagen en markdown permalink" class="anchor before"><svg aria-hidden="true" focusable="false" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Cómo poner una imagen en Markdown</h2>
<p>Es igual que un enlace, pero con un signo de exclamación (<code>!</code>) delante. El texto entre corchetes es el texto alternativo: descríbelo bien, porque lo leen los lectores de pantalla y los buscadores.</p>
<div class="gatsby-highlight" data-language="markdown"><pre class="language-markdown"><code class="language-markdown"><span class="token url"><span class="token operator">!</span>[<span class="token content">Logo de Markdown</span>](<span class="token url">https://ejemplo.com/logo.png</span>)</span></code></pre></div>
<p>Para que la imagen sea también un enlace, mete la imagen dentro de un enlace:</p>
<div class="gatsby-highlight" data-language="markdown"><pre class="language-markdown"><code class="language-markdown"><span class="token url">[<span class="token content">![Logo de Markdown</span>](<span class="token url">https://ejemplo.com/logo.png</span>)</span>](https://ejemplo.com)</code></pre></div>
<p>Markdown no permite cambiar el tamaño de una imagen. Si lo necesitas, usa HTML: <code>&#x3C;img src="logo.png" alt="Logo" width="200"></code>.</p>
<h2 id="cómo-escribir-código-en-markdown" style="position:relative;"><a href="#c%C3%B3mo-escribir-c%C3%B3digo-en-markdown" aria-label="cómo escribir código en markdown permalink" class="anchor before"><svg aria-hidden="true" focusable="false" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Cómo escribir código en Markdown</h2>
<h3 id="código-en-línea" style="position:relative;"><a href="#c%C3%B3digo-en-l%C3%ADnea" aria-label="código en línea permalink" class="anchor before"><svg aria-hidden="true" focusable="false" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Código en línea</h3>
<p>Rodea el código con comillas invertidas (<code>`</code>, el acento grave).</p>
<div class="gatsby-highlight" data-language="markdown"><pre class="language-markdown"><code class="language-markdown">Ejecuta <span class="token code-snippet code keyword">`npm install`</span> para instalar las dependencias.</code></pre></div>
<p>Resultado: Ejecuta <code>npm install</code> para instalar las dependencias.</p>
<h3 id="bloque-de-código" style="position:relative;"><a href="#bloque-de-c%C3%B3digo" aria-label="bloque de código permalink" class="anchor before"><svg aria-hidden="true" focusable="false" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Bloque de código</h3>
<p>Escribe tres comillas invertidas en una línea antes del código y otras tres después. Si añades el nombre del lenguaje justo después de las primeras, el código se muestra con resaltado de sintaxis.</p>
<div class="gatsby-highlight" data-language="markdown"><pre class="language-markdown"><code class="language-markdown"><span class="token code"><span class="token punctuation">```</span><span class="token code-language">javascript</span>
<span class="token code-block language-javascript"><span class="token keyword">const</span> <span class="token function-variable function">suma</span> <span class="token operator">=</span> <span class="token punctuation">(</span><span class="token parameter">a<span class="token punctuation">,</span> b</span><span class="token punctuation">)</span> <span class="token operator">=></span> a <span class="token operator">+</span> b<span class="token punctuation">;</span>
console<span class="token punctuation">.</span><span class="token function">log</span><span class="token punctuation">(</span><span class="token function">suma</span><span class="token punctuation">(</span><span class="token number">5</span><span class="token punctuation">,</span> <span class="token number">5</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span></span>
<span class="token punctuation">```</span></span></code></pre></div>
<div class="gatsby-highlight" data-language="javascript"><pre class="language-javascript"><code class="language-javascript"><span class="token keyword">const</span> <span class="token function-variable function">suma</span> <span class="token operator">=</span> <span class="token punctuation">(</span><span class="token parameter">a<span class="token punctuation">,</span> b</span><span class="token punctuation">)</span> <span class="token operator">=></span> a <span class="token operator">+</span> b<span class="token punctuation">;</span>
console<span class="token punctuation">.</span><span class="token function">log</span><span class="token punctuation">(</span><span class="token function">suma</span><span class="token punctuation">(</span><span class="token number">5</span><span class="token punctuation">,</span> <span class="token number">5</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span></code></pre></div>
<p>Algunos lenguajes habituales: <code>javascript</code>, <code>typescript</code>, <code>python</code>, <code>bash</code>, <code>json</code>, <code>html</code>, <code>css</code>, <code>diff</code>.</p>
<h2 id="cómo-hacer-una-tabla-en-markdown" style="position:relative;"><a href="#c%C3%B3mo-hacer-una-tabla-en-markdown" aria-label="cómo hacer una tabla en markdown permalink" class="anchor before"><svg aria-hidden="true" focusable="false" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Cómo hacer una tabla en Markdown</h2>
<p>Separa las columnas con barras verticales (<code>|</code>) y pon una fila de guiones (<code>---</code>) debajo de la cabecera. Con los dos puntos (<code>:</code>) en esa fila eliges la alineación de cada columna.</p>
<div class="gatsby-highlight" data-language="markdown"><pre class="language-markdown"><code class="language-markdown"><span class="token table"><span class="token table-header-row"><span class="token punctuation">|</span><span class="token table-header important"> Comando       </span><span class="token punctuation">|</span><span class="token table-header important"> Descripción             </span><span class="token punctuation">|</span><span class="token table-header important"> Obligatorio </span><span class="token punctuation">|</span>
</span><span class="token table-line"><span class="token punctuation">|</span> <span class="token punctuation">:------------</span> <span class="token punctuation">|</span> <span class="token punctuation">:---------------------:</span> <span class="token punctuation">|</span> <span class="token punctuation">----------:</span> <span class="token punctuation">|</span>
</span><span class="token table-data-rows"><span class="token punctuation">|</span><span class="token table-data"> <span class="token code-snippet code keyword">`npm install`</span> </span><span class="token punctuation">|</span><span class="token table-data"> Instala dependencias    </span><span class="token punctuation">|</span><span class="token table-data"> Sí          </span><span class="token punctuation">|</span>
<span class="token punctuation">|</span><span class="token table-data"> <span class="token code-snippet code keyword">`npm test`</span>    </span><span class="token punctuation">|</span><span class="token table-data"> Ejecuta los tests       </span><span class="token punctuation">|</span><span class="token table-data"> No          </span><span class="token punctuation">|</span></span></span></code></pre></div>
<table>
<thead>
<tr>
<th align="left">Comando</th>
<th align="center">Descripción</th>
<th align="right">Obligatorio</th>
</tr>
</thead>
<tbody>
<tr>
<td align="left"><code>npm install</code></td>
<td align="center">Instala dependencias</td>
<td align="right">Sí</td>
</tr>
<tr>
<td align="left"><code>npm test</code></td>
<td align="center">Ejecuta los tests</td>
<td align="right">No</td>
</tr>
</tbody>
</table>
<ul>
<li><code>:---</code> alinea a la izquierda</li>
<li><code>:---:</code> centra</li>
<li><code>---:</code> alinea a la derecha</li>
</ul>
<p>No hace falta que las columnas estén alineadas en el texto: basta con que cada fila tenga el mismo número de barras.</p>
<h2 id="cómo-poner-una-línea-horizontal-en-markdown" style="position:relative;"><a href="#c%C3%B3mo-poner-una-l%C3%ADnea-horizontal-en-markdown" aria-label="cómo poner una línea horizontal en markdown permalink" class="anchor before"><svg aria-hidden="true" focusable="false" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Cómo poner una línea horizontal en Markdown</h2>
<p>Escribe tres guiones (<code>---</code>), asteriscos (<code>***</code>) o guiones bajos (<code>___</code>) en una línea sola. Deja una línea en blanco antes, porque <code>---</code> justo debajo de un texto lo convierte en un encabezado.</p>
<div class="gatsby-highlight" data-language="markdown"><pre class="language-markdown"><code class="language-markdown">Texto de arriba

<span class="token hr punctuation">---</span>

Texto de abajo</code></pre></div>
<h2 id="cómo-escapar-caracteres-en-markdown" style="position:relative;"><a href="#c%C3%B3mo-escapar-caracteres-en-markdown" aria-label="cómo escapar caracteres en markdown permalink" class="anchor before"><svg aria-hidden="true" focusable="false" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Cómo escapar caracteres en Markdown</h2>
<p>Si quieres mostrar un símbolo que Markdown interpreta, como un asterisco, ponle delante una barra invertida (<code>\</code>).</p>
<div class="gatsby-highlight" data-language="markdown"><pre class="language-markdown"><code class="language-markdown">\*Esto no sale en cursiva\*</code></pre></div>
<p>Resultado: *Esto no sale en cursiva*</p>
<p>Se pueden escapar estos caracteres: <code>\</code> <code>`</code> <code>*</code> <code>_</code> <code>{}</code> <code>[]</code> <code>()</code> <code>#</code> <code>+</code> <code>-</code> <code>.</code> <code>!</code> <code>|</code></p>
<h2 id="cómo-crear-una-sección-desplegable-en-markdown" style="position:relative;"><a href="#c%C3%B3mo-crear-una-secci%C3%B3n-desplegable-en-markdown" aria-label="cómo crear una sección desplegable en markdown permalink" class="anchor before"><svg aria-hidden="true" focusable="false" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Cómo crear una sección desplegable en Markdown</h2>
<p>Markdown acepta HTML, así que puedes usar las etiquetas <code>&#x3C;details></code> y <code>&#x3C;summary></code> para crear un bloque que se abre al hacer clic. Es útil para ocultar logs largos o instrucciones opcionales en un README. Deja una línea en blanco después de <code>&#x3C;/summary></code> para que el Markdown de dentro se procese.</p>
<div class="gatsby-highlight" data-language="html"><pre class="language-html"><code class="language-html"><span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>details</span><span class="token punctuation">></span></span>
  <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>summary</span><span class="token punctuation">></span></span>Ver instrucciones de instalación<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>summary</span><span class="token punctuation">></span></span>

1. Clona el repositorio
2. Ejecuta `npm install`

<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>details</span><span class="token punctuation">></span></span></code></pre></div>
<details>
  <summary>Ver instrucciones de instalación</summary>
<ol>
<li>Clona el repositorio</li>
<li>Ejecuta <code>npm install</code></li>
</ol>
</details>
<h2 id="dónde-funciona-cada-cosa" style="position:relative;"><a href="#d%C3%B3nde-funciona-cada-cosa" aria-label="dónde funciona cada cosa permalink" class="anchor before"><svg aria-hidden="true" focusable="false" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Dónde funciona cada cosa</h2>
<p>Los elementos básicos (encabezados, negrita, cursiva, listas, enlaces, imágenes, citas y código) funcionan en cualquier sitio. Las tablas, el tachado y las listas de tareas son extensiones de <strong>GitHub Flavored Markdown (GFM)</strong>: funcionan en GitHub, GitLab, VS Code y la mayoría de editores modernos, pero algunas herramientas antiguas no los muestran.</p>]]></content:encoded>
    </item>
    <item>
      <title>Markdown Syntax: Quick Guide with Examples 📝</title>
      <link>https://girgetto.it/en/markdown-syntax/</link>
      <guid isPermaLink="true">https://girgetto.it/en/markdown-syntax/</guid>
      <pubDate>Thu, 09 Jun 2022 00:00:00 GMT</pubDate>
      <description>A Markdown cheat sheet with examples: headings, bold and italic, lists, links, images, code, tables, quotes and more. Everything you need to write a README.</description>
      <dc:language>en</dc:language>
      <category>markdown</category>
      <content:encoded><![CDATA[<p>Markdown is a lightweight markup language: you write plain text with a few symbols and it turns into formatted HTML. It's what GitHub <code>README.md</code> files use, along with a lot of project documentation, Notion, Obsidian, Discord and Reddit.</p>
<p>This guide starts with a cheat sheet for quick lookups, then explains each element with an example.</p>
<h2 id="markdown-cheat-sheet" style="position:relative;"><a href="#markdown-cheat-sheet" aria-label="markdown cheat sheet permalink" class="anchor before"><svg aria-hidden="true" focusable="false" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Markdown cheat sheet</h2>
<table>
<thead>
<tr>
<th>Element</th>
<th>Syntax</th>
</tr>
</thead>
<tbody>
<tr>
<td>Heading</td>
<td><code># H1</code>, <code>## H2</code>, <code>### H3</code></td>
</tr>
<tr>
<td>Bold</td>
<td><code>**text**</code></td>
</tr>
<tr>
<td>Italic</td>
<td><code>*text*</code></td>
</tr>
<tr>
<td>Bold and italic</td>
<td><code>***text***</code></td>
</tr>
<tr>
<td>Strikethrough</td>
<td><code>~~text~~</code></td>
</tr>
<tr>
<td>Quote</td>
<td><code>> text</code></td>
</tr>
<tr>
<td>List</td>
<td><code>- item</code></td>
</tr>
<tr>
<td>Numbered list</td>
<td><code>1. item</code></td>
</tr>
<tr>
<td>Task list</td>
<td><code>- [ ] task</code></td>
</tr>
<tr>
<td>Link</td>
<td><code>[text](https://url.com)</code></td>
</tr>
<tr>
<td>Image</td>
<td><code>![alt text](image.png)</code></td>
</tr>
<tr>
<td>Inline code</td>
<td><code>`code`</code></td>
</tr>
<tr>
<td>Code block</td>
<td><code>```</code> on a line before and after</td>
</tr>
<tr>
<td>Horizontal rule</td>
<td><code>---</code></td>
</tr>
</tbody>
</table>
<h2 id="how-to-write-a-heading-in-markdown" style="position:relative;"><a href="#how-to-write-a-heading-in-markdown" aria-label="how to write a heading in markdown permalink" class="anchor before"><svg aria-hidden="true" focusable="false" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>How to write a heading in Markdown</h2>
<p>Put hash symbols (<code>#</code>) at the start of the line. The number of hashes sets the level, from <code>#</code> (largest) to <code>######</code> (smallest). Leave a space between the hashes and the text.</p>
<div class="gatsby-highlight" data-language="markdown"><pre class="language-markdown"><code class="language-markdown"><span class="token title important"><span class="token punctuation">#</span> Level 1 heading</span>
<span class="token title important"><span class="token punctuation">##</span> Level 2 heading</span>
<span class="token title important"><span class="token punctuation">###</span> Level 3 heading</span>
<span class="token title important"><span class="token punctuation">####</span> Level 4 heading</span></code></pre></div>
<p>Use a single <code>#</code> per document, for the main title, and organise the rest with <code>##</code> and <code>###</code>.</p>
<h2 id="paragraphs-and-line-breaks" style="position:relative;"><a href="#paragraphs-and-line-breaks" aria-label="paragraphs and line breaks permalink" class="anchor before"><svg aria-hidden="true" focusable="false" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Paragraphs and line breaks</h2>
<p>To start a new paragraph, leave a blank line between the two blocks of text.</p>
<p>If you only press Enter, Markdown joins the two lines into the same paragraph. To force a line break without starting a new paragraph, end the line with two spaces or a backslash (<code>\</code>):</p>
<div class="gatsby-highlight" data-language="markdown"><pre class="language-markdown"><code class="language-markdown">First line\
Second line, same paragraph</code></pre></div>
<h2 id="how-to-write-bold-and-italic-text-in-markdown" style="position:relative;"><a href="#how-to-write-bold-and-italic-text-in-markdown" aria-label="how to write bold and italic text in markdown permalink" class="anchor before"><svg aria-hidden="true" focusable="false" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>How to write bold and italic text in Markdown</h2>
<ul>
<li><strong>Bold:</strong> two asterisks (<code>**</code>) or two underscores (<code>__</code>) on each side.</li>
<li><em>Italic:</em> one asterisk (<code>*</code>) or one underscore (<code>_</code>) on each side.</li>
<li><em><strong>Bold and italic:</strong></em> three asterisks (<code>***</code>) on each side.</li>
</ul>
<div class="gatsby-highlight" data-language="markdown"><pre class="language-markdown"><code class="language-markdown"><span class="token bold"><span class="token punctuation">**</span><span class="token content">Bold</span><span class="token punctuation">**</span></span> or <span class="token bold"><span class="token punctuation">__</span><span class="token content">Bold</span><span class="token punctuation">__</span></span>
<span class="token italic"><span class="token punctuation">*</span><span class="token content">Italic</span><span class="token punctuation">*</span></span> or <span class="token italic"><span class="token punctuation">_</span><span class="token content">Italic</span><span class="token punctuation">_</span></span>
<span class="token bold"><span class="token punctuation">**</span><span class="token content"><span class="token italic"><span class="token punctuation">*</span><span class="token content">Bold and italic</span><span class="token punctuation">*</span></span></span><span class="token punctuation">**</span></span></code></pre></div>
<p>Result: <strong>Bold</strong>, <em>Italic</em> and <em><strong>Bold and italic</strong></em>.</p>
<p>To format only part of a word, use asterisks: <code>super**important**</code> works, while many editors ignore underscores in the middle of a word.</p>
<h2 id="how-to-strikethrough-text-in-markdown" style="position:relative;"><a href="#how-to-strikethrough-text-in-markdown" aria-label="how to strikethrough text in markdown permalink" class="anchor before"><svg aria-hidden="true" focusable="false" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>How to strikethrough text in Markdown</h2>
<p>Put two tildes (<code>~~</code>) at the start and end of the text.</p>
<div class="gatsby-highlight" data-language="markdown"><pre class="language-markdown"><code class="language-markdown"><span class="token strike"><span class="token punctuation">~~</span><span class="token content">Strikethrough text</span><span class="token punctuation">~~</span></span></code></pre></div>
<p>Result: <del>Strikethrough text</del></p>
<h2 id="how-to-write-a-quote-in-markdown" style="position:relative;"><a href="#how-to-write-a-quote-in-markdown" aria-label="how to write a quote in markdown permalink" class="anchor before"><svg aria-hidden="true" focusable="false" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>How to write a quote in Markdown</h2>
<p>Start the line with a greater-than symbol (<code>></code>). For a quote inside a quote, use <code>>></code>.</p>
<div class="gatsby-highlight" data-language="markdown"><pre class="language-markdown"><code class="language-markdown"><span class="token blockquote punctuation">></span> This is a quote
<span class="token blockquote punctuation">></span>
<span class="token blockquote punctuation">>></span> And this is a nested quote</code></pre></div>
<blockquote>
<p>This is a quote</p>
<blockquote>
<p>And this is a nested quote</p>
</blockquote>
</blockquote>
<h2 id="how-to-make-a-list-in-markdown" style="position:relative;"><a href="#how-to-make-a-list-in-markdown" aria-label="how to make a list in markdown permalink" class="anchor before"><svg aria-hidden="true" focusable="false" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>How to make a list in Markdown</h2>
<h3 id="bulleted-list" style="position:relative;"><a href="#bulleted-list" aria-label="bulleted list permalink" class="anchor before"><svg aria-hidden="true" focusable="false" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Bulleted list</h3>
<p>Start each line with a dash (<code>-</code>), asterisk (<code>*</code>) or plus sign (<code>+</code>) followed by a space. Try to stick to one symbol.</p>
<div class="gatsby-highlight" data-language="markdown"><pre class="language-markdown"><code class="language-markdown"><span class="token list punctuation">-</span> Apples
<span class="token list punctuation">-</span> Pears
<span class="token list punctuation">-</span> Oranges</code></pre></div>
<ul>
<li>Apples</li>
<li>Pears</li>
<li>Oranges</li>
</ul>
<h3 id="numbered-list" style="position:relative;"><a href="#numbered-list" aria-label="numbered list permalink" class="anchor before"><svg aria-hidden="true" focusable="false" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Numbered list</h3>
<p>Write a number followed by a period. The numbers don't have to be in order: Markdown numbers the list for you, so you can write <code>1.</code> on every line.</p>
<div class="gatsby-highlight" data-language="markdown"><pre class="language-markdown"><code class="language-markdown"><span class="token list punctuation">1.</span> Clone the repository
<span class="token list punctuation">2.</span> Install the dependencies
<span class="token list punctuation">3.</span> Start the project</code></pre></div>
<ol>
<li>Clone the repository</li>
<li>Install the dependencies</li>
<li>Start the project</li>
</ol>
<h3 id="nested-lists" style="position:relative;"><a href="#nested-lists" aria-label="nested lists permalink" class="anchor before"><svg aria-hidden="true" focusable="false" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Nested lists</h3>
<p>To put a list inside another, indent the items by two or four spaces.</p>
<div class="gatsby-highlight" data-language="markdown"><pre class="language-markdown"><code class="language-markdown"><span class="token list punctuation">-</span> Frontend
  <span class="token list punctuation">-</span> React
  <span class="token list punctuation">-</span> Vue
<span class="token list punctuation">-</span> Backend
  <span class="token list punctuation">-</span> Node.js</code></pre></div>
<ul>
<li>Frontend
<ul>
<li>React</li>
<li>Vue</li>
</ul>
</li>
<li>Backend
<ul>
<li>Node.js</li>
</ul>
</li>
</ul>
<h3 id="task-list" style="position:relative;"><a href="#task-list" aria-label="task list permalink" class="anchor before"><svg aria-hidden="true" focusable="false" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Task list</h3>
<p>Add <code>[ ]</code> for an open task and <code>[x]</code> for a done one. It works on GitHub, GitLab and most editors.</p>
<div class="gatsby-highlight" data-language="markdown"><pre class="language-markdown"><code class="language-markdown"><span class="token list punctuation">-</span> [x] Write the README
<span class="token list punctuation">-</span> [ ] Add screenshots
<span class="token list punctuation">-</span> [ ] Publish the first release</code></pre></div>
<ul class="contains-task-list">
<li class="task-list-item"><input type="checkbox" checked disabled> Write the README</li>
<li class="task-list-item"><input type="checkbox" disabled> Add screenshots</li>
<li class="task-list-item"><input type="checkbox" disabled> Publish the first release</li>
</ul>
<h2 id="how-to-add-a-link-in-markdown" style="position:relative;"><a href="#how-to-add-a-link-in-markdown" aria-label="how to add a link in markdown permalink" class="anchor before"><svg aria-hidden="true" focusable="false" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>How to add a link in Markdown</h2>
<p>Put the link text in square brackets and the URL in parentheses, with no space between them. You can add a title in quotes that shows on hover.</p>
<div class="gatsby-highlight" data-language="markdown"><pre class="language-markdown"><code class="language-markdown"><span class="token url">[<span class="token content">My website</span>](<span class="token url">https://girgetto.it</span>)</span>
<span class="token url">[<span class="token content">My website</span>](<span class="token url">https://girgetto.it</span> <span class="token string">"Home page"</span>)</span>
&lt;https://girgetto.it></code></pre></div>
<p>Result: <a href="https://girgetto.it">My website</a></p>
<p>To link to a section of the same document, use the heading text in lowercase with dashes: <code>[Go to tables](#how-to-make-a-table-in-markdown)</code>.</p>
<h2 id="how-to-add-an-image-in-markdown" style="position:relative;"><a href="#how-to-add-an-image-in-markdown" aria-label="how to add an image in markdown permalink" class="anchor before"><svg aria-hidden="true" focusable="false" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>How to add an image in Markdown</h2>
<p>It's the same as a link, with an exclamation mark (<code>!</code>) in front. The text in square brackets is the alt text: describe the image properly, because screen readers and search engines read it.</p>
<div class="gatsby-highlight" data-language="markdown"><pre class="language-markdown"><code class="language-markdown"><span class="token url"><span class="token operator">!</span>[<span class="token content">Markdown logo</span>](<span class="token url">https://example.com/logo.png</span>)</span></code></pre></div>
<p>To make the image a link as well, put the image inside a link:</p>
<div class="gatsby-highlight" data-language="markdown"><pre class="language-markdown"><code class="language-markdown"><span class="token url">[<span class="token content">![Markdown logo</span>](<span class="token url">https://example.com/logo.png</span>)</span>](https://example.com)</code></pre></div>
<p>Markdown can't resize an image. If you need to, use HTML: <code>&#x3C;img src="logo.png" alt="Logo" width="200"></code>.</p>
<h2 id="how-to-write-code-in-markdown" style="position:relative;"><a href="#how-to-write-code-in-markdown" aria-label="how to write code in markdown permalink" class="anchor before"><svg aria-hidden="true" focusable="false" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>How to write code in Markdown</h2>
<h3 id="inline-code" style="position:relative;"><a href="#inline-code" aria-label="inline code permalink" class="anchor before"><svg aria-hidden="true" focusable="false" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Inline code</h3>
<p>Wrap the code in backticks (<code>`</code>).</p>
<div class="gatsby-highlight" data-language="markdown"><pre class="language-markdown"><code class="language-markdown">Run <span class="token code-snippet code keyword">`npm install`</span> to install the dependencies.</code></pre></div>
<p>Result: Run <code>npm install</code> to install the dependencies.</p>
<h3 id="code-block" style="position:relative;"><a href="#code-block" aria-label="code block permalink" class="anchor before"><svg aria-hidden="true" focusable="false" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Code block</h3>
<p>Put three backticks on a line before the code and three more after it. Add the language name right after the first three to get syntax highlighting.</p>
<div class="gatsby-highlight" data-language="markdown"><pre class="language-markdown"><code class="language-markdown"><span class="token code"><span class="token punctuation">```</span><span class="token code-language">javascript</span>
<span class="token code-block language-javascript"><span class="token keyword">const</span> <span class="token function-variable function">sum</span> <span class="token operator">=</span> <span class="token punctuation">(</span><span class="token parameter">a<span class="token punctuation">,</span> b</span><span class="token punctuation">)</span> <span class="token operator">=></span> a <span class="token operator">+</span> b<span class="token punctuation">;</span>
console<span class="token punctuation">.</span><span class="token function">log</span><span class="token punctuation">(</span><span class="token function">sum</span><span class="token punctuation">(</span><span class="token number">5</span><span class="token punctuation">,</span> <span class="token number">5</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span></span>
<span class="token punctuation">```</span></span></code></pre></div>
<div class="gatsby-highlight" data-language="javascript"><pre class="language-javascript"><code class="language-javascript"><span class="token keyword">const</span> <span class="token function-variable function">sum</span> <span class="token operator">=</span> <span class="token punctuation">(</span><span class="token parameter">a<span class="token punctuation">,</span> b</span><span class="token punctuation">)</span> <span class="token operator">=></span> a <span class="token operator">+</span> b<span class="token punctuation">;</span>
console<span class="token punctuation">.</span><span class="token function">log</span><span class="token punctuation">(</span><span class="token function">sum</span><span class="token punctuation">(</span><span class="token number">5</span><span class="token punctuation">,</span> <span class="token number">5</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span></code></pre></div>
<p>Some common languages: <code>javascript</code>, <code>typescript</code>, <code>python</code>, <code>bash</code>, <code>json</code>, <code>html</code>, <code>css</code>, <code>diff</code>.</p>
<h2 id="how-to-make-a-table-in-markdown" style="position:relative;"><a href="#how-to-make-a-table-in-markdown" aria-label="how to make a table in markdown permalink" class="anchor before"><svg aria-hidden="true" focusable="false" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>How to make a table in Markdown</h2>
<p>Separate columns with pipes (<code>|</code>) and put a row of dashes (<code>---</code>) under the header. Colons (<code>:</code>) in that row set each column's alignment.</p>
<div class="gatsby-highlight" data-language="markdown"><pre class="language-markdown"><code class="language-markdown"><span class="token table"><span class="token table-header-row"><span class="token punctuation">|</span><span class="token table-header important"> Command       </span><span class="token punctuation">|</span><span class="token table-header important"> Description             </span><span class="token punctuation">|</span><span class="token table-header important"> Required </span><span class="token punctuation">|</span>
</span><span class="token table-line"><span class="token punctuation">|</span> <span class="token punctuation">:------------</span> <span class="token punctuation">|</span> <span class="token punctuation">:---------------------:</span> <span class="token punctuation">|</span> <span class="token punctuation">-------:</span> <span class="token punctuation">|</span>
</span><span class="token table-data-rows"><span class="token punctuation">|</span><span class="token table-data"> <span class="token code-snippet code keyword">`npm install`</span> </span><span class="token punctuation">|</span><span class="token table-data"> Installs dependencies   </span><span class="token punctuation">|</span><span class="token table-data"> Yes      </span><span class="token punctuation">|</span>
<span class="token punctuation">|</span><span class="token table-data"> <span class="token code-snippet code keyword">`npm test`</span>    </span><span class="token punctuation">|</span><span class="token table-data"> Runs the tests          </span><span class="token punctuation">|</span><span class="token table-data"> No       </span><span class="token punctuation">|</span></span></span></code></pre></div>
<table>
<thead>
<tr>
<th align="left">Command</th>
<th align="center">Description</th>
<th align="right">Required</th>
</tr>
</thead>
<tbody>
<tr>
<td align="left"><code>npm install</code></td>
<td align="center">Installs dependencies</td>
<td align="right">Yes</td>
</tr>
<tr>
<td align="left"><code>npm test</code></td>
<td align="center">Runs the tests</td>
<td align="right">No</td>
</tr>
</tbody>
</table>
<ul>
<li><code>:---</code> aligns left</li>
<li><code>:---:</code> centres</li>
<li><code>---:</code> aligns right</li>
</ul>
<p>The columns don't need to line up in the source: each row just needs the same number of pipes.</p>
<h2 id="how-to-add-a-horizontal-rule-in-markdown" style="position:relative;"><a href="#how-to-add-a-horizontal-rule-in-markdown" aria-label="how to add a horizontal rule in markdown permalink" class="anchor before"><svg aria-hidden="true" focusable="false" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>How to add a horizontal rule in Markdown</h2>
<p>Write three dashes (<code>---</code>), asterisks (<code>***</code>) or underscores (<code>___</code>) on a line of their own. Leave a blank line before it, because <code>---</code> right under a line of text turns that text into a heading.</p>
<div class="gatsby-highlight" data-language="markdown"><pre class="language-markdown"><code class="language-markdown">Text above

<span class="token hr punctuation">---</span>

Text below</code></pre></div>
<h2 id="how-to-escape-characters-in-markdown" style="position:relative;"><a href="#how-to-escape-characters-in-markdown" aria-label="how to escape characters in markdown permalink" class="anchor before"><svg aria-hidden="true" focusable="false" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>How to escape characters in Markdown</h2>
<p>To show a symbol Markdown would otherwise interpret, like an asterisk, put a backslash (<code>\</code>) in front of it.</p>
<div class="gatsby-highlight" data-language="markdown"><pre class="language-markdown"><code class="language-markdown">\*This is not italic\*</code></pre></div>
<p>Result: *This is not italic*</p>
<p>These characters can be escaped: <code>\</code> <code>`</code> <code>*</code> <code>_</code> <code>{}</code> <code>[]</code> <code>()</code> <code>#</code> <code>+</code> <code>-</code> <code>.</code> <code>!</code> <code>|</code></p>
<h2 id="how-to-make-a-collapsible-section-in-markdown" style="position:relative;"><a href="#how-to-make-a-collapsible-section-in-markdown" aria-label="how to make a collapsible section in markdown permalink" class="anchor before"><svg aria-hidden="true" focusable="false" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>How to make a collapsible section in Markdown</h2>
<p>Markdown accepts HTML, so you can use the <code>&#x3C;details></code> and <code>&#x3C;summary></code> tags to create a block that opens on click. It's handy for hiding long logs or optional instructions in a README. Leave a blank line after <code>&#x3C;/summary></code> so the Markdown inside gets processed.</p>
<div class="gatsby-highlight" data-language="html"><pre class="language-html"><code class="language-html"><span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>details</span><span class="token punctuation">></span></span>
  <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>summary</span><span class="token punctuation">></span></span>Show install instructions<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>summary</span><span class="token punctuation">></span></span>

1. Clone the repository
2. Run `npm install`

<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>details</span><span class="token punctuation">></span></span></code></pre></div>
<details>
  <summary>Show install instructions</summary>
<ol>
<li>Clone the repository</li>
<li>Run <code>npm install</code></li>
</ol>
</details>
<h2 id="where-each-feature-works" style="position:relative;"><a href="#where-each-feature-works" aria-label="where each feature works permalink" class="anchor before"><svg aria-hidden="true" focusable="false" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Where each feature works</h2>
<p>The basics (headings, bold, italic, lists, links, images, quotes and code) work everywhere. Tables, strikethrough and task lists are <strong>GitHub Flavored Markdown (GFM)</strong> extensions: they work on GitHub, GitLab, VS Code and most modern editors, but some older tools don't render them.</p>]]></content:encoded>
    </item>
    <item>
      <title>Cómo resolver el Fizz Buzz con JavaScript con un bucle for</title>
      <link>https://girgetto.it/fizz-buzz/</link>
      <guid isPermaLink="true">https://girgetto.it/fizz-buzz/</guid>
      <pubDate>Wed, 04 May 2022 00:00:00 GMT</pubDate>
      <description>Este problema consiste en recorrer un array de números, si el número es un múltiplo de 3 tenemos que remplazarlo con la palabra FIZZ, si un múltiplo de 5 con la palabra BUZZ y si es un múltiplo de 3 y 5 con FIZZ BUZZ.</description>
      <dc:language>es</dc:language>
      <category>javascript</category>
      <category>algorithms</category>
      <content:encoded><![CDATA[<h2 id="intro" style="position:relative;"><a href="#intro" aria-label="intro permalink" class="anchor before"><svg aria-hidden="true" focusable="false" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Intro</h2>
<p>Este problema consiste en recorrer un array de números, si el número es un múltiplo de 3 tenemos que remplazarlo con la palabra <code>FIZZ</code>, si un múltiplo de 5 con la palabra <code>BUZZ</code> y si es un múltiplo de 3 y 5 con <code>FIZZ BUZZ</code>.</p>
<p>Ej. 1, 2, FIZZ, 4, BUZZ, FIZZ, 7, 8, FIZZ, BUZZ, 11, FIZZ, 13, 14, FIZZ BUZZ, ...</p>
<p>Primero de todo tenemos que conocer el operador de resto (%), este operador nos permite calcular la resta de una división.</p>
<p>ej. 3 % 2 es 1 y 3 % 3 es 0.</p>
<h2 id="crear-bucle-for" style="position:relative;"><a href="#crear-bucle-for" aria-label="crear bucle for permalink" class="anchor before"><svg aria-hidden="true" focusable="false" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Crear bucle for</h2>
<p>Como primera cosa creamos un bucle for que itere 15 veces y a cada iteración hacemos un console.log del contador</p>
<div class="gatsby-highlight" data-language="javascript"><pre class="language-javascript"><code class="language-javascript"><span class="token keyword">for</span> <span class="token punctuation">(</span>i <span class="token operator">=</span> <span class="token number">1</span><span class="token punctuation">;</span> i <span class="token operator">&lt;</span> <span class="token number">16</span><span class="token punctuation">;</span> i<span class="token operator">++</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
  console<span class="token punctuation">.</span><span class="token function">log</span><span class="token punctuation">(</span>i<span class="token punctuation">)</span>
<span class="token punctuation">}</span></code></pre></div>
<h2 id="primera-condición" style="position:relative;"><a href="#primera-condici%C3%B3n" aria-label="primera condición permalink" class="anchor before"><svg aria-hidden="true" focusable="false" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Primera condición</h2>
<p>Ahora podemos implementar una condición como <code>i % 3 ===  0</code> y si la condición es verdadera hacemos un <code>console.log('FIZZ')</code></p>
<div class="gatsby-highlight" data-language="javascript"><pre class="language-javascript"><code class="language-javascript"><span class="token keyword">for</span> <span class="token punctuation">(</span>i <span class="token operator">=</span> <span class="token number">1</span><span class="token punctuation">;</span> i <span class="token operator">&lt;</span> <span class="token number">16</span><span class="token punctuation">;</span> i<span class="token operator">++</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
  <span class="token keyword">if</span> <span class="token punctuation">(</span>i <span class="token operator">%</span> <span class="token number">3</span> <span class="token operator">===</span> <span class="token number">0</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
    console<span class="token punctuation">.</span><span class="token function">log</span><span class="token punctuation">(</span><span class="token string">'FIZZ'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
  <span class="token punctuation">}</span>

  console<span class="token punctuation">.</span><span class="token function">log</span><span class="token punctuation">(</span>i<span class="token punctuation">)</span>
<span class="token punctuation">}</span></code></pre></div>
<p>Si nos fijamos en los números en consola podemos ver que ahora en todos los números divisibles por 3 tenemos la Palabra FIZZ,</p>
<p>OUTPUT</p>
<p>1, 2, FIZZ, 3,  4, BUZZ, FIZZ, 6, ...</p>
<p>⚠️ pero tenemos un problema, también estamos imprimiendo los números divisibles por 3, para evitar eso podemos incrementar el contador en el momento que entra en la condición con <code>i++</code>:</p>
<div class="gatsby-highlight" data-language="javascript"><pre class="language-javascript"><code class="language-javascript"><span class="token keyword">for</span> <span class="token punctuation">(</span>i <span class="token operator">=</span> <span class="token number">1</span><span class="token punctuation">;</span> i <span class="token operator">&lt;</span> <span class="token number">16</span><span class="token punctuation">;</span> i<span class="token operator">++</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
  <span class="token keyword">if</span> <span class="token punctuation">(</span>i <span class="token operator">%</span> <span class="token number">3</span> <span class="token operator">===</span> <span class="token number">0</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
    console<span class="token punctuation">.</span><span class="token function">log</span><span class="token punctuation">(</span><span class="token string">'FIZZ'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
    i<span class="token operator">++</span>
  <span class="token punctuation">}</span>

  console<span class="token punctuation">.</span><span class="token function">log</span><span class="token punctuation">(</span>i<span class="token punctuation">)</span>
<span class="token punctuation">}</span></code></pre></div>
<h2 id="segunda-condición" style="position:relative;"><a href="#segunda-condici%C3%B3n" aria-label="segunda condición permalink" class="anchor before"><svg aria-hidden="true" focusable="false" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Segunda condición</h2>
<p>lo mismo haremos con el 5 para imprimir BUZZ</p>
<div class="gatsby-highlight" data-language="javascript"><pre class="language-javascript"><code class="language-javascript"><span class="token keyword">for</span> <span class="token punctuation">(</span>i <span class="token operator">=</span> <span class="token number">1</span><span class="token punctuation">;</span> i <span class="token operator">&lt;</span> <span class="token number">16</span><span class="token punctuation">;</span> i<span class="token operator">++</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
  <span class="token keyword">if</span> <span class="token punctuation">(</span>i <span class="token operator">%</span> <span class="token number">3</span> <span class="token operator">===</span> <span class="token number">0</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
    console<span class="token punctuation">.</span><span class="token function">log</span><span class="token punctuation">(</span><span class="token string">'FIZZ'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
    i<span class="token operator">++</span>
  <span class="token punctuation">}</span>
  
  <span class="token keyword">if</span> <span class="token punctuation">(</span>i <span class="token operator">%</span> <span class="token number">5</span> <span class="token operator">===</span> <span class="token number">0</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
    console<span class="token punctuation">.</span><span class="token function">log</span><span class="token punctuation">(</span><span class="token string">'BUZZ'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
    i<span class="token operator">++</span>
  <span class="token punctuation">}</span>

  console<span class="token punctuation">.</span><span class="token function">log</span><span class="token punctuation">(</span>i<span class="token punctuation">)</span>
<span class="token punctuation">}</span></code></pre></div>
<h2 id="tercera-condición" style="position:relative;"><a href="#tercera-condici%C3%B3n" aria-label="tercera condición permalink" class="anchor before"><svg aria-hidden="true" focusable="false" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Tercera condición</h2>
<p>Para el FIZZ BUZZ tenemos que utilizar el operador <code>&#x26;&#x26;</code> para comprobar que las dos condiciones sean verdaderas y tiene que ser la primara condición! ⚠️</p>
<div class="gatsby-highlight" data-language="javascript"><pre class="language-javascript"><code class="language-javascript"><span class="token keyword">for</span> <span class="token punctuation">(</span>i <span class="token operator">=</span> <span class="token number">1</span><span class="token punctuation">;</span> i <span class="token operator">&lt;</span> <span class="token number">16</span><span class="token punctuation">;</span> i<span class="token operator">++</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
  <span class="token keyword">if</span> <span class="token punctuation">(</span>i <span class="token operator">%</span> <span class="token number">3</span> <span class="token operator">===</span> <span class="token number">0</span> <span class="token operator">&amp;&amp;</span> i <span class="token operator">%</span> <span class="token number">5</span> <span class="token operator">===</span> <span class="token number">0</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
    console<span class="token punctuation">.</span><span class="token function">log</span><span class="token punctuation">(</span><span class="token string">'FIZZ BUZZ'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
    i<span class="token operator">++</span>
  <span class="token punctuation">}</span>
  
  <span class="token keyword">if</span> <span class="token punctuation">(</span>i <span class="token operator">%</span> <span class="token number">3</span> <span class="token operator">===</span> <span class="token number">0</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
    console<span class="token punctuation">.</span><span class="token function">log</span><span class="token punctuation">(</span><span class="token string">'FIZZ'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
    i<span class="token operator">++</span>
  <span class="token punctuation">}</span>
  
  <span class="token keyword">if</span> <span class="token punctuation">(</span>i <span class="token operator">%</span> <span class="token number">5</span> <span class="token operator">===</span> <span class="token number">0</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
    console<span class="token punctuation">.</span><span class="token function">log</span><span class="token punctuation">(</span><span class="token string">'BUZZ'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
    i<span class="token operator">++</span>
  <span class="token punctuation">}</span>

  console<span class="token punctuation">.</span><span class="token function">log</span><span class="token punctuation">(</span>i<span class="token punctuation">)</span>
<span class="token punctuation">}</span></code></pre></div>]]></content:encoded>
    </item>
  </channel>
</rss>
