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
arr = [4, 9, 16] | |
def sqrt(a): | |
return Math.sqrt(a) | |
# use Array.map() with Python function | |
roots = arr.map(sqrt).join(",") | |
# use Array.map() or use arrow function | |
roots = arr.map(i => Math.sqrt(i)).join(",") |
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
export const uniqueId = Date.now().toString(36) + Math.random().toString(36).substring(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
{ | |
"Meta Data": { | |
"1. Information": "Daily Prices (open, high, low, close) and Volumes", | |
"2. Symbol": "IBM", | |
"3. Last Refreshed": "2022-04-08", | |
"4. Output Size": "Compact", | |
"5. Time Zone": "US/Eastern" | |
}, | |
"Time Series (Daily)": { | |
"2022-04-08": { |
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
from 'rxjs' import forkJoin, lastValueFrom, map | |
ids = [2, 7, 4, 9, 5] | |
httpRequests$ = ids | |
.map( | |
requestId => httpRequest$("GET", "https://jsonplaceholder.typicode.com/posts/" + requestId) | |
.pipe( | |
map(r => {requestId, response: r.data}) | |
) |
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
from 'rxjs' import forkJoin, lastValueFrom, map | |
ids = [2, 7, 4, 9, 5] | |
async def run_Sequential(): | |
data = [] | |
for requestId in ids: | |
response = httpGet("https://jsonplaceholder.typicode.com/posts/" + requestId) | |
data.push({requestId, response}) |