This is the 18th day of my participation in the August Challenge

Start learning (ES6)! Do do do

Can serve as a beginner’s learning route, can refer to, learning progress is not particularly driven! Ongoing update

Combined with their own understanding, simple and comprehensive summary of the basic knowledge points in the process of learning JavaScript in vernacular Chinese, easy to deepen understanding!

Let’s get started! ‘Only a firm foundation can build a tall building ‘! Come on! Take it seriously!

1, comb and review the knowledge points yesterday

  • cookieFunction: Data store Data sharing is stored in the browser
  • Document. cookie = “key = value;” Save take the document. The cookie split (“; “)
  • Document. cookie = “key = value; expires=”+now
  • Delete cookie: value set to “” or lifetime set to -1

ES6

1. Let keyword let block-level scope (defined before called)

  • Let declaration variable

  • Let does not allow variables to be declared repeatedly

  • Let must be used inside some {}

  • Let cannot implement variable promotion inside the function body

  • Temporary dead zone: a variable declared in let mode the phenomenon that a variable is not available before it is declared is called a temporary dead zone

You cannot let variables that are the same as parameters inside a function body

  • Let application: Get subscripts (tabs)

2,thisTo change

This meaning –> Current object: refers to the caller of the event or method

Change the this pointer to the anonymous function:

  • Bind (the object to which this points)
  • call()apply(): Changes non-anonymous functionsthisPoint to the
  • Function name.apply (inside the function body this points to an object)

3, for… of

for… Of and the for… In the difference between:

The former iterates over values/the latter iterates over keys

4, const keyword

The key that defines a constant

Constants are usually defined in capital letters to distinguish them from variables

Once a constant is defined, its value cannot be changed repeatedly

const  PI = 3
PI = 3.14An errorCopy the code

5. String templates

Parse a variable in a string using ${variable name}

String template

A string template recognizes both variables and functions

Arrow function

Definition: () => {function body}

With arguments: (argument) => {function body}

With return value: ()=>{return return value}

7. Deconstruct assignment: Analyze the structure for assignment

  • 1. You can define multiple variables at once
  • 2. You can make a function return multiple values using []
  • 3. Destruct assignment can be applied to function arguments in a different order using {}
  • 4. Deconstructing assignment can realize the exchange of two numbers

8, Array. The from

Array.from: Converts an object (collection, class Array, pseudo Array) containing the length property into a real Array

Array.from(obj)
Copy the code

9. Set set and Map set

The Set collection

  • Definition:
var set = new Set(a)// Define a set
Copy the code
  • Set features: Automatic deduplication does not perform automatic type conversion

Implement array de-duplication:

Array.from(new Set(arr))
Copy the code

The shortest way to deduplicate an array:

; [...newSet(arr)]
Copy the code

Set set method:

  • Add () adds a number to the collection
  • Delete () deletes a number from the collection
  • Has () determines whether the set contains a value
  • Clear () clears the collection
    • Gets the number of collection elements via the size attribute

Map collection – Stored data in key-value pairs:

  • Set adds a key-value pair to the collection
  • Delete deletes a number from the collection based on the key
  • Has (key) Determines whether the set contains a value based on the key
  • Get (key) Values by key
  • Clear () clears the collection

10, Symbol type

var num = new Number(a)Copy the code

Define a Symbol type of data

var xn213 = Symbol('The one who loves you the most')
Copy the code

The Symbol type can be applied to an object to protect a property of the object


Preview: Come on, dream chasers

[preview] : next to learn JS processing movement function, but also will know will bar..

Learning is a continuous process, stick to it, there will be harvest!

Accumulate over a long period, consolidate the foundation, early into Dachang!

It’s not easy to keep it up, and it’s not easy to keep it up. You’re great!

Calm Down & Carry On!


Read more:

Review of previous updates

【 Relearn JS】 Learn every day to consolidate the foundation:

【day1】

Day2 various operators, DAY3 data types, DAY4 loop structures & conditional statements, DAY5 functions (emphasis), day6 scopes & events,

【 DAY7 】 object & array method summary, 【day8】 string method & partial sorting,

【 DAY9 】Math object & Wrapper Function, 【 DAY10 】BOM- Browser object model,

【 DAY11 】DOM- Document Object Model

【 DAY13 】Event Event object first known (2),

【 DAY14 】 Event delegate & Drag principle

[DAY15] drag-and-drop implementation & regular beginning, [DAY16] regular specific method, [DAY17] cookie

More on the way… A long way to go ==-.. – = =