Skip to content

Instantly share code, notes, and snippets.

View dnasca's full-sized avatar

Derrik dnasca

View GitHub Profile
:first-child i === 0
:last-child i === arr.length - 1
:only-child arr.length === 1
:nth-child(even) i % 2
:nth-child(odd) !(i % 2)
:nth-child(n) i === n - 1
:nth-last-child(n) i === arr.length - n
@dnasca
dnasca / es7-async-await.js
Created September 15, 2017 04:29 — forked from msmfsd/es7-async-await.js
Javascript fetch JSON with ES7 Async Await
// Async/Await requirements: Latest Chrome/FF browser or Babel: https://babeljs.io/docs/plugins/transform-async-to-generator/
// Fetch requirements: Latest Chrome/FF browser or Github fetch polyfill: https://github.com/github/fetch
// async function
async function fetchAsync () {
// await response of fetch call
let response = await fetch('https://api.github.com');
// only proceed once promise is resolved
let data = await response.json();
// only proceed once second promise is resolved