반응형

드림코딩 4

[자바스크립트] class vs object, 객체지향 언어 클래스 정리

드림코딩 엘리 - 자바스크립트 강의 #6 class (붕어빵틀) template, 청사진 declare once no date in object (팥붕어빵, 슈크림붕어빵, etc.) instance of a class created many times date in Object-oriented programming class: template object: instance of a class JavaScript classes introduce in ES6 syntactical sugar over prototype-base inheritance 1. Class declarations class Person { // constructor constructor(name, age) { // fields this..

[자바스크립트] Arrow function

드림코딩 엘리 - 자바스크립트 강의 #4 Function fundamental building block in the program subprogram can be use multiple times performs a task or calculates a value 1. Function declaration function name(param1, param2) { body... return; } one function === one thing naming: doSomething, command, verb e.g. createCardAndPoint → createCard, createPoint function is object in JS 2. Parameters primitive parameters: pa..

[자바스크립트] operator, if, for loop, 코드리뷰 팁

드림코딩 엘리 - 자바스크립트 강의 #4 1. String concatenation console.log('my' + ' cat'); ⇒ my cat console.log('1' + 2); ⇒ 12 console.log(${1+2}); ⇒ 3 \n \t 등등 .. 2. Numeric operators exponentiation : ** 3. Increment and decrement operators let counter = 2; const preIncrement = ++counter; // 3 const postIncrement = counter++; // 3 (그후에 4됨) // --counter, counter-- 4. Assignment operators =, +=, -=, *=, /= 5. Co..

[자바스크립트] Data types, let vs var, hoisting

드림코딩 엘리 - 자바스크립트 강의 #3 1. Use strict added in ES5 use this for Vanilla JavaScript ex) 'use strict'; 2. Variable, rw(read/write) let (added in ES6) var (don't ever use this!) var hoisting (move declaration from bottom to top) : 선언하기도 전에 할당할 수 있음 has no block scope : (), {} 뚫고 나옴 3. Constant, read(read only) use const whenever possible. only use let if variable needs to change. ex) const daysInWee..

반응형