<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Forem: Renata Karolina </title>
    <description>The latest articles on Forem by Renata Karolina  (@renatarko).</description>
    <link>https://forem.com/renatarko</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F885190%2F823b1211-bafe-4e73-887d-21bfa953a701.jpeg</url>
      <title>Forem: Renata Karolina </title>
      <link>https://forem.com/renatarko</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/renatarko"/>
    <language>en</language>
    <item>
      <title>What are UTM Parameters and How to Use Them in Tracking Online Marketing Campaigns.</title>
      <dc:creator>Renata Karolina </dc:creator>
      <pubDate>Wed, 03 Apr 2024 14:26:38 +0000</pubDate>
      <link>https://forem.com/woovi/what-are-utm-parameters-and-how-to-use-them-in-tracking-online-marketing-campaigns-4767</link>
      <guid>https://forem.com/woovi/what-are-utm-parameters-and-how-to-use-them-in-tracking-online-marketing-campaigns-4767</guid>
      <description>&lt;p&gt;We can say that obtaining information about accesses, conversions, and leads in projects you are working on is essential. Whether it's a personal or business website, tracking visits and interaction with your product or service is indeed very important. And one way to do this is by using a simple yet very powerful tool, UTM parameters.&lt;/p&gt;

&lt;h2&gt;
  
  
  What is UTM?
&lt;/h2&gt;

&lt;p&gt;UTM - Urchin Traffic Monitor are parameters added to URLs. The tags track and measure the effectiveness of online campaigns, meaning you can identify which content works and where it works best. This parameterization will detail the overall origin of the traffic, making it possible to analyze the performance of different campaigns and marketing channels.&lt;/p&gt;

&lt;h3&gt;
  
  
  What are UTM Tags?
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;utm_source&lt;/code&gt;&lt;br&gt;
This parameter indicates the source, the referring source that sent the traffic. That is, it will show where users are coming from to reach you. Some examples are search engines: Google, Instagram, YouTube, email ad...&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;utm_medium&lt;/code&gt;&lt;br&gt;
Indicates the means by which the link was shared or accessed, some examples: informative email, Instagram bio link, link in the YouTube video description, cost-per-click ad.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;utm_campaign&lt;/code&gt;&lt;br&gt;
Indicates a specific promotion, product, or campaign associated with the link, for example: tennis_new_b_launch, black_friday, discount_10.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;utm_term&lt;/code&gt;&lt;br&gt;
Mainly used in sponsored link campaigns, this parameter is used to identify the keywords that triggered the ad.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;utm_content&lt;/code&gt;&lt;br&gt;
Used to differentiate variations of the same ad or identify exactly what was clicked to bring the user. If we have two different buttons in the same ad, we can differentiate them with this tag.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Example of a URL:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;https://woovi.com?utm_source=youtube&amp;amp;utm_medium=video_description&amp;amp;utm_campaign=pix_checkout&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;To add the tags to the landing pages on Woovi, we call the function linkUtmBuilder below:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;linkUtmBuilder&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
  &lt;span class="nx"&gt;mainUrl&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;string&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="nx"&gt;utmParams&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;key&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;string&lt;/span&gt;&lt;span class="p"&gt;]:&lt;/span&gt; &lt;span class="nx"&gt;string&lt;/span&gt; &lt;span class="p"&gt;},&lt;/span&gt;
&lt;span class="p"&gt;):&lt;/span&gt; &lt;span class="nx"&gt;string&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="nx"&gt;object&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;utmsValid&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
    &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;utm_source&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;utm_medium&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;utm_campaign&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;utm_term&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;utm_content&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="p"&gt;];&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;isUtmValid&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;Object&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;keys&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;utmParams&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;every&lt;/span&gt;&lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="nx"&gt;key&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt;
    &lt;span class="nx"&gt;utmsValid&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;includes&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;key&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
  &lt;span class="p"&gt;);&lt;/span&gt;


  &lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;isUtmValid&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;utmQueryString&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;Object&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;entries&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;utmParams&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
      &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;map&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
        &lt;span class="p"&gt;([&lt;/span&gt;&lt;span class="nx"&gt;key&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;value&lt;/span&gt;&lt;span class="p"&gt;])&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt;
          &lt;span class="s2"&gt;`&lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;key&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;toLowerCase&lt;/span&gt;&lt;span class="p"&gt;()}&lt;/span&gt;&lt;span class="s2"&gt;=&lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;value&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;toLowerCase&lt;/span&gt;&lt;span class="p"&gt;().&lt;/span&gt;&lt;span class="nf"&gt;replace&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sr"&gt;/&lt;/span&gt;&lt;span class="se"&gt;[\s&lt;/span&gt;&lt;span class="sr"&gt;-&lt;/span&gt;&lt;span class="se"&gt;]&lt;/span&gt;&lt;span class="sr"&gt;/g&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;_&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)}&lt;/span&gt;&lt;span class="s2"&gt;`&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="p"&gt;)&lt;/span&gt;
      &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;join&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;&amp;amp;&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;


    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;urlWithUtm&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;`&lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;mainUrl&lt;/span&gt;&lt;span class="p"&gt;}${&lt;/span&gt;
      &lt;span class="nx"&gt;mainUrl&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;includes&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;?&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;?&lt;/span&gt; &lt;span class="dl"&gt;''&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;?&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;
    &lt;span class="p"&gt;}${&lt;/span&gt;&lt;span class="nx"&gt;utmQueryString&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;`&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;urlWithUtm&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;


  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="na"&gt;message&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Some utm tag is incorrect&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="p"&gt;};&lt;/span&gt;
