The web page

  • HTML page structure
  • CSS styles
  • JS interaction
    • Interactive effect implementation
    • Data acquisition and binding
    • Browser operations

Js consists of three parts

  • ECMAScript (ES3 ES5 / ES6-9) defines syntax specifications: variables, data values, operation statements, memory management, etc
  • DOM document object model, which manipulates the properties and methods of page DOM elements
    • The advent of VUE and React allowed us to manipulate only data, while the framework manipulated DOM
  • BOM Browser object model that manipulates browser properties and methods

variable

Variable: variable quantity (store value is mutable), set a variable name, representing and pointing to a specific value

1. How to create variables in js

  • ES3: var variable
  • ES6: Let variable, const constant
  • Create a function
  • The class to create a class
  • Import/require imports modules based on ES6 Module or CommonJs specifications
var n = 10;  // create a variable n that points to the value 10
var m;  // create a variable m that does not point to any value. The default point is undefined

let a = 100;  / / 100
a = 200;  / / 200

const b = 100;  / / 100
b = 200;  // Uncaught TypeError: Assignment to constant

// Create a variable func that points to this function
function func(){}

// Create a variable Parent to point to this class
class Parent {}

// Define an axios variable that points to the imported module
import axios from 'axios'
let axios = require('axios')
Copy the code

2. Naming conventions for variables

  • Strictly case sensitive
  • Hump nomenclature
  • Use $, _, letters, and digits (cannot start with digits).
  • Cannot use keywords, reserved words
// Common phrasesAdd, insert, create// Add, insert, deleteDel,delete, remove// Delete
update  / / updateSelect, query, get// Query, obtain
info  / / information
Copy the code

P8, P9, P10