전체 글

    javascript 란?

    목적 : - javascript는 웹에서 보조 기능을 처리하기 위해 만들어진 언어입니다. 탄생배경 : - 1995년 인터넷 시장의 90%를 점유하고 있던 넷스케이프 커뮤니케이션즈에서 브라우저에서 동적인 기능을 하는 프로그래밍 언어를 만들기로 결정 - 1996년 넷스케이프 커뮤니케이션즈에서 자바스크립트 발표 - 1997년 ECMAScript로 표준 출현(javascript는 상표권 문제로 사용하지 못함) - 1999년 Ajax 등장 - 2006년 jQuery 등장 - 2008년 구글 V8 javascript 엔진 발표 - 2009년 Node.js 발표 : 웹브라우저를 벗어난 런타임 환경 제공 ES5 발표 :HTML5와 표준 사항으로 이때부터 javasciprt가 큰 발전을 이뤘다 - 2015년 ES6 발표..

    type-index

    interface Props{ name:string //배열에 인덱스 걸기 [key:string]:string } const p:Props={ name:"aas", a:'d', b:'e', c:'3', 0:'d', 1:'t' } let keys:keyof Props interface User{ name:string, age:number, hello(msg:string):void } let keysOfUser: keyof User keysOfUser = "age" let helloMethod:User["hello"] helloMethod = function(msg:string){ }

    type-alias

    interface User5{ name:string } interface Action5{ do():void } //타입 별칭 정하기 type UserAction = User5 & Action5 function createUserAction():UserAction{ return{ do(){}, name:'' } } type StringOrNumber = string | number type Arr = T[] type P = Promise type User2={ name:string } class UserImpl implements User2{ name="asdf" } type UserState = "PENDING" | "APPROVED" | "REJECTED" function checkUser(user:U..

    intersection/union

    interface User3{ name:string } interface Action{ do():void } //리턴값을 intersection으로 두개로 가능 function createUserAction2(u:User3,a:Action):User3 & Action{ return {...u,...a} } const u = createUserAction2({name:'jay'},{do(){}}) //union function compare(x:string|number,y:string|number){ if(typeof x==='number' && typeof y ==='number'){ return x===y?0: x>y ? 1 : -1 } if(typeof x==='string' && typeof y =..

    generic2

    //인터페이스도 제네릭 가능 interface DB{ add(v:T):void get():T } interface JSONSerialier{ serialize():string } //클레스도 제네릭 사용가능 //제네릭 구현하면 클라스도 제네릭 선언 필요 class LocalDB implements DB{ constructor(private localStorageKey:string){ } add(v:T){ localStorage.setItem(this.localStorageKey,v.serialize()) } get():T{ const v = localStorage.getItem(this.localStorageKey) return (v) ? JSON.parse(v) : null } } // interfac..