&lt;span class="p"&gt;};&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The function accepts two parameters: the main URL where the UTM parameters will be added, and an object specifying the tag and its value.&lt;/p&gt;

&lt;p&gt;Firstly, we check the validity of the parameters passed. If they are considered valid, we perform a simple formatting, replacing any spaces or hyphens with underscores, according to the standard formatting for the tags defined by our team. Then, we return the complete URL with the formatted parameters. If any parameter is not valid, we issue a message indicating that one of the UTM tags is incorrect.&lt;/p&gt;

&lt;h3&gt;
  
  
  Remember
&lt;/h3&gt;

&lt;p&gt;It is important to maintain a standard for the tags. If you use the word 'youtube' all lowercase, then always standardize using this format. Also, always choose only one symbol, for example, always a hyphen or always an underscore to separate the words. And remember, UTM tags are query strings, so they are always composed of a key-value pair separated by '&amp;amp;'.&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;Finally, we have seen that the use of UTM parameters can offer valuable insights into the performance of content and marketing channels. Therefore, by assigning tags such as utm_source, utm_medium, utm_campaign, utm_term, and utm_content, it will be possible to identify the origin, the medium, the specific campaign, and even the keywords that led visitors to our site.&lt;/p&gt;

&lt;p&gt;This allows, especially for marketing professionals, a more comprehensive view of traffic, a deeper understanding of visitor behavior, and the optimization of digital marketing strategies to achieve better results.&lt;/p&gt;




&lt;p&gt;If you want to work in a startup in its early stages, This is your chance. &lt;a href="https://woovi.com/jobs/"&gt;Apply today!&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Woovi is a Startup that enables shoppers to pay as they please. To make this possible, Woovi provides instant payment solutions for merchants to accept orders.&lt;/p&gt;




&lt;p&gt;Photo by &lt;a href="https://unsplash.com/pt-br/@jessbaileydesigns"&gt;Jess Bailey&lt;/a&gt; na &lt;a href="https://unsplash.com"&gt;Unsplash&lt;/a&gt;&lt;/p&gt;

</description>
      <category>marketing</category>
      <category>utm</category>
    </item>
    <item>
      <title>Como criar um Array com N elementos com o mesmo valor no JS</title>
      <dc:creator>Renata Karolina </dc:creator>
      <pubDate>Thu, 30 Mar 2023 13:01:19 +0000</pubDate>
      <link>https://forem.com/renatarko/como-criar-um-array-com-n-elementos-com-o-mesmo-valor-no-js-28k7</link>
      <guid>https://forem.com/renatarko/como-criar-um-array-com-n-elementos-com-o-mesmo-valor-no-js-28k7</guid>
      <description>&lt;h2&gt;
  
  
  Para criar um array com N elementos contendo o mesmo valor:
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Utilize o construtor &lt;code&gt;Array()&lt;/code&gt; para criar um novo array;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Utilize o método &lt;code&gt;fill()&lt;/code&gt; para preencher o array com um valor específico;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;O método &lt;code&gt;fill()&lt;/code&gt; altera todos os elementos do array para o valor fornecido;&lt;br&gt;
&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const arr = Array(3).fill("abc")

