This is the first day of my participation in the August More text Challenge. For details, see: August More Text Challenge
Consolidate the basic knowledge of learning JavaScript, deepen the understanding of memory, to build a firm foundation! Come on
Most of the content is vernacular content, the foundation in the foundation uses own understanding, simple have comprehensive summary basic knowledge, convenient deepen understanding!
For more detailed learning – see mdN-javascript documentation, (Little Red Book/White Paper/Blue Book /.) Learning the advanced
1. What is JavaScript?
JavaScript is a high-level/dynamic/interpreted programming language that is well suited to object-oriented and functional programming styles.
JavaScript’s variables are untyped, and its syntax is roughly similar to Java’s, but otherwise unrelated
- Is a secure client-side scripting language used to implement and
web
Page interaction - Runtime environment: Browser
- The soul of page action
2,
- Scripting language: Language embedded in
html
In the code js
You can make static elements in the page move
3. What constitutes JavaScript?
ECMAScript
The European Computer Manufacturers Association is an organization used to regulateJavaScript
grammarES5
ES6
.BOM
: Browser object modelDOM
: Document object model
4. JavaScript code to implement internal scripts or external connections
- All js code must appear in
<script>
Beginners are advised to place the tag under body <script>
Tag location is arbitrary except within the title tag- use
<script src='xx.js'>
- with
src
Properties of thescript
Invalid JS code inside tag
5. Several output statements of JavaScript
alert()
A pop-up dialog box blocks other code executionconsole.log()
Console output is used for debuggingdocument.write( )
Output in the browser
Shortcut:
ctrl + /
Single-line commentsctrl + shift + /
Multiline commentCTRL + up arrow
Adjust code up (down arrow adjust code down)ctrl + D
Delete a whole line
Conclusion:
.
This is called document.write().
And then the parentheses are called document.write().
There are no parentheses called properties
6. Comments in js
// Here are the comments
Single-line comments/** Here is the comment */
Multiline comment
7, js literal (constant) fixed invariable quantity
- The numerical number
- The integer
- Decimal integer
0-9
90 - binary
0 1
composition - Octal 0–7 is usually formed with
0 at the beginning
076
- Hexadecimal 0–9 a–f usually in 0x color:
#ffffff
- Decimal integer
- The decimal
- Character string
One or more in quotation marks
But notice that the quotes are nested “” “” “” “”
- Boolean value: true false
8. Identification in JS(zhi)
Naming conventions for characters (variables)
- 1. Consists of alphanumeric digits and underscores (_) $
- 2. Do not start with a number
- 3. The name cannot be a keyword specified by the system
Example: a3 sname age-age (error) _json 5a(error)
- Don’t name it emotionally
- Hump nomenclature:
- Small hump zuiAiNiDeRen getElementById()
- Big hump ZuiAiNiDeRen
- Hungarian naming:
- iNum = 90
- oBtn object
9. Variables in js
What is a variable: a value that may change during the course of a program
10. Define and assign variables
Var num = 90;
Variables must be defined before they are used
11, js output results pay attention to several problems:
- 1, if the output is a variable, do not put quotation marks
- 2. If the output is a character, it must be in quotes
- 3, if the output is a number, do not use quotation marks
- 4, if the output characters and variables, must be + connection
12. Data types of variables (key)
- Basic data types:
- There are multiple string values
- The value of number has multiple values
- Boolean values have two values: true, true, false, false
- Compound data types (reference data types, object data types) : object
- Special data type: undefined NULL
- The function function
Test the data type of the variable
- Typeof variable
- Typeof value: string number Boolean undefined object-function (no null)
The following continues with Day1
Day1 (2)
Just keep up with the pace and move forward. Calm Down & Carry On!