I will share the summary of the simple errors in the pipeline script. It is my notes during the learning process. I will share the summary of the simple errors in the pipeline script and the summary of errors in my notes during the learning process.
When judging a statement, if (x = 0) and (x = 0) and (x = 0) are different.
X = 0 is a negative value. 0 is flase. If x = 10, it is true.
X = 0 is determined, but it will automatically convert the Type x = '10' and x = 10.
X = 10 must be of the same type before judgment
Addition and join operators are different.
X = '10' y = 5;
X + y equals 105 at this time;
String Branch
var x = "Hello World!";
In this case, the Branch will report an error.
var x = "HelloWorld!";
This is correct
You can also add a backslash.
var x = "Hello\ World!";
Semi-colon forgetting or writing an error
No return value for the line feed result after return
The array uses the name for indexing. The array can only use numbers for indexing.
An array object cannot end with a comma
Undefined is not Null
Block Scope
JavaScript ErrorVarious Errors may occur when the JavaScript engine executes JavaScript code.
It may be a syntax error. It is usually a code error or a typo caused by a programmer.
It may be a spelling mistake or a lack of functionality in the language (possibly due to browser differences ).
The error may be caused by incorrect output from the server or user.
Of course, it may also be caused by many other unpredictable factors.
Throw error in JavaScriptWhen an error occurs, when something goes wrong, the JavaScript engine usually stops and generates an error message.
The technical term used to describe this situation is: JavaScriptThrowAn error occurred.
JavaScript try and catchTryThe statement allows us to define the code block for an error test during execution.
CatchThe statement allows us to define the code block to be executed when an error occurs in the try code block.
JavaScript statementsTryAndCatchIt appears in pairs.
Try {
// Run the code here
} Catch (err ){
// Handle errors here
}
Chestnuts
Ar txt = "";
Function message ()
{
Try {adddlert ("Welcome guest! ");} Catch (err) {txt =" An error occurred on this page. \ N "; txt + =" error Description: "+ err. message +" \ n "; txt + =" click "OK" to continue. \ N "; alert (txt );}}
Message ();
Syntax
throw *exception*
An exception can be a JavaScript string, number, logical value, or object.
Js exception
Judgment