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
async function testAsync() { | |
let response = await fetch('https://mock-wholesaleonline.getsandbox.com/testRedux'); | |
let result = await response.json(); | |
return result; | |
} | |
testAsync() | |
.then((result) => console.log(result)) | |
.catch((error) => console.log(error)) |
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
http://rxmarbles.com/#combineLatest |
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
function* generator(i) { | |
yield i; | |
yield i + 10; | |
} | |
var gen = generator(10); | |
console.log(gen.next().value); | |
// expected output: 10 |
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 { put, call, takeEvery} from 'redux-saga/effects'; | |
import { fetchMoviesApi} from './moviesApi'; | |
export function* fetchMoviesSaga(action) { | |
yield put({type: 'TOGGLE_LOADING', payload: true}); | |
try { | |
const movies = yield call(fetchMoviesApi); | |
yield put({type: 'TOGGLE_LOADING', payload: false}); | |
yield put({type: 'LOAD_INITIAL_MOVIES', payload: movies}); | |
} catch (e) { |
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 quotes = ["quote1", "quote2", "quote3", "quote4", "quote5"]; | |
class NotFound extends React.PureComponent { | |
render() { | |
let randomQuote = quotes[Math.floor(Math.random() * quotes.length)]; | |
return ( | |
<h1> | |
Quote: <strong>{randomQuote}</strong> | |
</h1> | |
); |
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
Object.prototype.testFunc = function () { | |
console.log('I am test from of global ') | |
} | |
function Person(name, age) { | |
this.name = name; | |
this.age = age; | |
this.printIdentity = function() { | |
return 'Mr. ' + this.name; |
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
class Person { | |
constructor(name, age) { | |
this.name = name; | |
this.age = age; | |
} | |
printIdentity() { | |
return "Mr. " + this.name; | |
} | |
testFunc() { | |
console.log("I am test from person"); |
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
// Say you have this function | |
function demo() { | |
var a = 1; | |
let b = 2; | |
if (1) { | |
var c = 3; | |
let d = 4; | |
console.log(a, b, c, d); | |
} | |
console.log(a, b, c, d); |
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
this.myVar = "outer"; | |
var obj = { | |
myVar: "inner", | |
myFunc1: function() { | |
console.log(this.myVar); | |
}, | |
myFunc2: () => { | |
console.log(this.myVar); | |
}, |
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
alias s='git status' | |
alias b='git branch' | |
alias p='git pull' | |
alias a='git add .' | |
co () { git checkout "$@"; } | |
m () { git commit -m "$@";} |
OlderNewer