JavaScript is a scripting language
JavaScript is a lightweight programming language.
JavaScript is a programmatic code that can be inserted into an HTML page.
When JavaScript is inserted into an HTML page, it can be run by all modern browsers.
JavaScript is very easy to learn.
What is JavaScript?
JavaScript is an explanatory (not compiled) scripting language, and its main features are: Object- oriented , weak-type , dynamic , prototype-based object-oriented ( Object )(not class-based)
Java is a class-based object-oriented, and is a compiled language
1). Explanatory type (not compiled type)
L Code after writing, do not need to compile, directly from the JS parsing engine to parse the run (more dynamic, but the cost is larger)
2). Weak type
when declaring a variable, it is not necessary to specify its data type, and it can be assigned to arbitrary types of data at any time, and the interpreter will take the initiative to shape it according to the context.
<! DOCTYPE html>
3). Object-OrientedIn JavaScript, "Everything is the object", in this regard, it is more thorough than other OO languages, even if it is the function of the vector of the code itself, it is also the object. The bounds of data and code are pretty vague in JavaScript
4). DynamicThe properties of an object can be set dynamically after the object has been created, and the property value can be a random type of data (naturally, it can be a function)
We added the school property and the Getschool method after we created the object.
Obj.school = "Nupt"; obj.getschool = function () {return this.school;};
<! DOCTYPE html>
5). Prototype-based (object) (not class-based)L do not have the concept of real class in JS, how to implement the code reuse it?
, that's prototype.
Use {} to create an object
Name and age are properties of the Obj object, GetName and Getage are member functions of the Obj object
Note: A colon between the attribute and the value
A colon is a delimited key and a value that separates property names from property values
The attribute is a comma , not a semicolon , between the attributes.
<! DOCTYPE html>
What is JavaScript?