This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
console.log('is this thing on??'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const megamanBosses = { | |
[Symbol.iterator]: () => { | |
return { | |
next: () => { | |
const stop = Math.random() > 0.85; | |
if (!stop) { | |
return { | |
value: megaManNameCreator(), | |
done: false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Component } from ‘@angular/core’; | |
@Component({ | |
selector: ‘pokemon-home’, | |
template: ` | |
<div><h1>{{name}}</h1></div> | |
` | |
}) | |
export class PokemonHomeComponent { | |
name: string = ‘Pokemon, go!’; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const arr = [1,2,3]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const arr = [1,2,3]; | |
const mappedArr = arr.map(value => value + 1); // returns [2,3,4] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// overriding properties on Array.prototype is a bad idea. This is given for educational purposes only :D | |
Array.prototype.map = function(projectionFn) { | |
let retVal = []; | |
for (let i = 0; i < this.length; i++) { | |
retVal.push(projectionFn(this[i])); | |
} | |
return retVal; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const arr = [1,2,3]; | |
const filteredArr = arr.filter(v => v % 2 === 0); // [2] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Array.prototype.filter = function(predicateFn) { | |
let retVal = []; | |
for (let i = 0; i < this.length; i++) { | |
if (predicateFn(this[i]) { | |
retVal.push(this[i]); | |
} | |
} | |
return retVal; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const arr = [1,2,3,4,5,6]; | |
const composedArr = arr.map(x => x + 1).filter(y => y % 2 === 0); // [2,4,6]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const gameData = [ | |
{ | |
title: 'Mega Man 2', | |
bosses: [ | |
{ | |
name: 'Bubble Man', | |
weapon: 'Bubble Beam' | |
}, | |
{ | |
name: 'Metal Man', |
OlderNewer