Created
January 22, 2018 15:40
-
-
Save yuvalbl/c2019597dbc55788e4762dfdbfa7e068 to your computer and use it in GitHub Desktop.
JS Bin // source https://jsbin.com/fudatiz
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
<!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> |
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
'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