ProgrammingFarmer

Article Tag: JavaScript

JavaScript2024-09-08

Understanding JS Prototypes: From Prototype, Prototype Chain to Prototype Pollution

JS prototypes may seem distant from developers, but they are actually very close, as the native functions developers use are always related to the Prototype Chain. Furthermore, prototype pollution is a security issue, and if developers better understand prototypes, they can avoid writing anti-pattern code.

Redux, JavaScript2022-01-20

Understanding Redux Source Code (3) - Let's Implement combineReducers

In the previous two articles about Redux source code, we implemented createStore and applyMiddleware. In this article, we will implement combineReducers, which is responsible for integrating multiple reducers, to understand how Redux accomplishes this.

Redux, JavaScript2021-12-30

Understanding Redux Source Code (2) - Implementing middlewares, applyMiddleware, and createStore enhancer

Following the previous Redux series article where we implemented createStore's getState, dispatch, and subscribe, this article will advance to implementing Redux middleware-related functionality such as applyMiddleware and createStore's enhancer. Let's explore Redux more deeply with curiosity.

Redux, JavaScript2021-12-01

Understanding Redux Source Code (1) - Implementing createStore's getState, dispatch, and subscribe

I was curious about how Redux implements centralized state management and unidirectional data flow concepts, so I decided to read the Redux source code and implement a basic createStore function, focusing on the getState, dispatch, and subscribe APIs.

JavaScript2021-07-25

Understanding JavaScript Execution Flow: The Event Loop Explained Through Code Examples

When learning JavaScript execution flow, it's essential to understand the Event Loop, including concepts like Call Stack, Callback Queue, Macrotasks, and Microtasks. This article explains these in detail, helping you better understand execution order when combining promises, setTimeout, and other asynchronous operations.

JavaScript2021-06-01

Principles and Implementation of Shallow Copy and Deep Copy in JavaScript

When copying Object data types in JavaScript, the address is copied rather than the original value, so manipulating the copied variable can easily affect the original variable and vice versa, potentially causing unexpected bugs. To solve these problems, it's essential to understand the two copying methods for Object data types - Shallow Copy and Deep Copy.

JavaScript2021-05-20

Understanding JavaScript Variable Passing: Pass by Value, Pass by Reference, or Pass by Sharing?

In JavaScript, you often hear that primitive type variables are passed by value, while object type variables are passed by reference. However, when researching deeper, you'll encounter the term pass by sharing, or even assertions that JavaScript is entirely pass by value. What's really going on? This article will explore how variables are stored in memory and copied, gradually building an understanding of pass by value, pass by reference, and pass by sharing in JavaScript.

JavaScript2020-11-29

parseInt / parseFloat / Number, Comparing Methods for Converting Strings to Numbers

Recently at work, I encountered choices between using parseInt or Number for string type conversion, so I read the ES6 specifications and MDN definitions to broadly understand the differences between parseInt / parseFloat / Number. The article explains why parseInt(010, 10) results in 8.

JavaScript2020-10-25

JS Variable Declaration, Differences Between var and let/const

When I started learning JS in 2019, using let/const was already advocated, yet many resources online still use var. What are their differences?