1. JS Definition: Event-and object-driven, and security-performance scripting language
--------------JS can be written anywhere in the HTML and written more clearly on the last side of the HTML. Note JS is case-sensitive
2. Introduction of:
JS has two ways of introducing:
-------------<script type= "text/javascript" specific JS code </script>
--------------<script type= "Text/javascript" src= "JS filename" ><script> then create a new JS file.
3. There are two types of annotations:
--------------//Single line comment
--------------/* Multiline Comment */
4, JS output syntax:
--------------Pop-up window form alert ();
--------------Console output: Console.log (); Generally as a debug output statement (no output in the page, you need to see the output in the review element's console)
--------------prompt () method to display a dialog box to prompt the user for input
--------------document.write () print in an HTML document
5, Variable: The amount of the value can change is the variable. A variable is a "container" for storing information.
Defined with Var
var aa=11, which defines a variable AA, assigns a value of 11 to AA.
6. Data type
-------------Number (int/float) (integer, decimal) var aa=123 or Var aa=123.456
--------------string-character var name = "abc"; var aa= "123"
The value of the variable--------------boolean is displayed as True or False.
--------------undefined undefined type
--------------Object (array is part of an object)
--------------NULL Type: null object type. Can be understood as a placeholder for an object, and when initialized, it is assigned a value of NULL
--------------undefined undefined type
--------------Object Type: Window document array
--------------typeOf (): Type of output variable
7. Mathematical Functions
-------------math.random (), random () is an arbitrary number between 0 and 1: cannot fetch 1.
-------------Math.max (2,4,5,8) returns the largest of the specified number
------------math.min (2,4,5,8) returns the smallest of the specified number
------------Math.PI--------Pi
8. Date Time function
--------------var mydate = new Date (); Gets the current time of the system
--------------Mydate.getyear (); Gets the value of the current year-1900 (2-bit)
-------------mydate.getfullyear (); Get the full year (4-bit, 1970-????)
-------------Mydate.getmonth (); Get the current month (0-11, 0 for January)
-------------mydate.getdate (); Get current day (1-31)
-------------Mydate.getday (); Get Current week x (0-6, 0 for Sunday)
-------------Mydate.gettime (); Gets the current time (the number of milliseconds since 1970.1.1)
-------------mydate.gethours (); Get current number of hours (0-23)
-------------mydate.getminutes (); Gets the current number of minutes (0-59)
-------------mydate.getseconds (); Gets the current number of seconds (0-59)
-------------mydate.getmilliseconds (); Gets the current number of milliseconds (0-999)
-------------mydate.tolocaledatestring (); Get Current date
-------------var mytime=mydate.tolocaletimestring (); Get current time
-------------mydate.tolocalestring (); Get Date and time
JS Basic knowledge