๋ถ๋ฅ ์ ์ฒด๋ณด๊ธฐ
ํ์ ์คํฌ๋ฆฝํธ 1์ฅ ์ฐ์ต๋ฌธ์ | ํ์ ์คํฌ๋ฆฝํธ์ ์ถ๋ก
1. ํ์ ์คํฌ๋ฆฝํธ์ ์ถ๋ก ๋ฐฉ์ ์๊ธฐ let a = 10423; //number let b = "apple"; //string const c = "grape"; //"grape" let d = [true, false, true]; //boolean[] let e = { ์ด๋ฆ: "smith" }; //{ ์ด๋ฆ: string } let f = [1, false, "ํ๊ธธ๋"]; //(number | boolean | string)[] const g = [3]; //number[] let h = null; //any 2. ์๋ฌ์ ์์ธ ํ์ ํ๊ธฐ a. let i: 3 = 3; i = 4; ~ //'4'ํ์์ '3'ํ์์ ํ ๋นํ ์ ์์ต๋๋ค. ์์ธ : i ๋ณ์๋ฅผ ๋ช ์์ ์ผ๋ก ์ค์ง ํ๋์ ๊ฐ์ ๋ํ๋ด๋ ํ์ ์ธ 'ํ์ ๋ฆฌํฐ๋ด..

