Skip to content

Commit f6364f3

Browse files
committed
🚩: λ°°μ—΄ νƒ€μž… μ§€μ • 방식
1 parent 37592af commit f6364f3

File tree

2 files changed

+23
-7
lines changed

2 files changed

+23
-7
lines changed

β€Žsrc/data/arr.tsβ€Ž

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,13 @@
11
export const arrNumber = [2, 6, 3, 6, 5];
2-
export const arrString = ['1'];
2+
export const arrString = ['1'];
3+
4+
//이 λ‘˜μ€ 같은 νƒ€μž…μ΄λ‹€. νƒ€μž…μ„ λ”°λ‘œ μ§€μ •ν•˜μ§€ μ•ŠμœΌλ©΄ string으둜 기본값을 κ°€μ§„λ‹€. - νƒ€μž… μΆ”λ‘ 
5+
let element_1: string = 'bmw';
6+
let element_2 = 'bmw';
7+
8+
const element = {
9+
age: 30,
10+
isAdult: true,
11+
a: [1, 2, 3],
12+
a2: [1, 2, 3],
13+
}

β€Žsrc/index.tsβ€Ž

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
1-
import { arrNumber, arrString } from "./data/arr";
1+
//λ°°μ—΄ 방식 νƒ€μž… μ§€μ •
22

3-
const showItems = (arr: string[]) => {
4-
arr.forEach(element => console.log(element));
5-
}
6-
//μ—¬κΈ°μ„œ ν•¨μˆ˜ 자체 νŒŒλΌλ©”ν„°μ—μ„œλ„ νƒ€μž…μ„ κ°œλ°œμžκ°€ 직접 λ„£μ–΄λ³Ό 수 μžˆμ§€ μ•Šμ„κΉŒ?
7-
showItems(arrString);
3+
let age: number = 30;
4+
let isAdult: boolean = true;
5+
let a: number[] = [1, 2, 3];
6+
//μ œλ„€λ¦­μ„ μ‚¬μš©ν•΄μ„œ Array의 νƒ€μž…μ„ μ§€μ •
7+
let a2: Array<number> = [1, 2, 3];
8+
9+
let week1: string[] = ['mon', 'tue', 'wed'];
10+
let week2: Array<string> = ['mon', 'tue', 'wed'];
11+
12+
// week1.push(3); //-> error νƒ€μž…μ΄ μΌμΉ˜ν•˜μ§€ μ•ŠμŒ

0 commit comments

Comments
Β (0)