DynamicPL
-
let, const, block scope, function scope and IIFEsDynamicPL/Javascript 2019. 10. 24. 15:05
1. Overview Variables declared with var in ES5 are function-scoped and Variables declared with let and const in ES6 are block-scoped. 2. Description 2.1 Function-scoped Variables, which declared var, are only accessible inside of a function, but not from the outside. And we would use a variable before the declaration, it would be an "undefined" cause of hoisting. function driversLicence5(passedT..
-
Bind, Call and ApplyDynamicPL/Javascript 2019. 10. 24. 02:18
1. Overview Functions are a special kind of object and also get a couple of special methods that they inherit from the function constructor object such as call, apply and bind methods. These methods allow us to call a function and set this variable manually. 2. Description var john = { name: 'John', age: 26, job: 'teacher', presentation: function(style, timeOfDay) { if (style === 'formal') { con..
-
First-Class Functions and IIFEDynamicPL/Javascript 2019. 10. 24. 00:31
1. Overview We can pass functions as arguments and return it and store it into variables because functions are always first-class functions in Javascript because they are effectively objects. 2. Description 2.1 Passing Functions as Arguments These functions are called "callback function" because they are functions that we pass into functions that will then call them later. var years = [1990, 196..
-
Primitives vs. ObjectsDynamicPL/Javascript 2019. 10. 24. 00:18
1. Overview Let's distinguish differences between primitives and objects 2. Description 2.1 Difference 2.1.1 Primitives Variables containing primitives actually hold that data inside of the variable itself. 2.1.2 Objectives Variables associated objects do not actually contain the object but instead, they contain a reference to the place in memory where the object is stored. That means these vari..
-
Classes and subclassesDynamicPL/Javascript 2019. 10. 23. 12:42
1. Overview Class is added in ES6 and doesn't add anything new to the language, but just synthetic sugar over the way we do prototypal inheritance in Javascript. Classes simply make it easier to implement inheritance and to create objects based on blueprints which are called function constructors in ES5. 2. Previous way to inherit methods var Person5 = function(name, yearOfBirth, job) { this.nam..
-
Promises, Promisification, Async, Await, and AjaxDynamicPL/Javascript 2019. 10. 23. 10:42
1. Overview The Promise object represents the eventual completion (or failure) of an asynchronous operation and its resulting value. But syntax to consume promise can still be quite confusing and difficult to manage. And so in ES8 or ES2017, something called Async/Await was introduced to JavaScript in order to make it a lot easier for developers to consume promises. 2. Motivation 2.1 Callback he..
-
Event Loop, Execution Stack, Web APIs, and Message QueueDynamicPL/Javascript 2019. 10. 23. 01:49
1. Overview Clarify the difference between synchronous and asynchronous in JavaScript. And see How these things to work deeply with Event Loop, Execution Stack, WEB APIs, and Message Queue. 2. Description 2.1 Synchronous One statement is processed after the other, line by line in a single thread in the JavaScript engine 2.2 Asynchronous Allow asynchronous functions to run in the background We pa..
-
List, Dictionary, Set Comprehensions, and Difference between List Comprehensions and Generator expressionsDynamicPL/Python 2019. 10. 22. 16:56
1. Overview After reading this article you’ll learn: What are the list comprehensions in Python What are set comprehensions and dictionary comprehensions 2. Definition List comprehensions provide us with a simple way to create a list based on some iterable. During the creation, elements from the iterable can be conditionally included in the new list and transformed as needed. An iterable is some..