In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-03 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly shows you "JavaScript learning knowledge points", the content is easy to understand, clear, hope to help you solve doubts, the following let the editor lead you to study and learn "what are the knowledge points of JavaScript learning" this article.
First, a simple introduction to JavaScript
1.1. A client scripting language
That runs in the client browser. Every browser has a parsing engine for JavaScript
Scripting language: it can be parsed and executed by the browser without compilation.
Function: you can enhance the interaction between users and html pages, control html elements, make the page have some dynamic effects, and enhance the user experience.
The history of 1.2.JavaScript development
In 1992, Nombase developed the first client-side scripting language, which was specifically used for form validation. Named: Cmure -, and later changed its name to: ScriptEase
In 1995, Netscape developed a client-side scripting language: LiveScript. Later, an expert from SUN was invited to modify the LiveScript and name it JavaScript.
In 1996, Microsoft copied JavaScript to develop the JScript language.
In 1997, ECMA (European Association of computer Manufacturers) developed a standard for client scripting languages: ECMAScript, which unifies the coding of all client scripting languages.
JavaScript = ECMAScript + JavaScript own unique thing (BOM+DOM) 1.3.JavaScript advantage
a. Interpretive language
b. Object-based
c. Event driven
d. Weak type
e. High security
f. Cross platform
1.4.JavaScript reference
To insert JavaScript in a HTML page, use a tag.
And will tell JavaScript where to start and end.
The line of code between and contains JavaScript
Several ways of 1.5.JavaScript output window.alert () [xss_clean] () innerHTMLconsole.log ()
From the point of view of personal use, console.log () is more convenient to use in programming, and the direct F12 console can view the output.
What keywords does 1.6.JavaScript have?
1.7.JavaScript comment
/ / this is the code: a single sentence comment, which is usually ctrl + L in the editor.
/ * this is the code * /: multi-line comments, in the editor is generally ctrl + shift + L key.
What are the common identifiers of 1.8.JavaScript
What are the common HTML events in 1.9.JavaScript
1.10.JavaScript common operators
Common assignment operators for 1.11.JavaScript
1.12.JavaScript common comparison operator
1.13.JavaScript common logical operators
Second, elaborate on the basic grammar of JavaScript 2.1. Variable 2.1.1. Define a variable / / declare a variable named test. Var test;var age, name, sex;// declare age, name, sex three variables / / declare variables and assign values var age = 10, name = "Xiaoqiang", sex = "1"; 2.1.2. Variable naming rules and specifications
1. It consists of letters, numbers, underscores and symbols, and cannot start with a number.
2. Keywords cannot be used, for example: while
3. Case-sensitive
Norm: a conventional way of writing
1. The variable name should be meaningful.
2, follow the hump naming method, hump naming method: the first letter is lowercase, followed by an uppercase word, such as userName.
2.2. Data type
The data types are: Number type, String type, Boolean type, Undefined type, Null type, Object type.
2.2.1.Number
Number numeric type: contains integers and decimals
Can be expressed as: decimal, octal, hexadecimal
Such as:
Var num = 10; / / Decimal var num1 = 012; / / Octal var num2 = ox123; / / hexadecimal
Range of values:
Console.log (Number.MAX_VALUE); / / maximum value is 5e-324console.log (Number.MIN_VALUE); / / minimum value is 1.7976931348623157e+308 infinity: Infinity infinitesimal:-Infinity
Numeric judgment cannot use decimals to verify decimals and do not use NaN to verify whether it is NaN (NaN----not a number), but can use isNaN- is not a number to verify whether the result is NaN.
Such as:
Var num; / / declares a variable with no value console.log (isNaN (num)); / / isn't true a number? The result is true2.2.2.String.
String escape character:
Escape sequence character\ b Backspace\ f Paper feed\ nLine feed\ r enter\ t horizontal jump (Ctrl-I)\ 'single quotation mark\ "double quotation mark\ double slash
Eg:
Var str = "iam a pm\" console.log (str); / / iam a pm\
String concatenation:
Var str1 = "Sir"; var str2 = "Hello"; console.log (str1+str2); / / Hello, sir
If the string and number stitching result is also the string stitching effect as shown above
2.2.3.Boolean
Two attributes true/false for Boolean type
2.2.4.Undefined
Undefined represents a variable that declares no assignment. When the variable is only declared, the default value is undefined.
Such as:
Var num;console.log (num); / / undefined2.2.5.Null
Null represents an empty value. If you want the value of the variable to be null, you must set it manually.
2.2.6.Object2.3. Conversion of data types 2.3.1. Convert to a numeric type
(1), Number () can convert any value to a numeric value. If there is a character in the string that is not a numeric value, return NaN.
Such as:
Var num1 = Number ("10"); console.log (num1); / / 10var num2 = Number ('10adbdn'); console.log (num2); / / NaNvar num3 = Number ("10.78"); console.log (num3); / / 10.78var num4 = Number (' 10.65dd'); console.log (num4); / / NaNvar num5 = Number ("A10"); console.log (num5); / / NaN
(2), parseInt () to integer
Such as:
Var num1 = parseInt ("10"); console.log (num1); / / 10var num2 = parseInt ('10adbdn'); console.log (num2); / / 10var num3 = parseInt ("10.78"); console.log (num3); / / 10var num4 = parseInt (' 10.65dd'); console.log (num4); / / 10var num5 = parseInt ("A10"); console.log (num5); / / NaN
(3), parseFloat () to decimal
Such as:
Var num1 = parseFloat ("10"); console.log (num1); / / 10var num2 = parseFloat ('10adbdn'); console.log (num2); / / 10var num3 = parseFloat ("10.78"); console.log (num3); / / 10var num4 = parseFloat (' 10.65dd'); console.log (num4); / / 10var num5 = parseFloat ("A10"); console.log (num5)
The difference among (4), Number (), parseInt () and parseFloat ()
Number () is stricter than parseInt () and parseFloat ().
ParseInt () is similar to parseFloat (), and parseFloat parses the first one. I met the second one. Or a non-digital end.
2.3.2. Convert to string type
(1), toString ()
Such as:
Var num = 10. Console.log (num.toString ()); / / string 10
(2), String ()
Such as:
Var num1 = 5 position console.log (String (num1)); / / string 5
(2), JSON.stringfy ()
2.3.3. Convert to Boolean type
0, empty string, null, undefined, NaN will be converted to false and the rest will be converted to true
Such as:
Var num1 = Boolean (0); console.log (num1); / / falsevar num2 = Boolean (""); console.log (num2); / / falsevar num3 = Boolean (null); console.log (num3); / falsevar num4 = Boolean (undefined); console.log (num4); / / falsevar num5 = 10 politics var num6;console.log (Boolean (num5+num6); / false2.4. Operator
Types of operators: arithmetic operators, composite operators, relational operators, logical operators
(1) arithmetic operator: "+"-"*" / "%"
Arithmetic expression: expression complex operation connected by arithmetic operator
(2) compound operator: "+ ="-= "* =" / = "% ="
Composite operation expression: an expression connected by a composite operator
(3) Relational operator: ">"="
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.