· JS full-name JavaScript, is a Web page in the use of scripting language, JS is very powerful, you can implement various functions and special effects of HTML pages.
· JS Annotation method: Similar to other languages, JS in the annotation method is
• Single-line comment//xxxxx ...
• Multi-line Comment/*xxxxxxxx
xxxxxxxx*/
· The output syntax of JS:
alert ("Information that needs to be output, which can be a function or an expression"); Pop-up box display information content
confirm ("need to output de information"); The popup dialog (user interaction type) can be submitted via the Confirm and cancel button.
prompt ("user input information"); POPs up a dialog box that allows the user to enter
• Embed JS location: generally written at the bottom of the page content or the bottom of the body, because the page loading content order is from top to bottom.
Embedded format is <script type= "Text/javascript" > Content </script>
· JS basic knowledge of the program
• All characters are in English state, such as common semicolons, commas, and parentheses.
• In most cases, the end of each statement should be preceded by a semicolon;
• Line breaks after each piece of code ends
• The symbols for each program statement should be echoed back and forth.
· JS data type
• The stored name of the data in the program is called a variable, and the method of declaring the variable is the var variable name
Because JS is a weakly typed language, variable data types are not differentiated when declaring variables, but are automatically converted when stored
JS data types include int (integer type), float (single-precision decimal type), double (double-precision decimal)
Decimal (decimal), Money (currency type), char (character type) string (String type)
Boolean (Boolean: Return value only True and False) DateTime (date type)
• Forced conversion of data types =parse variable type (variable) of forced conversion; For example, Var x=parseint (x) is the conversion of X to integer type;
• Operator Expression: +-*/for subtraction,% for remainder (e.g. 5&2=1)
• Logical operators: && (and): Both are true and the result is true;
|| (OR): As long as one of them is true, the result is true;
! (non): reverse the result.
• comparison operator: = = (equals);! = (not equal to);> (greater than);< (less than); >= (greater than or equal to);
<= (less than or equal)
+ You can stitch strings;
A ==b? X:y (indicates selection judgment, output x If the result is true, output y if the result is false)
PHP Learning Day06 notes (first knowledge JS)