Home > Article > Web Front-end > JavaScript Learning Journey (1)_Basic Knowledge
Chapter 1 A brief history of JavaScript. There is nothing to remember. It briefly introduces the origin of js, conflicts between browsers, etc.
Chapter 2 JavaScript syntax. It is worth noting:
(1) Strings are placed in single quotes or double quotes. I personally recommend using double quotes. (This is a good programming habit)
For example: var mood="happy";
(2) Character escaping (escaping) Use backslash
such as : var mood='don't ask'; alert(mood); output don't ask.
var height="about 5'10" tall"; alert(height); output about 5'10" tall.
If there are single quotes in a string using single quotes, you need to add a backslash before the single quotes in the string
Similarly, if there are double quotes in a string using double quotes, you need to add a backslash before them. Add a backslash before the double quotes in the string
(3) This function is important and I won’t go into details here.
(4) Object Since it is programming, it would not be called programming if we left it.
Object is a self-contained collection of data. The data contained in it can be accessed through two forms - properties and methods:
Properties Simply put, variables
and methods are simply functions
. They all belong to specific objects. They need to use "dot" syntax to access:
Object.property
Object.method()
(5) Built-in objects. Array objects, Math objects, Date objects, etc. are built-in objects of JavaScript. They provide many useful methods for us to use. Built-in objects can help outsiders complete many tasks quickly and easily.
(6) Host object. The host exclusive mainly includes Form, Image and Element. These objects allow us to obtain information about the form images and various form elements on a given web page.
Form, Image and Element. are rarely used, because there is another object that can be used to obtain information about any element on a given web page, which is the famous document object.