A rookie who has been working in the education industry for two years is preparing for a review interview after leaving the job. Record the review process. Front-end knowledge is in is too much, constantly updated… Hope to really look for a job you help, at the end of the article I sorted out the interview article, interested in can have a look, especially 2021 high frequency front end test summary series, help a lot. The deficiencies of the article are also pointed out.
HTML 5 and CSS 3
HTML5
New HTML5 features
-
Semantic tags: Header, nav, footer, section…
-
Media labels: Audio audio and Video
-
Form type properties: Email, Number, time control, color picker, placeholder, Autofocus
-
Cavas drawing
-
Web storage: localStorage, sessionStorage
What are the inline elements and block-level elements
Line elements: A, SPAN, img, input…
Block-level elements: div, ul, LI, OL, DT, dh, Li, P, H1-6
Advantages and disadvantages of iframe
Advantages:
- Embed it in the web page and show it
- Increase code reuse
- Used to load slower content
Disadvantages:
- Iframe blocks the onLoad event
- Web content cannot be recognized by search engines and is not SEO friendly
- It produces a lot of pages, which is unmanageable
Difference between Canvas and SVG
Canvas: 2D graphics are drawn by javaScript, rendered pixel by pixel
- Resolution dependent
- Event processing is not supported
- Can be saved in. PNG or. JPG format
- Good for games
SVG: 2D graphics language based on XML description. It is vector graphics
- Resolution independent
- Support event handling
- Great for large area rendering
Return to redraw
Backflow: When DOM changes affect elements, such as the size, layout, display and hide of elements, the build needs to be rewritten. Each page needs to be backflowed at least once, the first time the page is loaded, which is when backflowed must occur.
Redraw: Rerender the appearance of an element when its appearance has changed without changing its layout. Background-color, color
Backflow will certainly cause redrawing, and redrawing will not necessarily cause backflow
How to avoid Reflux Repainting:
- Avoid the use of
table
layout - As far as possible in
DOM
The end of the tree changesclass
- Avoid setting multiple inline styles
- Enable GPU acceleration
- Apply the animation effect to
position
Properties forabsolute
orfixed
On the elements of
Difference between SRC and href
SRC: refers to the location of the external resource. It emashes the pointed content into the location of the current tag in the document, such as JS scripts, IMG images, and iframe
Href: used to establish a link between the current document and the reference resource
CSS3
New features in CSS3
- Added CSS selectors and pseudo classes
- The special effects:
text-shadow
,box-shadow
- The gradient:
gradient
- Overrotation:
transform
,transtion
- Animation:
animation
The box model
Box models are composed of four parts: Content, padding, border and Margin
The difference between the standard box model and IE box model is that the corresponding range of width and height is different
-
The width and height of the standard box model contain only content
-
The width and height of the IE box model include border, margin and padding
Change the box model of an element by modifying its box-sizing property
box-sizeing: content-box
Represents the standard box model (default)box-sizeing: border-box
Represents IE box model (weird box model)
Trastion and aniamtion
Transtion: belongs to excessive attribute, over-emphasis, need an event to trigger (such as mouse enter, leave) similar to flash tween animation, set a start frame and an end frame
Aniamtion: animation property, which does not need to trigger events. After setting, it can be automatically executed and can be played in a loop. Also similar to tween animation, but can set multiple keyframes
The element is centered horizontally and vertically
-
Absolute positioning: Position the upper-left corner of an element to the center of the page with Top :50% and left:50%, then adjust the center of the element to the center of the page with Translate.
.parent { position: relative; } .child { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); } Copy the code
-
Absolute positioning: Set the values of the four directions to 0, and set the margin to auto. Since the width and height are fixed, the corresponding directions are evenly divided, and the horizontal and vertical directions can be centered.
.parent { position: relative; } .child { position: absolute; top: 0; bottom: 0; left: 0; right: 0; margin: auto; } Copy the code
-
Using flex flex box layout, set the container to be vertically and horizontally centered with align-items: Center and context-Content: Center, and then center its child elements vertically and horizontally.
.parent { display: flex; justify-content:center; align-items:center; } Copy the code
The difference between P, EM and REM
px
Fixed pixel units that cannot change with other elementsem
Is a unit relative to the parent element that changes as the parent element changesrem
Is relative to the root elementhtml
, which changes as the HTML element changes
Rem is commonly used in mobile terminal projects to set the fong-size of the root element, and other elements will change with the change of the root element, so as to achieve the adaptive size of different mobile phone screens. It is usually used in conjunction with the PostCSS-Pxtorem plug-in
How to solve the 1px problem
- Write directly
0.5 px.
- Using pseudo-elements, zoom in and out
- Use viewPort zoom to solve this problem
What is a BFC layout and how do YOU create one?
BFC layout is Block Formatting Context (BFC). It is a concept of CSS layout in which the inside elements do not affect the outside elements.
Create the landing:
- Element Settings float:
float
A value is not null - Element setting absolute positioning:
Position (Absolute, fixed)
overfilow
Value is:hidden
,auto
,scroll
display
Value is:inline-block
,table-cell
,table-caption
,flex
Etc.
Landing the role:
- To solve
margin
Overlap problem: Since BFC is an independent region, internal elements and external elements do not affect each other. By turning the two elements into BFC, margin overlap problem can be solved - Create an adaptive two-column layout: You can use this to create an adaptive two-column layout with a fixed width and height on the left and an adaptive width on the right.
- Fixed height collapse: after the child element is set to float, the height of the parent element will collapse, that is, the height of the parent element will be 0. To solve this problem, simply turn the parent element into a BFC.
The difference between link and @import
- Link is an HTML-provided tag that not only loads CSS files, but also defines RSS, REL connection properties, and more
- @import is the syntax provided by CSS, only the import style band.
- The CSS introduced by the link tag is loaded at the same time, while the CSS introduced by @import is loaded after the page is loaded
- @import is a CSS2.1 syntax that has compatibility, while link as an HTML tag does not have compatibility problems
CSS selector priority
@important
- Inline style
- The ID selector
- Class selector/property selector/pseudo-class selector
- Element selector/pseudo-element selector
- Relational selector/wildcard selector
JS based
Underlying data types
String, number, Boolean, object, function, undefined, null, symbol
When typeof is used, null is object and undefined is undefined. When typeof is used, null is object and undefined is undefined
null= =undefined // true
null= = =undefined //false
Copy the code
Value types (basic data types) : String, number, Boolean, undefined, NULL, symbol
Reference types: Object, function, and array
Value types and reference types differ:
- Value types are stored on the stack and take up a fixed amount of space. When a method is executed, each method creates its own memory stack, where variables defined in the method are stored. The stack is also destroyed when the method execution ends. So, the base variables are stored in the stack. A reference variable stored on the stack is a reference address to an array or object in the heap. This is why changing the reference type always affects other reference variables that refer to this address.
- Value types can be used
typeof
Perform data type detection - Reference types are kept in the heap and take up variable space. The created object is stored in heap memory, which is not destroyed at the end of the method because the object may also be referenced by another variable, and the system’s garbage collection mechanism will reclaim it only if an object is not referenced by any variable.
- Use of reference types
instanceof
Detection data type - Objects constructed using the new () method are reference types
closure
A closure is a function that can read variables inside another function. The simplest way to create a closure is to create a function inside a function that can access local variables of the current function.
Closure advantages:
- Create global private variables to avoid global contamination of variables
- Can achieve encapsulation, caching, and so on
Disadvantages of closures:
- The created variables cannot be reclaimed, which may cause memory overflow
Variable promotion, scope, scope chain
Variable ascension
Js code when parsing, all variable functions, will be promoted to the top of the code. Variable promotion, promotion is only variable declaration, does not promote variable assignment
console.log(i) / / 4
var i = 4
Copy the code
scope
A scope is the accessible scope of a variable or function. A scope controls the visibility and life cycle of a variable or function
-
Global scope: Can be accessed globally
- Outermost functions and outermost defined variables have global scope
- Object property methods on Windows have global scope
- Automatically declare global scope for variables that define direct replication
- Too many global scoped variables can lead to global contamination of variables and naming conflicts
-
Function scope: can only be accessed within a function
- Variables defined in a function can only be used internally and cannot be accessed externally
- Inner scopes can access outer scopes, but outer scopes cannot access memory scopes
-
Block-level scope in ES6: only accessible within code blocks
-
Use new ES6 variables such as let and const with block-level scope. Block-level scope can be created in functions (code wrapped in {} is block-level scope)
-
Variables declared by let and const are not promoted, and const cannot be declared twice
-
Block-level scope is mainly used to solve the problem of variable coverage caused by variable promotion
var i = 3 function fnc() { console.log(i); var i = 6; } fnc() // undefined Copy the code
-
The scope chain
Variables that are not found in the specified scope are searched up the next level of scope to the global scope. This lookup process is called scope chain.
Call, apply, bind
- Can be used for change
this
Point to the - The difference between call and apply is that call and bind are passed objects. Apply passes an array.
- Call and apply will execute the function immediately after changing this. Bind will return a function after changing this. It will not execute the function immediately.
What does the new operator do
-
Create an empty object
-
Sets the prototype of the object to the function’s Prototype object
-
Change this to point to the object, and execute the constructor.
-
Determine the return type of the function and, if it is a value type, return the created object. If it is a reference type, return an object of that reference type.
Prototype, prototype chain
-
Prototype: When each object is internally initialized, it initializes a prototype property, and the _proto_ property of the object refers to its prototype object.
-
Prototype chain: When we access a British object property, if the property does not exist, we will look it up on its prototype object, which in turn will have its own prototype, and keep looking until we find the top-level object object. This lookup process is called a prototype object.
inheritance
Prototype chain inheritance
New Person(); new Person(); new Person();
🌰
function Person() {... };function Son() {... };// Key code
Son.prototype = new Person();
Copy the code
Advantages:
- Subclasses can inherit the parent class constructor, attribute methods on the stereotype
Disadvantages:
- Instance objects of the parent class reference type are shared, which makes modification confusing.
- When creating a subclass, you cannot pass arguments to the parent class
Constructor inheritance
Use the.call() or.apply() methods to initialize the parent constructor by borrowing the parent constructor from a subclass.
🌰
function Person(name) {... };function Son(name) {
// Key code
Person.call(this, name)
...
}
Copy the code
Advantages:
- When a subclass inherits from a parent class, it can pass arguments to the parent constructor.
- Does not cause reference property sharing between subclass forces.
Disadvantages:
- You can only inherit attribute methods from the parent constructor, not access methods on the stereotype.
- Each subclass creates a copy of its parent class
Combination of inheritance
Composite inheritance, which combines stereotype chain inheritance and constructor inheritance.
🌰
function Person(name) {... };function Son(name) {
// Borrow constructor to inherit key code
Person.call(this, name);
};
// Prototype chain inherits key code
Son.prototype = new Person();
// point the subclass's constructor to itself
Son.prototype.constructon = Son;
Copy the code
Advantages:
- Combining the advantages of the previous two inheritance approaches, instances of subclasses have access to attribute methods on their parent class archetypes
- Instances of subclasses are not shared
Disadvantages:
- The superclass constructor is called twice
Primary inheritance
Wrap an Object with a function, return a call to that function (the mock implementation of ES5’s Object.create), and use the passed Object as a prototype to create the Object
🌰
function create(obj) {
// Create an empty constructor
function F() {};
// Point the empty constructor prototype to the object passed in
F.prototype = obj;
// Return an instance object
return new F();
}
const obj = {
name: 'zs'. };const newObj1 = create(obj);
const newObj2 = create(obj);
Copy the code
Pros and cons As with archetypal chain inheritance, reference types are shared.
Parasitic inheritance
On the basis of the original type inheritance, do the enhancement function inside the function, return the object.
🌰
function createObj(obj){
// Get the inherited subclass object, which is the create method implementation above
const newObj = Object.create(obj);
// Function enhancement
newObj.say = function() {... }// Return the object
return newObj;
}
Copy the code
Similar to the original type inheritance, but on the basis of the original can be customized attribute methods, still does not solve the problem of reference values being shared. (Like borrowing the constructor pattern, methods are created each time an object is created.)
Parasitic combinatorial inheritance
Combining advantages and disadvantages of parasitic inheritance and composite inheritance, the disadvantage of composite inheritance is that the parent constructor is called twice, and the advantage is that the reference values are shared. The disadvantage of parasitic inheritance is that it does not solve the problem of reference value being shared.
🌰
function createObj(son, parent) {
// Create a new object using the parent constructor's prototype object
constNewObj = Objcet. Create (parent. The prototype);// Subclass the constructor of the new object
newObj.constructor = son;
// Point the prototype of the subclass constructor to the original type inheritance of the heart
son.protoytype = newObj;
}
function Person(name) {... };function Son(name) {
// Constructor inheritance
Person.call(this, name); . };// Implement inheritance
createObj(Son, Person)
// A cleaner way to point son's prototype directly to Person's prototype via API based on composite inheritance
Son.prototype = Object.create(Person.prototype);
const obj1 = new Son('zx');
const obj2 = new Son('lw');
Copy the code
Deep copy, shallow copy
Shallow copy
Shallow copy simply copies the value type of an Object, either through object. assign or the extension operator
Deep copy
We do it recursively
function deepClone(obj) {
// Determine whether it is an object
if(! obj ||typeofobj ! = ='object') return obj;
// Create an array or object based on type obj
let newObj = obj instanceof Object ? {} : [];
// Iterate over obj, process child elements as objects, copy recursively
for (key in obj) {
if (obj.hasOwnProperty(key)) {
newOb[key] = deepClone(obj[key])
};
};
return newObj;
};
Copy the code
EventLoop (browser)
Stack and queue understanding
The Stack (Stack)
The taskLast in, first out, the execution stack in JS is a stack structure that stores functions, and the execution of tasks in the stack follows the principle of “first in, last out”.Queue
The taskFirst in first outThe js runtime creates a queue of tasks that process lists (events) and callback functions to execute
Macro task, micro task
The Task is divided into two kinds: macro js Task (MacroTask | Task) and micro (MicorTask).
- Macro task:
Script all the code
,setTimeout
,setInterval
,I/O
,UI Rendering
- Micro tasks:
Promise.then
,Process. NexTick (unique) Node
,MutationObserver
Synchronous and asynchronous tasks
Js has a main thread and an execution stack (call stack). All tasks are placed in the execution stack to be executed by the main thread.
When the js code executes, all functions are pushed onto the execution stack. Synchronization tasks are executed on a last-in, first-out basis until the stack is empty. After the asynchronous task has the result, the registered callback function will be put into the asynchronous task queue and wait for the main thread to be idle (synchronous tasks in the execution stack are completed).
Tasks in the asynchronous queue are divided into macro tasks and micro tasks. When processing tasks in the asynchronous queue after the current execution stack is cleared, the system first checks whether there are micro tasks to be executed. If there are micro tasks, the system pushes them to the execution stack. When the tasks in the micro queue are finished in the execution stack, then the asynchronous queue puts the macro task into the execution stack.
To put it simply:
- Execute synchronized code, which is a macro task
- After all code is executed, the stack is cleared and tasks in the asynchronous queue are executed
- In asynchronous queues, micro tasks are performed first
- The micro task is completed, and then the macro task
Event bubbling, event delegation
Events occur in three phases: capture phase, target phase, and bubble phase
- Event bubbling: Events of some kind are emitted on an object. If the object is bound to an event, the event is emitted. If not, events are propagated to the parent object of the object, and eventually the parent object fires the event.
- How to stop:
- Common browser:
event.stopPropagation()
- Internet Explorer:
event.cancelBubble = true
;
- Common browser:
- How to stop:
- Event delegate: Leverages the browser event bubbling mechanism. The event will be transmitted to the parent node during the bubbling process, and the parent node can obtain the target node through the event object. You can define the listener function of the child node on the parent node, and the listener function of the parent node uniformly processes the events of multiple child elements
- Event delegates can reduce memory consumption by eliminating the need to bind listening events to each child node.
- You can also use event delegates to dynamically bind events, such as adding a new child node. Instead of adding a separate listening event, the listener function in the parent element can handle it.
Add, delete, change and check DOM elements
increase
document.createElement()
Copy the code
delete
element.removeAttribute()
element.removeChild()
Copy the code
change
element.innerHTML()
element.setAttribute()
Copy the code
check
getElementById()
getElementsByClassName()
getElementsByTagName()
querySelector()
querySelectorAll()
Copy the code
Ajax, AXIos, fetch difference
ajax
- Based on native XHR development
- Itself for MVC programming, not in line with the current front-end MVVM trend
axios
-
Create an XMLHttpRequest from the browser
-
Supporting promise
-
Support for request blocking and response interception
-
Create HTTP requests from Node.js
-
The customer service supports CSRF/XSRF prevention
fetch
- The browser’s native implementation of requests, an alternative to Ajax
- An error is reported only for network requests. The 400 and 500 requests are regarded as successful and need to be encapsulated
- Fetch is not carried by default
cookie
, you need to add configuration items - Fetch does not support abort, does not support timeout control, use
setTimeout
andPromise.reject
The timeout control implemented by the request process does not prevent it from continuing to run in the background, resulting in a waste of volume - Fetch has no way of natively monitoring the progress of requests, whereas XHR does
ES6
Var, let, const
var
Declaring variables can be repeatedly declared, whilelet
Can not bevar
Is not limited to block-level scope, whilelet
limitedvar
There is a variable promotion,let
andconst
There is no variable promotioncons
The variable declared by t is immutableconst
The value must be assigned after the declaration, otherwise an error will be reported
Promise
Promise is a solution to asynchronous programming by expressing asynchronous operations as a flow of synchronous operations, avoiding layers of nested callback functions.
It has three states
pending
The initial statefulfilled
Operation is successfulrejected
Operation failed.
There are only two possibilities for a Promise state change
- from
pending
——>fulfilled
- from
pending
——>rejected
The Promise constructor takes an argument and a callback function with resolve and reject arguments.
resolve
The role of thePromise
State frompending
intofulfilled
, called when the asynchronous operation succeeds, and returns the asynchronous result, passed as a parameterreject
The role of thePromise
State frompending
intorejected
If an asynchronous operation fails, the error result of the asynchronous operation is passed as a parameter
Promise instance method
promise.then()
The correspondingresolve
Successful handlingpromise.catch()
The correspondingreject
Failure handlingpromise.call()
multiplePromise
Instance, wrapped into a new onePromise
Instance, the returned instance is normalPromise
. There is a failure that represents thePrimise
Failure. When all the childrenPromise
Complete, returns an array of all values when the value is returnedpromise.race()
similarpromise.all()
, the difference is that either completion is complete (for example: put asynchrony and timer together, set request timeout).
The difference between an arrow function and a normal function
- Arrow functionAnonymous functionsCannot be used as a constructor
new
- Arrow functions are not bound
arguments
- Arrow functions don’t have their own
this
, will be in the context ofthis
As one’s ownthis
value - There is no
prototype
call()
,applay()
,bind()
Method cannot change the arrow functionthis
Point to the
The difference between forEach and map
- ForEach returns undefined, cannot be chained
- Map () returns a new array, leaving the original array unchanged. ForEach changes the array.
The difference between Set and Map
Set
- Create:
new Set([1, 1, 2, 3, 3, 4, 2])
add(value)
: adds a value and returns the Set structure itself.delete(value)
: Deletes a value and returns a Boolean value indicating whether the deletion was successful.has(value)
: Returns a Boolean value indicating whether the value is a member of Set.clear()
: Clears all members with no return value.
Map
set(key, val):
向Map
Add a new element toget(key):
Finds a specific value by key value and returns ithas(key):
judgeMap
ObjectKey
The corresponding value is returnedtrue
Otherwise returnfalse
delete(key):
By key value fromMap
To remove the corresponding dataclear():
Will thisMap
Delete all elements in
The difference between
- A Map is a collection of key-value pairs that, unlike objects, can have any value
- Maps can be traversed and converted to a variety of data formats
- A Set is a data structure similar to an array, but with no duplicate values
Talk about your understanding of ES6
- Deconstruction assignment
- Extended operator
- Template string
- Arrow function
async/await
Class
- The introduction of
Moldule
grammar
Vue
Basic knowledge of
MVVM
MVVM is a software architecture pattern where M stands for model layer (data model) in VUE, responsible for data model. V represents the View layer and VM represents the ViewModel. It is the bridge between The Model and View. Data is bound to the ViewModel layer and automatically renders data to the page layer, notifies the ViewModel to update data when the View changes
Vue life cycle
Before and after creation:
BeforeCreated (before creation) :
Data observation and initialization events have not started and cannot be accesseddata
,computed
,watch
,methods
Data methods on.Created (after creation) :
The instance is created and accessibledata
,computed
,watch
,methods
But the render node is not yet attached to the DOM, so it cannot be accessed.
Before and after mounting:
BeforeMounted (Before mounting) :
The Vue instance is not yet attached to the page HTML, at which point a server request can be madeMounted:
The Vue instance is now hung and ready to manipulate the DOM
Before and after:
BeforeUpdate (beforeUpdate) :
Called before data update, without rendering the pageUpdated:
The DOM is re-rendered, and the data and interface are new.
Before and after destruction:
BeforeDestoryed (before destruction) :
Called before instance destruction, when it is availablethis
Destoryed (after destruction) :
Called after the instance is destroyed, and the instance is completely destroyed.
The difference between watch and computed
Watch: Listen property, used to listen for data changes, no cache, when the monitored data changes will execute the destroy function
Computed: Computes attributes. The monitored value is cached and recalculated only the next time a computed value is obtained after the value of the attribute it depends on has changed. (Only recalculated if the dependency changes)
The role of key in V-for
Key is used to more efficiently compare whether each node in the virtual DOM is the same or not, and to avoid repeating node updates during page updates
Difference between V-if and V-show
Delete the DOM element if the V-if element is not visible
The V-show element is visible by setting the element’s display: None style attribute
Why is data in a component a function
Because the object is a reference type, if data is an object, multiple components will share the same data. Data is a function, and each component will have its own private data space, which will not interfere with the operation of other components.
Vue component communication
Father and son components
The father the son
- props
- $children
- $refs
Child the parent
- $emit
- $parent
Brother components
- provied
- inject
- eventBus
- Vuex
Basic use of Vuex
Vuex is used for data state management in VUE and has five properties:
state
:Vuex
Basic data for storing variablesgetter
From:state
Derived data when encounteredstate
The computed property of thestate
Data is filtered and screenedmutation
: Commit an updatestate
Methods of dataaction
And:mutation
Similar functionality, both used to submit updates, butaction
Is submittedmutation
, rather than directly changing the data, andaction
Can include asynchronous operationsmodule
: Modular Vuex, each module has its ownstate
,mutation
,actoion
,getter
Mutation and Action
mutation
Focus more on revisionstate
Must be executed synchronously.action
Is submittedmutation
Instead of updating data directly, it can be asynchronous.action
Can integrate multiplemutation
Difference between Vuex and localstory
Vuex
Stored in memory, the page will close the refresh will disappear. whilelocalstorage
Stored locally, memory is faster to read than hard diskVuex
Applied to passing values between components,localstorage
Mainly used for transfer between different pagesVuex
It’s reactive,localstorage
Need to refresh
Routing guard
- Global front hooks:
beforeEach
,beforeResolve
,afterEach
- Route exclusive guard:
beforeEnter
- Component inner hook:
beforeRouterEnter
,beforeRouterUpdate
,beforeRouterLeave
Difference between Hash and history
hash
Hash mode is the default mode in VUE development. The URL in the address bar carries #, followed by route.
The principle is to use the onHashChange () event to listen for changes in the routing hash. The advantage of this is that when the hash value changes, the window can listen for changes in the event and load the corresponding code according to the rule without sending a request to the back end. In addition, changes in the hash value correspond to urls that are logged by the browser so that the browser history page can be moved forward and backward.
history
Vue also provides history mode, which has no # in the URL and looks better than hash mode. However, background configuration support is required.
History leverages the pushState and replaceState apis provided by HOStory in HTML5, which record the browser history stack without triggering a page refresh or background request when changing a URL.
Dynamic routing
Define the way
- Params mass participation
- Route configuration:
/index/:id
- Route jump:
this.$router.push({name: 'index', params: {id: "zs"}});
- Route parameter acquisition:
this.params.id
- The resulting route:
/index/zs
- Route configuration:
- Query the participation
- Route configuration:
/index
Normal route configuration - Route jump:
this.$rouetr.push({path: 'index', query:{id: "zs"}});
- Route parameter acquisition:
this.query.id
- The resulting route:
/index? id=zs
- Route configuration:
$router
and$route
The difference between
$router
The entire route object can be usedthis.$router.push({name: ; index'})
Jump to a page$route
Is the routing object of the current pagethis.$route.parmas.id
To get the argument passed in by the current route object
The principle of knowledge
To complement…
Vue extension
To complement…
Network protocol, security related
To complement…
Browser dependent
To complement…
Performance optimization
To complement…
Front-end engineering
To complement…
Handwriting series 🤮
To complement…
Output result series
closure
var name = "The Window";varobject = {name : "My Object".getNameFunc : function(){return function(){return this.name; }; }}; alert(object.getNameFunc()());//"The Window"
Copy the code
function aaa(){
var a=0;
function bbb() {
a++;
alert(a);
}
return bbb
}
var ccc=aaa();
ccc(); // The result is 1
ccc(); // The result is 2
var ddd=aaa();
ddd(); // The result is 1
ddd(); // The result is 2
Copy the code
To complement…
Reference:
2021 “hf front end test questions
My preparation for the front end interview in 2021
Shock!!! Front-end 300 basic interview questions + answer, classification learning arrangement (conscience production) continue to update
Advanced knowledge