Skip to content

Instantly share code, notes, and snippets.

@electerious
electerious / repeat.js
Last active August 17, 2017 13:25
Repeat a function for a specified amount of times
const repeat = (fn, times) => {
fn()
--times && repeat(fn, times)
}
@electerious
electerious / createArray.js
Created September 16, 2017 13:54
Create an array with a specified length
const createArray = (length) => Array.apply(null, Array(length))
@electerious
electerious / hasClassNames.js
Created September 16, 2017 13:57
Checks if an element has any of multiple classes
const hasClassNames = (elem, classNames) => classNames.filter((className) => elem.classList.contains(className)).length>0
<input autocorrect="off" ...>
<input autocapitalize="off" ...>
<input autocomplete="tel" ...>
<input autocomplete="email" ...>
<input required ...>
<input pattern="\d*" ...>
<input type="email" ...>
<input type="url" ...>
<label for="email">E-Mail</label>
<input id="email" ...>
<input placeholder="Jane Doe" ...>