본문 바로가기

Develope_Web_Programming/01_HTML&CSS&JS14

7.오브젝트 넌 뭐니?? /** * Objects * one of the JavaScript's data types. * a collection of related data and/or functionality. * Nearly all objects in JavaScript are instance of Object * Object = {key : value}; */ // 1. Literal and properties const name = 'ellie'; const age = 4; print(name,age); function print(name, age){ console.log(name); console.log(age); } //고루고루 하기 어려워 진다!! function prints(person){ console.log(p.. 2021. 2. 14.
6. 클래스와 오브젝트의 차이 💡 클래스는 연관된 키워드(여기서는 속성(fields)과 행동(method))를 묶어놓은 일종의 컨테이너라고 할 수 있다!! 이것을 가능하게 하는 것이 객체지향 프로그래밍!! class (template, declare once, no data in) object ( instance of a class, created many times, data in) 'use strict' /** * Object-oriented programming * class : template * object : instance of a class * JavaScript classes * - introduced in ES6 * - syntactical sugar over prototype-based inheritance * *.. 2021. 2. 13.
5. Arrow Function은 무엇인가? 💡 function은 원하는 기능에 맞춰서 만든 함수!! function → sub-program!! input → output!! API(Application Programming Interface)에 대부부분의 기능이 다 적혀 있다!! //Function // fundamental building block in the program // subprogram can be used multiple times // performs a task or calculates a value // 1. Function declaration //function name(parm1, param2) { body... return;} // one function === one thing // naming : doSomet.. 2021. 2. 13.
4. 코딩의 기본 operator, if, for loop 💡 객체 자체는 예를 들어 ellie.name의 경우, ellie는 ref를 찾게 되어 여기서의 name이 ellie를 가르키고 있고 ellie, age의 경우 20을 가르키고 있다!! → 결국 object는 ref의 차이!! //Note!! /** * Immutable data types : premitive types, froznen object (i.e. object.freeze()) * Mutable data types : all ojbects by default are mutable in JS * favor immutable data type always for a few reasons : * - security * - thread safety * - reduce humanm mistakes *.. 2021. 2. 13.
반응형