What is JavaScript?

Source: Internet
Author: User

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-Oriented

In 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). Dynamic

The 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?

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.