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
// Object destructuring | |
//Object | |
const response = { | |
status: 200, | |
data: { | |
user: { | |
name: 'Rachel', | |
title: 'Editor in Chief' | |
}, |
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 delayedRandom(){ | |
const random = Math.random(); | |
return new Promise(resolve => setTimeout(()=>resolve(random), 100)); | |
} | |
async function* generateDelayedRandoms(){ | |
let num; | |
num = await delayedRandom() | |
yield 'One ' + num; |
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 { getRandomWordSync, getRandomWord } = require("word-maker"); | |
const fs = require("fs"); | |
console.log("It works!"); | |
// YOUR CODE HERE | |
//Additional functions | |
//asynchronous in loop |
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
//inferance bottom up | |
// the compiler know function result type, baesed on it`s arguments | |
let userId = (a: string, b: number): string =>a+b; | |
//******************************* | |
//Union type (variable can be any of these types) | |
let thing: string | number | string[]; | |
// Alias | |
type thing = string | number | string[]; |
NewerOlder