Advanced core knowledge of front-end development 1.3 we don't recite API, we only implement API

Sometimes the interviewer doesn't force the developer to recite the API accurately. On the contrary, the interviewer likes to tell the interviewer how to use the API and let the interviewer implement the API. Implementing an API can examine the interviewer's understanding of the API and better reflect the developer's programming thinking and a ...

Added by smalband on Tue, 28 Dec 2021 14:10:27 +0200

sinon. spy, stub and mock of JS

sinon As you know, in Java unit testing, when you can't get the actual object, we can use Mock/Stub to mock our code, which is more convenient for us to test. EasyMock, JMock and Mockito can solve these problems. The concepts of spy, stub and mock are introduced. Similarly, we will encounter similar situations in front-end testing. Sinon.js is ...

Added by gokhul on Tue, 28 Dec 2021 12:29:23 +0200

Front end modularization

1. Background Recently, when using a front-end library, I looked at its documentation. The only way to import it is script, and I want to introduce this module in VueCLI environment. Open the entry file of this library as follows: When we see the keyword exports, we know that this is a module defined according to the CommonJs module specificat ...

Added by Grodo on Tue, 28 Dec 2021 06:36:08 +0200

Vue source code learning record - Vue initialization

Based on Li Yongning's homepage (juejin.cn) Learn and summarize the tutorial.     When initializing new Vue({}), first call the Vue. Prototype. _initmethod defined in initMixin through the Vue constructor in (src/core.instance/index.js). Vue constructor: //Vue constructor function Vue (options) { if (process.env.NODE_E ...

Added by synking on Tue, 28 Dec 2021 05:40:47 +0200

[JavaScript] function expression & closure

Function expression Function declaration VS function expression function functionName(arg0, arg1){ //Function body } Function declaration has an important feature - function declaration promotion, that is, the function declaration will be read before code execution (which means that the function declaration can be located after the f ...

Added by alanrenouf on Tue, 28 Dec 2021 03:02:05 +0200

You must know the iterator and generator

generator is a special iterator, which can replace the implementation of iterator to make the code more conciseWhat is an iteratorAn iterator is called an iterator. It is an object used to help traverse a data structure. This object needs to comply with the iterator protocol.The iterator protocol requires the implementation of the next method, ...

Added by scott56hannah on Tue, 28 Dec 2021 01:35:14 +0200

Publish Subscription Mode EventEmitter

Node. The events module of JS provides an external EventEmitter object for Node. Events in JS are managed uniformly. Because Node.js uses event-driven mechanisms, and EventEmitter is Node.js implements the foundation of event driven. On the basis of EventEmitter, Node. Almost all modules in JS inherit this class to implement an asynchronous eve ...

Added by ljschrenk on Mon, 27 Dec 2021 19:57:16 +0200

YAPI security vulnerabilities are fully solved in one article

YApi is an efficient, easy-to-use and powerful API management platform, which aims to provide more elegant interface management services for developers, products and testers. It can help developers easily create, publish and maintain APIs. YApi also provides users with excellent interactive experience. Developers can realize interface managemen ...

Added by misterph on Mon, 27 Dec 2021 19:41:11 +0200

Webpack 5 learning notes

1 Introduction to webpack 1.1 what is a webpack Webpack is a front-end resource building tool, a static module bundler. In the view of webpack, all resource files (js/json/css/img/less /...) of the front end will be processed as modules. It will perform static analysis according to the dependency of the module and package the corresponding st ...

Added by Acs on Mon, 27 Dec 2021 19:18:54 +0200

Long story JavaScript proxy base

Proxy and reflection provide developers with the ability to intercept and embed additional behavior into basic operations. Specifically, an associated proxy object can be defined for the target object, which can be used as an abstract target object. These operations can be controlled in the proxy object before the various operations on the targ ...

Added by jaql on Mon, 27 Dec 2021 17:54:11 +0200