2: The magic of constructors

Objectives: Be able to figure out the constructor and prototype Understanding inheritance of constructors Master some new methods of es5 1. Constructors and prototypes 1.1 general In a typical OOP language (such as Java), there is the concept of class. Class is the template of object, and object ...

Posted on Sun, 07 Jun 2020 00:28:03 -0700 by jmgarde

Prototype object in JS

Understanding prototype objects Each function has a prototype property that points to the prototype object of the function.By default, all prototype objects automatically get a constructor property, which is a pointer to the function in which the prototype property resides. for example function Person(name, age, job) ...

Posted on Wed, 13 May 2020 09:30:32 -0700 by rob323

Simple use of javascript class encapsulation based on ECMAScript 6, ECMAScript 2015

Simple use of javascript class encapsulation based on ECMAScript 6, ECMAScript 2015 Create a JS file test.js In the following example, we first define a class named Polygon, and then inherit it to create another class named Square. Note that the super() used in the constructor can only be used in the constructor and must be invoked before using ...

Posted on Tue, 05 May 2020 02:29:55 -0700 by bdbush

JavaScript - recognize DOM-

JavaScript consists of three parts js consists of three parts 1.ECMAscript 2. DOM document object model Simply put: DOM provides some API s (interfaces) that give developers the ability to operate the page 3.BOM DOM の common node types Element node. Element? Node (1) Document nod ...

Posted on Sat, 02 May 2020 12:20:25 -0700 by mac25

Note: ES6 new features - variable declaration Keywords: let and const

Declaration of variables In addition to the original var, ES6 can also use two new keywords when declaring variables: 1. let: define variables 2. const: define constant Features of new keywords 1. It is not allowed to define variables with the same name repeatedly. When defining variables with the same name, a ...

Posted on Sat, 18 Apr 2020 09:24:45 -0700 by Boz

JavaScript object oriented and prototype

JavaScript object oriented and prototype I. Preface ECMAScript has two development modes: 1. Functional (programming), 2. Object oriented (OOP). Object oriented language has a sign, that is, the concept of class, through which any number of objects with the same properties and methods can be created. However, ECMAScript does ...

Posted on Wed, 01 Apr 2020 21:07:50 -0700 by lizard

Chapter 4 JS foundation scope and closure

Return to chapter catalog Catalog 1. Scope and free variable Scope of action Free variable 2. closure 3.this 4. exercise questions 1. Handwriting bind function 2. Make a simple cache tool 3. Create 10Tag, the corresponding serial number will pop up when clicking 1. Scope and free variable ...

Posted on Wed, 29 Jan 2020 02:10:40 -0800 by mcerveni

js to realize the conversion from decimal real number to binary

During the holiday, in Baidu front-end College (a very excellent free learning platform), there is a whole set of learning routes on the front-end of zero basic learning. You can do it while watching. In the process of doing it, you can find many unexpected problems. While correcting the mistakes, you are also accumulating expe ...

Posted on Mon, 06 Jan 2020 09:54:55 -0800 by bigscanner

vue.js2.0 to realize the rolling effect of better scroll

What is better scroll Better scroll is a mobile scrolling solution, which is based on the rewriting of iscroll. The main differences between it and iscroll are as follows Here  . Better scroll is also very powerful. It can not only do ordinary scrolling lists, but also do carousel charts, picker s and so on. <templat ...

Posted on Wed, 01 Jan 2020 04:26:26 -0800 by tores

Vantui pop-up window does not pop up or has no mask

background ####Component PopupTime.vue Take the pop + time selector of the vant official website as a component:popup1show: true means pop-up display <template> <div class="PopupTime"> <van-popup v-model="popup1show" position="bottom" :overlay="true" @click-overlay="clickOverlay"> < ...

Posted on Mon, 30 Dec 2019 11:02:36 -0800 by webmasternovis