Skip to content

Instantly share code, notes, and snippets.

View tjtaylo's full-sized avatar

Travis Taylor tjtaylo

View GitHub Profile
@wiledal
wiledal / template-literals-3-for-loops.js
Last active March 13, 2023 22:47
Template Literals example: For loops
/*
Template literals for-loop example
Using `Array(5).join(0).split(0)`, we create an empty array
with 5 items which we can iterate through using `.map()`
*/
var element = document.createElement('div')
element.innerHTML = `
<h1>This element is looping</h1>
${Array(5).join(0).split(0).map((item, i) => `