본문 바로가기

Udemy

The Scope Chain function b(){ Execution Context console.log(myVar);myVar 1 (Reference to Outer Environment) > Global Execution Context } function a(){Execution Context var myVar = 2;myVar 2 (Reference to Outer Environment) > Global Execution Context b(); } var myVar = 1;Global Execution Context a();myVar 1 // 1 function b의 경우 myVar을 찾을 수 없어서 outer environment를 참조 b() > a() > Global Execution Context 이러한 것을 스코프 ..
The 'new' keyword Creates an object out of thin airAssigns the value of 'this' to be that objectAdds 'return this' to the end of the functionCreates a link(which we can access as _proto_) between the object created and the prototype property of the constructor function
closure and keyword 'this' 'CLOSURE' 외부 함수의 변수에 접근할 수 있는 내부 함수 Closure only exists when an inner function makes use of variables defined from an outer function that has returned. Closure does not exist if you do not return an inner function and if that inner function does not make use of variables returned by an outer function. JavaScript will only remember values that are being used inside of the inner function, not all ..
Object-Oriented Javascript and Prototypal Inheritance Inheritance: One object gets access to the properties and methods of another object Reflection : An object can look at itself, Listening and changing its properties and methods
Objects and Functions Function Statement : initially put in to memory, but have to invoke it for it to execute 함수 선언식은 항상 상단으로 show(); function show() { console.log('displayed!'); } Function Expression( not hoisted ) + ( parameter ) = Immediately Invoked Function Expression(IIFE) : A unit of code that results in a value not initially put in to memory, when it hits this line it creates this function object on the fly...
Types and Operators Primitive Type (Undefine, Null, Boolean, Number, String, Symbol): A type of data that represents a single value Undefine: represents lack of existence (you shouldn't set a variable to this)Null: represents lack of existence (you can set a variable to this) Operator: A special function that is syntactically (Written) differently Generally, operators take two parameters and return one result
Execution Contexts and Lexical Environments Syntax Parser: A program that reads your code and determines what it does and If it grammar is valid(character by character, using a set of rules for what's valid syntax and decide what is your intend) Lexical Environment: Where something sits physically in the code you write'Lexical' means 'having to do with words or grammer'. A lexical environment exists in programming languages in which where..
Advanced Array Method Recap forEach: iterates over an array, runs a callback on each value and returns undefined map: creates a new array, runs a callback on each value and pushes the result of each callback in the new array filter: creates a new array, runs a callback on each value and if the result of the callback returns true, that value is added to the new array some: iterates through an array and runs a callback on ea..
Advanced Array Methods(reduce) reduce : Accepts a callback function and an optional second parameter Iterates through an array Runs a callback on each value in the array The first parameter to the callback is either the first value in the array or the optional second parameter The first parameter to the callback is often called "accumulator" The returned value from the callback becomes the new value of accumulatorWhatever is ..
Advanced Array Methods(some & every) some: Iterates through an array Runs a callback on each value in the array If the callback returns true for at least one single value, return true Otherwise, return falseThe result of the callback will ALWAYS be a boolean function some(array, callback){for (var i = 0; i return num.toString().split('').some(function(val){ return val[key] === 0; > return val === "0"; });} /*Write a function called..