Three swordsmen of static resources — JavaScript (1)

Time:2020-12-31

The history of introducing JavaScript

 

Basic syntax of JavaScript

1. How to combine with HTML

 

2.0 notes and data types

 

3.0 variables

4.0 operators

(1) Unary operator

(2) Comparison operator

 

(3) Logical operators

 

(4) Ternary operator

 

 

5. Flow control statement

 

6. JS special syntax

Exercise: print a 99 multiplication table on the page

99 multiplication table
    
       td{
         border: 3px  solid gray;
       }
    
    
        document.write("<table align='center'>");
        for(var i=1;i<=9;i++)
        {
            document.write("<tr>");
            for (var j=1;j<=i;j++)
            {
                document.write("<td>");
                document.write(i+"*"+j+"="+(i*j)+"&nbsp"+"&nbsp"+"&nbsp"+"&nbsp");
                document.write("</td>");
            }
            document.write("</tr>");
        }

  

Object of JavaScript

1.0 function object

 

2.0 Array

 

3.0 date

4.0 math

 

Regexp 5.0 regular expression object

 

 

Global objects