From c7febf288d66fc0968088f424021abb38f6948cb Mon Sep 17 00:00:00 2001 From: CaptainPangyo Date: Thu, 5 Nov 2020 23:18:50 +0900 Subject: [PATCH] add why-ts code --- why-ts/app.js | 25 +++++++++++++++++++++++++ why-ts/index.html | 19 +++++++++++++++++++ 2 files changed, 44 insertions(+) create mode 100644 why-ts/app.js create mode 100644 why-ts/index.html diff --git a/why-ts/app.js b/why-ts/app.js new file mode 100644 index 00000000..e957c26e --- /dev/null +++ b/why-ts/app.js @@ -0,0 +1,25 @@ +// api url +var url = 'https://jsonplaceholder.typicode.com/users/1'; + +// dom +var username = document.querySelector('#username'); +var email = document.querySelector('#email'); +var address = document.querySelector('#address'); + +// user data +var user = {}; + +function startApp() { + axios + .get(url) + .then(function (response) { + console.log(response); + user = response.data; + // TODO: 이름, 이메일, 주소 표시하기 + }) + .catch(function (error) { + console.log(error); + }); +} + +startApp(); diff --git a/why-ts/index.html b/why-ts/index.html new file mode 100644 index 00000000..9545784f --- /dev/null +++ b/why-ts/index.html @@ -0,0 +1,19 @@ + + + + + + Why Typescript? + + +

사용자 정보

+
+

이름:

+

이메일:

+

주소:

+
+ + + + +