This file contains hidden or 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
function makeIterator(array) { | |
var nextIndex = 0; | |
console.log("nextIndex =>", nextIndex); | |
return { | |
next: function() { | |
return nextIndex < array.length | |
? { value: array[nextIndex++], done: false } | |
: { done: true }; | |
} |
This file contains hidden or 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 React, { Component } from "react"; | |
import { Image, Text, View, Button, Picker } from "react-native"; | |
import { styles } from "../utils/styles"; | |
import SomeCustomComponent from "./SomeCustomComponent"; | |
// see https://github.com/necolas/react-native-web | |
class App extends Component { | |
_onButtonPress() { | |
//do some things |
This file contains hidden or 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 { AppRegistry } from "react-native"; | |
import App from "./components/App"; | |
AppRegistry.registerComponent("App", () => App); | |
AppRegistry.runApplication("App", { | |
rootTag: document.getElementById("root") | |
}); |
This file contains hidden or 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
//Explicit vs. Implicit Coercion in JS | |
let a = 100; | |
let b = a + ''; //IMPLICIT COERCION | |
console.log(b) //'100' | |
let c = String ( a ) //EXPLICIT COERCION | |
console.log(c) //'100' |
This file contains hidden or 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
function logger({ getState }) { | |
return (next) => (action) => { | |
console.log('will dispatch', action) | |
return returnValue | |
} | |
} | |
const initialState = {} | |
const enhancers = [] | |
const middleware = [ |
This file contains hidden or 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
function logger({ getState }) { | |
return (next) => (action) => { | |
console.log('will dispatch', action) | |
return returnValue | |
} | |
} | |
const initialState = {} | |
const enhancers = [] | |
const middleware = [ |
This file contains hidden or 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 initialState = {} | |
const enhancers = [] | |
const middleware = [ | |
thunk, | |
routerMiddleware(history) | |
] | |
const composedEnhancers = compose( |
This file contains hidden or 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
var a = { name: 'Pilsner', abv: 5.4 };// Remains untouched | |
var b = Object.assign({}, a, {abv: 6.7})// b = { name: 'Pilsner', abv: 6.7 }} | |
var a = [0, 1, 2]// Remains untouched | |
var b = a.concat(3)// b = [0, 1, 2, 3] | |
var c = a.filter((val) => != 2)// c = [0, 1, 3] | |
var a = {name: 'Dave Matthews', songs: [0, 1, 2]}// Remains untouched | |
var b = Object.assign({}, a, {name: 'Jack Johnson'});// b = {name: 'Jack Johnson', songs: [0, 1, 2]} | |
b.songs = a.songs.concat(3);// b = {name: 'Jack Johnson', things: [0, 1, 2, 3]} |
This file contains hidden or 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 { createStore } from 'redux'; | |
// Store | |
const dataStore = createStore(r, { | |
beerlist: { | |
name: 'IPA', | |
abv: 7.4 | |
}, | |
beersOnTap: 1, | |
liveMusicHistory: { |
This file contains hidden or 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 { createStore } from 'redux'; | |
// Store | |
const dataStore = createStore(r, { | |
beerlist: { | |
name: 'IPA', | |
abv: 7.4 | |
}, | |
beersOnTap: 1, | |
liveMusicHistory: { |