console.log(arr) // ["abc", "abc", "abc"]

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Ao passar um argumento de número para o construtor &lt;code&gt;Array()&lt;/code&gt;, estamos criando um array com a quantidade de espaços vazios relativos ao valor passado como parâmentro.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;Array(3) // ['', '', '']&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;O método &lt;code&gt;fill()&lt;/code&gt; irá preencher os espaços do array com um valor específico.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;Array(3).fill("a") // ['a', 'a', 'a']&lt;/code&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Outra alternativa: Usar o método &lt;code&gt;Array.from()&lt;/code&gt;
&lt;/h3&gt;

&lt;p&gt;Como alternativa você pode usar também o método &lt;code&gt;Array.from()&lt;/code&gt; ao invés do contrututor &lt;code&gt;Array()&lt;/code&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const arr = Array.from({length: 3}).fill("abc")

console.log(arr) // ["abc", "abc", "abc"]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Passamos o comprimento desejado do array para o método &lt;code&gt;Array.from()&lt;/code&gt; como argumento.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Usando o método &lt;code&gt;Array.from&lt;/code&gt; fica um pouco mais explícito e mais fácil de ler do que instanciar o construtor Array.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Criando um Array de N elementos não primitivos com o mesmo valor
&lt;/h2&gt;

&lt;p&gt;Quando criamos um array de N elementos não primitivos com o mesmo valor, usamos o método &lt;code&gt;Array.from()&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const arr = Array.from({length: 3}, () =&amp;gt; {
  return {name: "Renata Karolina"}
})

console.log(arr) // [

  {name: "Renata Karolina"},
  {name: "Renata Karolina"},
  {name: "Renata Karolina"},

] 

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Criar um array de valores não primitivos é um pouco mais complicado porque temos que garantir que os objetos do array não tenha a mesma referência.&lt;/p&gt;

&lt;p&gt;Se os objetos estiverem armazenados no mesmo local na memória, assim que um objeto for atualizado então todos serão atualizados.&lt;/p&gt;

&lt;p&gt;Em vez disso, nós passamos a função &lt;code&gt;map()&lt;/code&gt; como segundo argumento para o método &lt;code&gt;Array.from()&lt;/code&gt;. A cada chamada da função &lt;code&gt;map()&lt;/code&gt;, retornamos um objeto.&lt;br&gt;
Então se você atualizar um objeto, as mudanças não irão refletir nos outros objetos porque todos eles estarão armazenados em locais diferentes na memória.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const arr = Array.from({length: 3}, () =&amp;gt; {
  return {name: 'Renata Karolina'};
});

console.log(arr); //
 [
   { name: 'Renata Karolina' },
   { name: 'Renata Karolina' },
   { name: 'Renata Karolina' }
 ]

arr[0].name = 'Renata Oliveira';

console.log(arr); // [ { name: 'Renata Oliveira' }, { name: 'Renata Karolina' }, { name: 'Renata Karolina' } ]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;A atualização da propriedade &lt;code&gt;name&lt;/code&gt; do primeiro objeto não alterou a propriedade dos outros objetos.&lt;/p&gt;

&lt;h2&gt;
  
  
  Criando um array bidimensional com N elementos do mesmo valor:
&lt;/h2&gt;

&lt;p&gt;A mesma abordagem pode ser usada para criar um array bidimensional com N elementos do mesmo valor.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const arr = Array.from({length: 2}, () =&amp;gt;
  Array.from({length: 3}, () =&amp;gt; {
    return {name: 'Renata Karolina'};
  }),
);

console.log(arr); // [
   [
    { name: 'Renata Karolina' },
    { name: 'Renata Karolina' },
    { name: 'Renata Karolina' }
  ],
  [
    { name: 'Renata Karolina' },
    { name: 'Renata Karolina' },
    { name: 'Renata Karolina' }
   ]
 ]

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Perceba que utilizamos o método &lt;code&gt;Array.from()&lt;/code&gt; duas vezes.&lt;/p&gt;

&lt;p&gt;A chamada externa para o método &lt;code&gt;Array.from()&lt;/code&gt; determina o tamanho do array da matriz externa.&lt;br&gt;
E a chamada aninhada para &lt;code&gt;Array.from()&lt;/code&gt; determina o tamanho de cada array aninhado.&lt;/p&gt;
&lt;h2&gt;
  
  
  Repetindo vários valores N vezes:
&lt;/h2&gt;

&lt;p&gt;Você pode usar a mesma abordagem se precisar criar um array que repita vários valores N vezes.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const arr = Array(3).fill(['a', 'b', 'c']).flat();

console.log(arr); // 
[
  'a', 'b', 'c',
  'a', 'b', 'c',
  'a', 'b', 'c'
]

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Passamos um array de valores para o método &lt;code&gt;Array.fill()&lt;/code&gt; e usamos o &lt;code&gt;Array.flat()&lt;/code&gt; para nivelar o array.&lt;/p&gt;