์ง์ ํ ํ์ ์คํฌ๋ฆฝํธ์ ์์, Union ํ์
์ ๋์จ ํ์ ์ ํ์ ์คํฌ๋ฆฝํธ์์ ์ฝ๋ฉํ ๋ ๊ต์ฅํ ๋ง์ด ์ฐ๊ฒ ๋ ๊ฒ์ด๋ค. OR ๋๋ ํฉ์งํฉ์ผ๋ก ์ดํดํ๋ฉด ์ถฉ๋ถํ ๊ฒ์ด๋ค. type Direction = "left" | "right" | "up" | "down"; function move(direction: Direction) { console.log(direction); } type TileSize = 8 | 16 | 32; const tileA: TileSize = 16; //const tileB: TileSize = 10; //10 ํ์์ TileSize ํ์์ ํ ๋นํ ์ ์์ต๋๋ค. //function : login -> success, fail type SuccessState = { response: { body: string; }; }; type F..
ํ์ ์คํฌ๋ฆฝํธ๋ฅผ ์ฐ๋ ์ด์ , type alias์ String Literal Types
type alias(๋ด๊ฐ ์๋ก์ด ํ์ ์ ์ ์ํ ์ ์๋ค)๋ฅผ ์ด์ฉํ๋ฉด ๊ธฐ๋ณธ์ ์ธ ํ์ ๋ถํฐ ๋ณต์กํ๊ณ ์ ๊ตํ ํ์ ๊น์ง ์ ์ํ ์ ์๋ค. ๊ฐ๋ น type Text = string; ์์ ๊ฐ์ด ์์ฑํ๋ฉด Text๋ผ๋ ์๋ก์ด ํ์ ์ ๋ฌธ์์ด์ ๋งํ๋ค๊ณ ์ง์ ํด์ฃผ๋ ๊ฒ์ด๋ค. type Text = string; const name: string = "ํ๊ธธ๋"; const nickName: Text = "ํฉ์ง์ด"; console.log(name); //ํ๊ธธ๋ console.log(nickName); //ํฉ์ง์ด type alias ๋ฅผ ํตํด์ ๋ค์๊ณผ ๊ฐ์ด ํน์ ํ๋กํผํฐ๊ฐ ๊ฐ์ ๋ ๊ฐ์ฒด ํ์ ์ ๋ง๋ค ์๋ ์๋ค. ๊ทธ๋ฆฌ๊ณ ๋ณ์์ ํ์ ์ type alias๋ก ์์ฑํ ๊ฒ์ผ๋ก ์ง์ ํด์ฃผ๋ฉด ํน์ ํ๋กํผํฐ๋ง ํ ๋นํ ์ ์์ ๋ฟ๋๋ฌ ํน์ ํ๋กํผํฐ์ ํ..
์คํ๋ ๋ ์ฐ์ฐ์, ๋ฐฐ์ด, ํํ
์คํ๋ ๋ ์ฐ์ฐ์์ ํจ๊ป ์ฐ๋ ๊ฒฝ์ฐ function addNum(...numbers: number[]): number { return numbers.reduce((a, b) => a + b); } console.log(addNum(1, 2)); console.log(addNum(1, 2, 3)); console.log(addNum(1, 2, 3, 4)); 3 6 10 ๋ฐฐ์ด๊ณผ ํํ nst fruits: string[] = ["์ฌ๊ณผ", "๋ฐ๋๋"]; const numbers: Array = [1, 2, 3, 4, 5]; const cloths: [string, number] = ['์ฒญ๋ฐ์ง', 2]; console.log(cloths[0]); //์ฒญ๋ฐ์ง ํํ ์ฌ์ฉํ๋ ๊ฒ์ ๊ถ์ฅํ์ง ์๋๋ค. const cloth..
ํฌ์ธํฐ, ์ด์คํฌ์ธํฐ
[C์ธ์ด] ํฌ์ธํฐ, ์ด์คํฌ์ธํฐ ๊ฐ๋ , ์ค์ต ์์ ์๋ฒฝ ์ดํด (tistory.com)
[๋๋ฆผ์ฝ๋ฉ ์๋ฐ์คํฌ๋ฆฝํธ] ๋น๋๊ธฐ promise
https://youtu.be/JB_yU6Oe2eE ์ฃผ์์ ์ฝ๋ฐฑ ์ง์ฅ ์์ // class UserStorage { // loginUser(id, password, onSuccess, onFailure) { // setTimeout(() => { // if ( // (id === "ํ๊ธธ๋" && password === "์๋ฒ์ง") || // (id === "ํฉ์ง์ด" && password === "์ฒญ์ฐ๋ฆฌ") // ) { // onSuccess(id); // } else { // onFailure(new Error("not found")); // } // }, 2000); // } // getRoles(user, onSuccess, onFailure) { // setTimeout(() => { // if (..
[๋๋ฆผ์ฝ๋ฉ ์๋ฐ์คํฌ๋ฆฝํธ]๋น๋๊ธฐ์ ์์ ์ฝ๋ฐฑ์ง์ฅ
https://youtu.be/s1vpVCrT8f4 index.js class UserStorage { loginUser(id, password, onSuccess, onFailure) { setTimeout(() => { if ( (id === "ํ๊ธธ๋" && password === "์๋ฒ์ง") || (id === "ํฉ์ง์ด" && password === "์ฒญ์ฐ๋ฆฌ") ) { onSuccess(id); } else { onFailure(new Error("not found")); } }, 2000); } getRoles(user, onSuccess, onFailure) { setTimeout(() => { if (user === "ํ๊ธธ๋") { onSuccess({ name: "ํ๊ธธ๋", role: "์๋ฒ..
![[Git]์ง์ญ ์ ์ฅ์์ ํ๋ก์ ํธ๋ฅผ ์
๋ก๋ํ๋ ค๋ค defualt ๋ธ๋ฐ์น๋ master๊ฐ ์๋๋ผ origin์ธ ๊ฑด์ ๊ดํ์ฌ](https://img1.daumcdn.net/thumb/R750x0/?scode=mtistory2&fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FcvA4v9%2FbtrTk1ZhrpD%2Fyed8wilCw2kEKzKsW12CH1%2Fimg.png)
[Git]์ง์ญ ์ ์ฅ์์ ํ๋ก์ ํธ๋ฅผ ์ ๋ก๋ํ๋ ค๋ค defualt ๋ธ๋ฐ์น๋ master๊ฐ ์๋๋ผ origin์ธ ๊ฑด์ ๊ดํ์ฌ
๊นํ๋ธ(Github) 2. ์๊ฒฉ ์ ์ฅ์ ๋ง๋ค๊ธฐ + ์ง์ญ ์ ์ฅ์์ ํ๋ก์ ํธ๋ฅผ ์ ๋ก๋ ํ๊ธฐ : ๋ด ํ๋ก์ ํธ๋ฅผ github์ ์ฌ๋ฆฌ๊ธฐ (tistory.com) [ 05.23 ] git (1) - git upload procedure / ๋ด ์์ ๋ฌผ git hub์ ์ ๋ก๋ ํด๋ณด๊ธฐ. (velog.io) [ 05.23 ] git (1) - git upload procedure / ๋ด ์์ ๋ฌผ git hub์ ์ ๋ก๋ ํด๋ณด๊ธฐ. ๊ฐ๋ฐ์์ํ๊ณ ์์์ด ๋ค์ด๋ดค์ง๋ง ์ ํํ ๋ชฐ๋๋ git ์ด ๋ฌด์์ธ์ง ๋ค๋ค๋ณด๊ฒ ๋ค.git : ์ ์ฅ ๊ด๋ฆฌ์ ๊ฐ๋ .์ปดํจํฐ์ ์ฉ๋์ ์ ํด์ ธ ์๋๋ฐ ์์ ๋ฌผ์ ๊ณ์ ๋์ด๊ฐ๋ค๋ฉด ์ด๋ป๊ฒ ๋ ๊น?์ปดํจํฐ๋ ๋๋ ค์งํ ๊ณ velog.io [GitHub] ๊นํ๋ธ์ ํ๋ก์ ํธ ์ฌ๋ฆฌ๊ธฐ (tistory.com) cd ํ๋ก์ ํธ ํด๋ git ..

60. ์์ธ ์ฒ๋ฆฌํ๊ธฐ(1)
https://youtu.be/Os_o-7eGu7Y ์ฑํฐ 12 ์์ธ ์ฒ๋ฆฌํ๊ธฐ ์ด ์ฅ์ ํต์ฌ ๊ฐ๋ ๊ตฌ์กฐ์ ์์ธ ์ฒ๋ฆฌ๊ฐ ๋ฌด์์ธ์ง ์ดํดํ๋ค try~catch~finally ๋ฌธ์ ์ด์ฉํ ์์ธ ์ฒ๋ฆฌ ๋ฐฉ๋ฒ์ ์ตํ๋ค System.Exception ํด๋์ค๋ฅผ ์ดํดํ๋ค throw ๋ฌธ์ ์ด์ฉํ์ฌ ์์ธ๋ฅผ ๋์ง๋ ๋ฐฉ๋ฒ์ ์ตํ๋ค ์ฌ์ฉ์ ์ ์ ํด๋์ค๋ฅผ ์ ์ํ๊ณ ์ฌ์ฉํ๋ ๋ฐฉ๋ฒ์ ์ตํ๋ค ์์ธ์ ๋ํ์ฌ ์ ์: ํ๋ก๊ทธ๋๋จธ๊ฐ ์๊ฐํ๋ ์๋๋ฆฌ์ค์์ ๋ฒ์ด๋๋ ์ฌ๊ฑด, ์ด๊ฒ์ ์์ธ๋ผ๊ณ ๋ถ๋ฅธ๋ค. ์1) ์ซ์๊ฐ ์ ๋ ฅ๋์ด์ผ ํ๋ ๋ณ์์ ๋ฌธ์์ด ์ ๋ ฅ ์๋ ์2) ํ์ผ์ ์ ์ฅ์ ํ๋๋์คํฌ ์ฉ๋ ์์ง ์์ธ์ฒ๋ฆฌ : ํ๋ก๊ทธ๋จ์ ์ค๋ฅ๋ ๋ค์ด์ผ๋ก ์ด์ด์ง์ง ์๋๋ก ์ ์ ํ๊ฒ ์ฒ๋ฆฌํ๋ ๊ฒ using System; using System.Collections; using..