Skip to content

Instantly share code, notes, and snippets.

View chris-gaona's full-sized avatar
🌴
On vacation

Chris Gaona chris-gaona

🌴
On vacation
  • Livermore, CA
View GitHub Profile
@chris-gaona
chris-gaona / js-reduce.js
Created April 2, 2017 23:23
Various ways to utilize the amazing reduce function on arrays in javascript
// create an object using reduce function on array with count of each item
var votes = [
'angular',
'angular',
'react',
'react',
'react',
'angular',
'ember',
'vanilla',
@chris-gaona
chris-gaona / js-async-examples.js
Last active March 18, 2017 14:30
Looking at the difference between for loop, forEach, .map, & .filter methods + flattening arrays of arrays
// // FIRST WAY
// // using a simple for loop
// function getStockSymbols(stocks) {
// var results = [],
// counter,
// stock;
//
// for (counter = 0; counter < stocks.length; counter++) {
// stock = stocks[counter];
// results.push(stock.symbol);