js basics

js basic concept

js local variables and global variables

js Data type

var is a weak data type, but js can recognize his data type

  
  
  
 
 
   
  

About the method of js

Writing of the method

 
   



Method coverage

Different from Java, there is no method overloading in js, only method coverage

as long as the method names are the same. No matter how many parameters there are, js unity will only recognize the last method (method override)

  
  
  
  
 
 
 
  
   
  
  

js data type conversion

Although js only has one var to describe the variable (weak data type), the system can recognize his Data type, data type conversion can also be performed

 
   
   

Operation calculation in js

JS operation rules are the same as Java (but special attention: x=+y)

function abc(){
     var a='#39;10';
     var b='8';
     console.log("The value of b "+b+" The data type of b is converted to "+typeof(b)+" "+a)
     /* =+ first convert a to number and then copy the value of a to b */
     /* += is equivalent to b+=a == b=b+a */
    }

Select statement and loop statement

Short: same as java

js main object

window object

time intervalr

 
 
   

Array usage

 
   
   
   
  

Basic operations on strings

 
   
  

JS time formatting

 
 
   
  

Recommended tutorial: “JS Tutorial”

The above is the detailed content of js basic knowledge, please pay attention to other related articles on 1024programmer.com for more!

This article is from the internet and does not represent1024programmerPosition, please indicate the source when reprinting:https://www.1024programmer.com/js-basics/

author: admin

Previous article
Next article

Leave a Reply

Your email address will not be published. Required fields are marked *

Contact Us

Contact us

181-3619-1160

Online consultation: QQ交谈

E-mail: [email protected]

Working hours: Monday to Friday, 9:00-17:30, holidays off

Follow wechat
Scan wechat and follow us

Scan wechat and follow us

Follow Weibo
Back to top
首页
微信
电话
搜索