JavaScript native functions build-your-own series

JavaScript’s built-in call() is defined on the object Function.prototype, according to MDN:

The call() method calls a function with a given this value and arguments provided individually.[thisArg[, arg1, arg2, ...argN]])

For example, we have the following code:

Harness the power of $attrs and $listeners

Vue.js has been gaining popularity in recent years, and in my opinion, Vue is the first-choice frontend framework for small to middle-sized projects. There are a bunch of UI component libraries for Vue, the most popular one among them seems to have been Vuetify. Often based on our own business and project requirements, we need to customize a UI library component, and this article shows how to build our custom components based on Vuetify.

Create a Vue + Vuetify project

Let’s first create a new Vue project with Vuetify. Following the Vuetify guide, it is very easy:

We first create a new project named custom-ui using…

What does the JavaScript new operator do under the hood?

The concept of the new operator is from class-based object-oriented languages such as C++ and Java. It is used to create an instance or object of a class and in general, it mainly does two things:
Instantiating — allocating spaces in memory for the object being created, and
Initialization — executing the constructor method and initializing the object (e.g. its member variables and member functions).

For JavaScript, it is not a class-based language like Java, it is prototype-based, so its new operator does its very specific things and is very different from the new operator in Java.
According to MDN:

Chris Y.

Full-stack “digital builder”, Agile advocator

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store