I. JavaScript Basics
1. try... catch uses lowercase letters. An error occurs when uppercase letters are used.
2. Throw Declaration
The role declared by throw is to create an exception ). You can use this declaration with the try... catch declaration to control program streams and generate precise error messages.
Syntax:
Throw (exception)
Exception can be a string, integer, logical value, or object.
Note: use lower-case letters to write throw. An error occurs when uppercase letters are used!
3. A backslash is used to insert ellipsis, line breaks, quotation marks, and other special characters into a text string.
The following table lists other special characters that can be added to a text string using a backslash:
Code output
\ 'Single quotes
\ "Double quotation marks
\ & And number
\ Backslash
\ N linefeed
\ R carriage return
\ T Tab
\ B Return character
\ F page feed
4. JavaScript ignores unnecessary spaces. Therefore, you can add appropriate spaces in the code to make the code more readable.
5.
You can use a backslash to lines the code within a text string. The following example is correct:
Document. write ("Hello \
World! ")
But it cannot be broken like this:
Document. write \
("Hello World! ")