title: Escaping single quotes in a console log output
body: <p>I am putting custom JavaScript into a GTM container to loop through an array of hyperlinks that I have used .map to create. Then create a JSON output based on the values within it (using a combination of the index number and the href values).</p>
  <p><strong>NOTE: ES6 solutions will not work here as GTM unfortunately does not support it.</strong></p>
  <p>I am having trouble with escaping the single quotation marks:</p>
  <p>I want the output to be like this:</p>
  <pre><code>'id': '1',
  'name': 'https://example.com',
  'creative': 'store-banner',
  'position': 'slot-1'
  </code></pre>
  <p>and below is my attempt to print out the array into console log and assign it the appropriate syntax:</p>
  <pre><code>for (var i = 0; i &lt; carouselArray.length; ++i) {
    console.log(&quot;'id':&quot; + '\(i+1)'\ + &quot;, 'name': &quot; + '\carouselArray[i]'\ + &quot;, 'creative': store-banner, 'position': slot-&quot; + \'(i+1)'\);
  }
  </code></pre>
  <p>I am trying to get the dynamic values be surrounded by single quotations but I keep getting syntax errors and can not seem to figure out what I am doing wrong. Can someone please help to show me what I am missing or doing incorrect?</p>