-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Related to: #1
- Loading branch information
Crayon
committed
Apr 2, 2022
1 parent
d861953
commit 5fdae91
Showing
5 changed files
with
276 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
interface ServerPart { | ||
name: string; | ||
age: number; | ||
group: string; | ||
mbti: string[]; | ||
} | ||
|
||
const serverPart: ServerPart = { | ||
name: '김소령', | ||
age: 5, | ||
group: 'YB', | ||
mbti: ['ENFJ', 'ANGEL'] | ||
} | ||
|
||
const serverMembers: ServerPart[] = [ | ||
{ | ||
name: '김소령', | ||
age: 5, | ||
group: 'YB', | ||
mbti: ['ENFJ', 'ANGEL'] | ||
}, | ||
{ | ||
name: '김소령', | ||
age: 5, | ||
group: 'YB', | ||
mbti: ['ENFJ', 'ANGEL'] | ||
} | ||
]; | ||
|
||
console.log(serverMembers); | ||
|
||
interface Closet { | ||
name: string; | ||
shirt: number; | ||
pants: number; | ||
hat?: number; | ||
sunglassess?: number; | ||
} | ||
|
||
const closet: Closet[] = [ | ||
{ | ||
name: '이승헌', | ||
shirt: 10, | ||
pants: 10, | ||
hat: 4, | ||
sunglassess: 3 | ||
} | ||
] |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,104 @@ | ||
const sopt = { | ||
season: 30, | ||
group: ["YB", "OB"], | ||
part: ["서버", "기획", "디자인", "안드로이드", "웹", "iOS"], | ||
president: "김규민", | ||
introduce: function () { | ||
this.part.map((name) => { | ||
console.log(`솝트 내 파트는 ${name} 파트가 있어요`); | ||
}); | ||
}, | ||
}; | ||
|
||
console.log(sopt.group); | ||
sopt.introduce(); | ||
|
||
console.log(sopt.season); | ||
|
||
let array = [1, true, "string"]; | ||
console.log(array); | ||
|
||
let array2 = [ | ||
{ | ||
name: "김소령", | ||
age: 5, | ||
}, | ||
{ | ||
name: "박정무", | ||
age: 15, | ||
}, | ||
]; | ||
|
||
console.log(array2); | ||
console.log(typeof array2); | ||
|
||
// function menu(dinner) { | ||
// return `오늘 메뉴는 ${dinner} 입니다.`; | ||
// } | ||
|
||
// const srt2 = menu("삼겹살"); | ||
// console.log(srt2); | ||
|
||
// 함수 표현식 | ||
const menu = (dinner) => { | ||
return `오늘 메뉴는 ${dinner}입니다.`; | ||
}; | ||
|
||
const str2 = menu("곱창"); | ||
console.log(str2); | ||
|
||
const func = (num) => { | ||
return num * num; | ||
}; | ||
|
||
const multiple = (func, num) => { | ||
console.log(func(num)); | ||
}; | ||
|
||
multiple(func, 3); | ||
|
||
let a = 2; | ||
let x = 2; | ||
// let b = a++; 2 | ||
// let b = ++a; 3 | ||
// console.log(b); | ||
|
||
let c = 2 + 3; | ||
let d = 2 * 3; | ||
let e = 3 - 2; | ||
let f = 4 / 2; | ||
|
||
console.log(c, d, e, f); | ||
|
||
// 비교 연산자 == (값) || === (값, 타입) | ||
if (a === x) { | ||
console.log("a === x"); | ||
} | ||
|
||
let y = "2"; | ||
|
||
if (a === y) { | ||
console.log("a === y"); | ||
} | ||
|
||
if (a == y) { | ||
console.log("a == y"); | ||
} | ||
|
||
if (d % f == 0) { | ||
console.log("나머지 0"); | ||
} | ||
|
||
// AND, OR | ||
if (a === 2 && d === 6) { | ||
console.log("hi"); | ||
} | ||
|
||
if (a === 4 || d === 6) { | ||
console.log("a가 4 또는 d가 6"); | ||
} | ||
|
||
console.log(typeof a); | ||
if (typeof a == "number") { | ||
console.log(a); | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
const name = "장서현"; | ||
console.log(typeof name); | ||
|
||
let age = 18; | ||
console.log(typeof age); | ||
|
||
let server = true; | ||
console.log(typeof server); | ||
|
||
// 안녕하세요 제 이름은 장서현입니다. 제 나이는 18살입니다 | ||
console.log( | ||
"안녕하세요 제 이름은 " + name + "입니다. 제 나이는 " + age + "살 입니다." | ||
); | ||
console.log(`안녕하세요 제 이름은 ${name}입니다. 제 나이는 ${age}살 입니다.`); | ||
|
||
console.log(typeof null); | ||
console.log(typeof undefined); | ||
|
||
let arr = ["안녕", 1, "나는", true]; | ||
|
||
let num = [1, 2, 3, 4]; | ||
const newNumArr = num.map((x) => x * 2); | ||
|
||
console.log(newNumArr); | ||
|
||
newNumArr.map((x) => { | ||
console.log(x); | ||
}); | ||
|
||
for (const x of newNumArr) { | ||
console.log(x); | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
let name1: string = '이승헌'; | ||
console.log(name1); | ||
|
||
let grade: number = 4; | ||
|
||
let isDeleted: boolean = false; | ||
|
||
const sum = (x: number, y: number): number => { | ||
return x * y; | ||
} | ||
|
||
// const ages: number[] = [1, 2, ,3 ,4, 5]; | ||
// const ages2: Array<number> = [1, 2, 3, 4]; | ||
|
||
const strArray: string[] = ["hi", "hello"]; | ||
const strArray2: Array<string> = ["hi", "hello"]; | ||
|
||
const f1 = (obj: object): void => { | ||
console.log(obj); | ||
} | ||
|
||
const f2 = (obj: Object): void => { | ||
console.log(obj); | ||
} | ||
|
||
f2([1, 2, 3, 4]); | ||
f2("hihi"); | ||
|
||
const div = (x: number, y: number): number => { | ||
return x /y; | ||
} | ||
|
||
let p: null = null; | ||
|
||
// let x: null = 2; | ||
|
||
let b: undefined = undefined; | ||
|
||
// let y: undefined = null; | ||
|
||
// angle-bracket 타입 선언 | ||
let name3: any = '이승헌' // any 아무 타입이나 가능 | ||
let name3Length: number = (<string>name3).length; | ||
|
||
// as | ||
let name4: any = '서버'; | ||
let name4Length: number = (name4 as string).length; | ||
|
||
console.log(name4Length); |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
var name = "채정아"; | ||
var name = "이승헌"; | ||
|
||
console.log(name); | ||
|
||
let name2 = "박진수"; | ||
// let name2 = "김희빈"; 에러발생 | ||
|
||
console.log(name2); | ||
|
||
let name3 = "이동현"; | ||
name3 = "주효식"; | ||
|
||
console.log(name3); | ||
|
||
const name4 = "김루희"; | ||
// name4 = "박진형"; 에러발생 | ||
|
||
console.log(name4); | ||
|
||
if (true) { | ||
var x = "var variable"; | ||
} | ||
|
||
console.log(x); | ||
|
||
if (true) { | ||
const y = "const variable"; | ||
} | ||
|
||
// console.log(y); 에러발생 | ||
|
||
function foo() { | ||
if (true) { | ||
var name5 = "채정아"; | ||
console.log("if - block -", name5); | ||
} | ||
|
||
console.log("function - block -", name5); | ||
} | ||
|
||
foo(); | ||
console.log("global - ", name5); |