Front end beginner's notes: JavaScript functions

JavaScript functions Functions in JavaScript: 1) Encapsulate functions 2) Can be called directly 3) The reuse rate of code is improved 1. Function declaration Function declaration function Function name(parameter list ){ //Function body } Function expression var Function name = function(parameter list ){ //Function body } Function d ...

Posted by brewmiser on Mon, 27 Sep 2021 15:58:34 +0200

Copy constructor, this pointer, assignment operator overload, complete class

Catalog copy constructor this pointer Because this pointer points to its own object, we return this pointer to return our own object Assignment Operator Overload (Assignment Constructor, have I forgotten this statement, I've always called it that way) Complete class (parameterized, parameterized, copy, assignment, destructive) copy con ...

Posted by srhino on Sat, 25 Sep 2021 19:04:03 +0200

JavaScript factory function pattern & constructor pattern

1.JavaScript factory mode The main function of factory pattern is to create objects and reduce code redundancy Application scenario: when you want to mass produce objects of the same kind; For example, you want to generate 40 students in a class. Each student has characteristics such as name, age and so on. At this time, you create a "fa ...

Posted by bulgaria_mitko on Fri, 24 Sep 2021 18:14:47 +0200

Front end performance optimization 03_ Layer and redraw rearrangement

css layer When rendering a page, the browser will divide the page into many layers, ranging from large to small, with one or more nodes on each layer. When rendering DOM, what the browser does is actually: 1. After obtaining DOM, it is divided into multiple layers 2. Calculate style results for nodes of each layer (calculate style – st ...

Posted by jamesm87 on Fri, 24 Sep 2021 14:21:40 +0200

Animation function encapsulation

1. Animation function encapsulation 1.1 animation implementation principle Core principle: continuously move the box position through the timer setInterval(). Implementation steps: Get the current position of the box.Add 1 movement distance to the box's current position.Use the timer to repeat this operation continuously.Add a condition to ...

Posted by Pepe on Thu, 23 Sep 2021 16:44:31 +0200

JavaScript advanced -- object oriented programming

1, Pop (process oriented programming) Object oriented is to decompose transactions into objects, and then divide and cooperate among objects. 1. Example understanding Let's take an example: Put the elephant in the fridge. Process oriented programming is: Open the refrigerator door – > put the elephant in – > close the refr ...

Posted by pixeltrace on Thu, 23 Sep 2021 14:27:17 +0200

The JavaScript shorthand coding method is suitable for JavaScript shorthand skills and techniques of all stack developers. (self use, self use, self use)

1. Declare variables It is a good practice to declare variable assignment at the beginning of a function. This shorthand method can save you a lot of time and space when declaring multiple variables at the same time. Common writing let x; let y; let z = 3; Simplified writing let x, y, z=3; 2. Use ternary operators Your life becomes eas ...

Posted by Zephyris on Wed, 22 Sep 2021 09:03:21 +0200

WEB front end optimization -- HTML/CSS optimization

This series of articles is organized, recorded and expanded by the book efficient front end - Web efficient programming and optimization practice. Optimization 1: don't use JS for problems that can be solved with HTML/CSS Several cases are introduced 1.1 navigation highlight This case is not an ordinary mouse to highlight, but highlight ...

Posted by Tchelo on Mon, 20 Sep 2021 22:08:46 +0200

September 14, 2021 -- Basic JavaScript syntax

1, JavaScript overview What is JavaScript? Is an object-based and event driven client scripting language. Official concept: This is a cross platform scripting language Platform: refers to the operating environment, which generally refers to the operating system. Cross platform means that it can run in various environments. Scripting l ...

Posted by met0555 on Mon, 20 Sep 2021 05:50:23 +0200

HTML5 basic learning

1, Structure of HTML pages 1. Basic framework of HTML <html>Web page as a whole     <head>         <title>Page title</title>     </head>     <body>Theme of web page</body> </html> 2. Structure of HTML tags < tag name attribute name = attribute value > content < / tag name > 2 ...

Posted by mikeylikesyou on Sun, 19 Sep 2021 19:46:27 +0200