Home > Article > Web Front-end > Some Tips for JavaScript Study Notes_Basic Knowledge
1. JavaScript basics
1.try...catch uses lowercase letters. Capital letters will go wrong.
2.Throw statement
The purpose of the throw statement is to create an exception. You can use this statement with a try...catch statement to control program flow and produce precise error messages.
Syntax:
throw(exception)
exception can be a string, integer, logical value or object.
Note: Use lowercase letters to write throw. Using capital letters would be an error!
3. Backslashes are used to insert ellipses, newlines, quotation marks and other special characters in text strings.
The following table lists the remaining special characters that can be added to text strings using backslashes:
Code output
' single quote
" double quote
& ampersand
\ backslash
n newline character
r carriage return
t tab character
b Backspace character
f Form feed character
4. JavaScript will ignore extra spaces, so you can add appropriate spaces in the code to make the code more readable.
You can use backslashes inside text strings to wrap code. The following example is correct:
document.write("Hello
World!")
But you can’t break lines like this:
("Hello World!")