Skip to content

Instantly share code, notes, and snippets.

@yuvalbl
Created January 22, 2018 15:40
Show Gist options
  • Save yuvalbl/c2019597dbc55788e4762dfdbfa7e068 to your computer and use it in GitHub Desktop.
Save yuvalbl/c2019597dbc55788e4762dfdbfa7e068 to your computer and use it in GitHub Desktop.
JS Bin // source https://jsbin.com/fudatiz
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
</head>
<body>
<script src="https://unpkg.com/@reactivex/[email protected]/dist/global/Rx.js"></script>
<script src="script.js"></script>
<script id="jsbin-javascript">
'use strict';
var data = ['1', '1', 'foo', '2', '3', '5', 'bar', '8', '13'];
//1. sync code
var source = data;
//2. async code (stream)
// const source = Rx.Observable.interval(400).take(9)
// .map(i => data[i]);
var result = source;
// .map(x => parseInt(x))
// .filter(x => !isNaN(x))
// .reduce((x, y) => x + y);
console.log(result);
// result.subscribe(x => console.log(x))
</script>
<script id="jsbin-source-javascript" type="text/javascript">const data = ['1', '1', 'foo', '2', '3', '5', 'bar', '8', '13'];
//1. sync code
const source = data
//2. async code (stream)
// const source = Rx.Observable.interval(400).take(9)
// .map(i => data[i]);
const result = source
// .map(x => parseInt(x))
// .filter(x => !isNaN(x))
// .reduce((x, y) => x + y);
console.log(result);
// result.subscribe(x => console.log(x))
</script></body>
</html>
'use strict';
var data = ['1', '1', 'foo', '2', '3', '5', 'bar', '8', '13'];
//1. sync code
var source = data;
//2. async code (stream)
// const source = Rx.Observable.interval(400).take(9)
// .map(i => data[i]);
var result = source;
// .map(x => parseInt(x))
// .filter(x => !isNaN(x))
// .reduce((x, y) => x + y);
console.log(result);
// result.subscribe(x => console.log(x))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment