diff --git a/exercise.js b/exercise.js new file mode 100644 index 0000000..f89b380 --- /dev/null +++ b/exercise.js @@ -0,0 +1,34 @@ +// const object = { +// "p1": 1, +// "p2": 2, +// "p3": 3, +// "p4": { +// "p5": 4 +// }, +// } + +// console.log(object); +// var size = Object.keys(object).length; +// console.log(size); + +// let myPromise = new Promise(function(myResolve, myReject) { +// // "Producing Code" (May take some time) + +// myResolve(); // when successful +// myReject(); // when error +// }); + +// // "Consuming Code" (Must wait for a fulfilled Promise) +// myPromise.then( +// function(value) { /* code if successful */ }, +// function(error) { /* code if some error */ } +// ); + +// console.log((fetch('portal.tycoonstats.com/api/demo'))); + +async function abc() { + const data = await fetch('https://portal.tycoonstats.com/api/demo') + console.log(data.text()) +} + +abc(); \ No newline at end of file diff --git a/fetch.html b/fetch.html new file mode 100644 index 0000000..fce96f8 --- /dev/null +++ b/fetch.html @@ -0,0 +1,16 @@ + + +
+