&lt;p&gt;Você também pode passar o &lt;code&gt;map()&lt;/code&gt; como segundo argumento para o &lt;code&gt;Array.from()&lt;/code&gt; quando estiver trabalhando com primitivos.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const arr = Array.from({length: 5}, () =&amp;gt; {
  return 'a';
});

console.log(arr); // [ 'a', 'a', 'a', 'a', 'a' ]

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;O exemplo acima cria um array de 5 elementos com o valor de "a".&lt;br&gt;
Você pode também encadear explicitamente uma chamada para a função &lt;code&gt;Array.map()&lt;/code&gt; na saída do método &lt;code&gt;Array.from()&lt;/code&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const arr = Array.from(Array(5)).map(() =&amp;gt; {
  return 'a';
});

console.log(arr); // [ 'a', 'a', 'a', 'a', 'a' ]

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;A função &lt;code&gt;Array.map()&lt;/code&gt; é chamada para cada elemento no array.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Ref:  &lt;a href="https://bobbyhadz.com/blog/javascript-create-array-n-elements-same-value"&gt;Create an Array with N elements, same Value in JavaScript&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;

</description>
      <category>javascript</category>
      <category>programming</category>
      <category>webdev</category>
    </item>
    <item>
      <title>Como pedir ajuda para devs?</title>
      <dc:creator>Renata Karolina </dc:creator>
      <pubDate>Fri, 01 Jul 2022 22:05:17 +0000</pubDate>
      <link>https://forem.com/renatarko/como-pedir-ajuda-para-devs-3in1</link>
      <guid>https://forem.com/renatarko/como-pedir-ajuda-para-devs-3in1</guid>
      <description>&lt;p&gt;🔎 Depois que você tentou por si só por alguns minutos, pesquisando na documentação, Google, GitHub (se for código aberto) ou vídeos no YouTube;&lt;/p&gt;




&lt;p&gt;E não conseguiu resolver, peça ajuda para a comunidade desta forma: &lt;/p&gt;

&lt;p&gt;Contextualize o que está acontecendo no seu código; fale quais possíveis soluções você tentou aplicar; e mostre seu código, se ele for extenso, coloque uma cópia no &lt;a href="https://gist.github.com/renatarko"&gt;gist&lt;/a&gt; e disponibilize o link.&lt;/p&gt;




&lt;p&gt;✔️ Exemplo de como perguntar!&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;"Estou trabalhando com HTML, CSS e JavaScript e minha estrutura é uma div com um formulário, um button e outra div com um conteúdo secundário. &lt;br&gt;
Quero adicionar um evento click para (após a validação do form) exibir div secundária na tela. &lt;br&gt;
Já li sobre &lt;a href="https://developer.mozilla.org/en-US/docs/Web/API/DOMTokenList/toggle"&gt;toggle&lt;/a&gt; , &lt;a href="https://developer.mozilla.org/en-US/docs/Web/API/Element/classList"&gt;classList&lt;/a&gt;, mas não consegui fazer funcionar.&lt;/p&gt;

&lt;p&gt;Segue trecho de código da minha tentativa: &lt;br&gt;
&lt;code&gt;// código&lt;/code&gt;&lt;br&gt;
Como posso fazer isso? "&lt;/p&gt;


&lt;/blockquote&gt;

&lt;p&gt;❌ Exemplo de como não perguntar!&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;"Alguém manja de CSS? pra me ajudar?"&lt;br&gt;
"Alguém já teve problema com divs no HTML?"&lt;br&gt;
"No meu código aparece "isso", no de vocês também? o que eu faço?"&lt;/p&gt;
&lt;/blockquote&gt;




&lt;p&gt;💬 Onde perguntar?&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Discord ou Slack das tecnologias que vc atua;&lt;br&gt;
 Issues/Discussions do GitHub;&lt;br&gt;
 Fórum e/ou Stack Overflow;&lt;br&gt;
 Reddit, Telegram;&lt;br&gt;
Twitter marcando cc &lt;a href="https://twitter.com/sseraphini"&gt;@sseraphini&lt;/a&gt;.&lt;/p&gt;
&lt;/blockquote&gt;




&lt;p&gt;Espero que tenha curtido, até a próxima!&lt;/p&gt;

&lt;p&gt;Obrigada. 🚀&lt;/p&gt;

</description>
    </item>
  </channel>
</rss>
