What is javascript ?, Javascript
JavaScript is a scripting language
JavaScript is a lightweight programming language.
JavaScript is the programming code that can insert HTML pages.
After JavaScript is inserted into the HTML page, it can be executed by all modern browsers.
JavaScript is easy to learn.
What is javascript?
JavaScript is an interpreted (not compiled) scripting language. It has the following main features: Object-oriented, weak type, dynamic, and prototype-based object-oriented (object) (not class-based)
Java is a class-based object-oriented language and a compilation language.
1). interpreted (not compiled)
LAfter the code is compiled, it does not need to be compiled. It is directly parsed and executed by the js parsing engine (dynamic performance is better, but the overhead is large)
2). Weak type
LWhen declaring a variable, you do not need to specify its data type, and it can be assigned any type of data at any time. The Interpreter automatically shapes the variable according to the context.
<!DOCTYPE html>
3). Object-oriented
LIn JavaScript, "Everything is an object". In this respect, it is more thorough than other OO languages. Even as a function of the Code itself, it is also an object, the boundaries between data and code are already quite vague in JavaScript.
4). Dynamic
LThe attributes of an object can be dynamically set after the object is created, and the attribute value can be any type of data (naturally, it can be a function)
After creating an object, we added the school attribute and the getSchool method.
obj.school = "nupt";obj.getSchool = function(){return this.school;};
<!DOCTYPE html>
5). Based on the prototype (object) (not based on the class)
LThere is no real class concept in js. How can we reuse code ?, That is prototype.
Use {} to create an object
Name and age are the properties of the obj object. getName and getAge are the member functions of the obj object.
Note: The attribute and value areColon
A colon is a separator key and value used to separate attribute names and attribute values.
Between an attribute and an attribute isCommaInsteadSemicolon!
<!DOCTYPE html>
Copyright Disclaimer: This article is an original article by the blogger and cannot be reproduced without the permission of the blogger.