[웹서비스 개발팀] 타입스크립트

Anna Park·2024년 6월 27일

webservice

목록 보기
6/33

웹서비스 프론트엔드 과정

0. 오늘 과정 설명

오늘은 끝날때 배운걸 가지고 샘플 프로젝트 만들어 볼 예정 -> abstract에 막혀 못했습니다..

git clone(프로젝트 관리)

git clone URL / git init
git add .
git commit -m "디렉토리"
git push origin main

1. 타입의 구조


화살표가 종속된 의미로 이해, 여기에 +Unknown(새로 생긴 개념)이 있음

2. 타입

2-1. any 타입



as any는 가급적으로는 사용하지 않는 것이 좋다

2-2. unknown 타입



any의 불안정성을 해소하기 위해 나왔다

2-3. 인터섹션 타입

2-4. 유니온 타입

2-5. 리터럴 타입

2-6. 타입 별칭

2-7. 함수 반환 타입

function runMore(distance:number):number{
	return ditance + 10;
}
console.log(runMore(20));    

2-8. 함수 타입

2-9. never 타입

3. ES6

3-1. 화살표 함수

3-2. 구조 분해

3-3. find(found) 새로운 배열 함수


조건을 만족하는 첫번째 값

3-4. filter 새로운 배열 함수


조건을 만족하는 모든 값

3-5. map 새로운 배열 함수

3-6. reduce 새로운 배열 함수

3-7. some, every새로운 배열 함수

3-8. set

고유한 값이나 객체의 컬렉션

const userIds={1,2,1,3}
const uniqueIds = new Set(userIds);
console.log(uniqueIds);
uniqueIds.add(10);
console.log('add 10', uniqueIds);
console.log('has', uniqueIds.has(3));
console.log('size', uniqueIds.size);
for (let item of uniqueIds){
	console.log('iterate', item); }

3-9. map

Today -?

추상클래스와 일반클래스, 추상클래스와 인터페이스 구분
네임스페이스=내부 모듈
interface -implements, class -extends
삼항연산자 value = (조건) ? statment1 : statment2;
value = (조건1) ? statment1 : (조건2) ? statment2;
val1 !=null ? val1: val2; //val1이 null이 아니면 그대로 null이면 val2

profile
교육개발, 웹서비스개발, 수학강사

0개의 댓글