1. SyntaxError

Input is not standard, or variable command is not standard.

// Missing symbols
console.log ('hello';
// Uncaught SyntaxError: missing ) after argument list
 
// Variable error
// Uncaught SyntaxError: Invalid or unexpected token
var 1a = 'test'Parse ('') Uncaught SyntaxError: Unexpected end of JSON input json.parse ('')
Copy the code

2. ReferenceError

When assigning a value from undefined to a variable that does not exist,

// test is undefined, i.e. no stack address is allocated
// Uncaught ReferenceError: test is not defined
var t = test;
Copy the code

3, TypeError

// Type call error
// Uncaught TypeError: Object.test is not a function
// test is undefined, should be undefined, called as a function here
Object.test()
 
// undefined refers to an attribute
// Uncaught TypeError: Cannot read property 'a' of undefined
var test = undefined;
var t = test.a;
 
var test = {}
var t = test.test.a;
 
// null refers to an attribute (even though null Typeof is an object, it will return an error)
// Uncaught TypeError: Cannot read property 'a' of null
var test = null
var t = test.a


reportErrorFour() {
/** * Console error: constructor (this) refers to the current instance object, and asynchronous setTimeout (this) refers to this */
    let _this = this
    let Game = function () {
      // This refers to undefined, and the clearLocalStorage method cannot be called
      _this.clearLocalStorage();
      _this.timer = setTimeout(function () {
        _this.clearBoard()
        // this.clearBoard(); // What does this mean? == "This points to window
      }, 0);
    };
    Game()
},

reportErrorFive() {
/** * Void object (a); void object (b); void object (a); void object (b); Parse (json.stringify ()) is used to break references between data */
    var a = {};
    var b = {
      a: a
    };
    // a.b = b;
    a.b = JSON.parse(JSON.stringify(b));
    JSON.stringify(a);
},
Copy the code

4, RangeError (out of RangeError)/URIError (incorrect URI)

// Uncaught RangeError: Invalid array length
new Array(-1)
 
// Uncaught URIError: URI malformed
decodeURI('%dfd')
Copy the code