This tutorial is suitable for beginners of javascript. A summary of the basic knowledge of javascript includes variables, basic types, and other knowledge points. You need to come and learn about it. 1. JavaScript Language Features
1.1 JavaScript is based on objects and events (dynamic)
It can directly respond to user or customer input without going through Web service programs. It responds to users in an event-driven manner. The event-driven action refers to the action produced by performing an operation on the home page. It is called an "Event ". For example, pressing the mouse, moving the window, and selecting a menu can be regarded as an event. When an event occurs, it may cause the corresponding event response.
1.2. JavaScript is cross-platform
JavaScript depends on the browser and has nothing to do with the operating system.
Ii. JavaScript Variables
2.1 define variables
When defining variables, all variables are represented by "var variable name". For example, var str; you can even omit the keyword var.
2.2. How do I determine the type of JavaScript variables?
The data type of variables in JavaScript is determined by the JS engine.
Var name = "lone wolf"; // name is string type var age =; // age is number type var flag = true; // flag is boolean type var email; // The email is only declared and no value is assigned. Therefore, it indicates the "undefined" type, that is, the name = cannot be determined. // The name is automatically changed to the number type.
2.3 use the typeof keyword to view the specific data type represented by the variable
The typeof operator has a parameter, that is, the variable or value to be checked. For example:
Var sTemp = "test string"; alert (typeof sTemp); // output "string" alert (typeof); // output "number"
When the typeof operator is called for a variable or value, one of the following values is returned:
Undefined-if the variable is of the Undefined type
Boolean-if the variable is of the Boolean Type
Number-if the variable is of the Number type
String-if the variable is of the String type
Object-if a variable is of the reference or Null type
Test code: