Web front/JavaScript
-
Object (2/9, 2/10)Web front/JavaScript 2022. 2. 10. 01:58
1/ object 다양한 활용 방법 let hunbu = new Object(); hunbu.name = '흥부'; hunbu.kor = 100; hunbu.eng = 95; hunbu.total = hunbu.kor + hunbu.eng; hunbu.avg = hunbu.total / 2; console.log(`${hunbu.name}님의 총점은 ${hunbu.total} / ${hunbu.avg}`); // new object 사용안하고 바로 가능 let angie = { name: '앤지', kor: 100, eng: 90, total: this.kor + this.eng,// this 아닌데 뭐지,,? avg: this.total / 2, } console.log(angie); // 구조 파악 ..
-
Variable (2/8)Web front/JavaScript 2022. 2. 8. 23:41
1/ 변수 (호이스팅)자바스크립트는 실행하기 전에 먼저 변수들 다 메모리에 저장하고 undefined으로 초기화 되어있다. 그리고 내려와서 초기화하면 그 때 값을 넣음. 2/ console에 출력하는 코드 3/ javascript를 다른 파일에 작성하고 src로 불러올때 4/ 각종 기능 warn, error, info console.warn('Warning Warning') console.error('Error Error') console.info('안내 메세지가 필요한 경우 똑같은디?') 5/ operator x = 10; y = 20; result = ++x + y++; console.log(x, y, result); console.log(''); // 11 21 31 6/ ceil, floor Ma..