Home  >  Article  >  Web Front-end  >  An explanation of JavaScript itself

An explanation of JavaScript itself

巴扎黑
巴扎黑Original
2017-07-24 14:24:281052browse

JavaScript is an interpreted language rather than a compiled language. It is often considered a scripting language rather than a real programming language. That is, scripting languages ​​are simpler, they are programming languages ​​used by non-programmers.

If a programmer does not have a solid understanding of JavaScript, he will find the whole process difficult when he wants to use JavaScript to perform more complex tasks.

According to the ECMA-262 standard, the official name of the JavaScript language is ECMAScript. However, this unwieldy name is only officially used when the standard is explicitly referenced. Technically, the name "JavaScript" refers only to the implementation of the language from Netscape and the Mozilla Foundation. In fact, everyone calls this language JavaScript.

Client-side JavaScript combines the scripting capabilities of the JavaScript interpreter with the Document Object Model (Dom) defined by the web browser.

JavaScript can not only control the content of HTML documents, but also the behavior of these documents.

JavaScript is a general-purpose programming language, and its uses are not limited to web browsers. JavaScript is designed to be embedded into any other application and provide scripting capabilities to the application.

If you need to truly learn a new programming language, you must use it to write programs.

For simple JavaScript experiments, it is sometimes possible to use the JavaScript:URL pseudo-protocol to evaluate a JavaScript expression and return the evaluation result. A JavaScript URL is composed of JavaScript: protocol specifier plus arbitrary JavaScript code (separated by semicolons between statements). When a browser loads such a URL, it will execute the JavaScript code contained within it. The value of the last expression in such a URL will be converted into characters, and the string will be displayed in the web browser as a new document.

The lexical structure of a programming language is a set of basic rules that detail how to write programs in the language. It is the lowest level syntax of a language, specifying rules such as what variable names should look like, what characters should be used for comments, and how statements should be separated.

JavaScript programs are written using the Unicode character set. The 16-bit Unicode encoding can represent every written language commonly spoken on earth. This is an important feature of internationalization, especially for programmers who do not speak English.

JavaScript is a case-sensitive language.

These tag and attribute names can be entered in any case in HTML, but in JavaScript they are usually lowercase.

Direct quantity is the data value directly displayed in the program.

Identifier is a name, which is used to name variables and functions, or used as a label for certain loops in JavaScript code. The first character must be a letter, underscore, or dollar sign. An identifier cannot have the same name as a keyword used for other purposes in JavaScript.

Reserved words, break, do, if, switch, typeof, case, else, in, this, var, catch, false, instanceof, throw, void, continue, finally, new, true, while, default , for, null, try, with, delete, function, return.

In a programming language, the type of value that can be represented and manipulated is called a data type, and one of the most basic features of a programming language is the set of data types it supports. JavaScript allows the use of 3 basic data types - numbers, text strings and Boolean values. There are also two small data types, null (empty) and undefined (undefined), each of which defines a value.

JavaScript also supports consistent data types - objects. There are two types of objects in JavaScript. One object represents an unordered collection of named values, and the other represents an ordered collection of numbered values. The latter is called an array.

Special object——Function. A function is an object with executable code that can be used as a calling function to perform some action. Functions behave differently from other types of objects.

The difference between Javascript and other programming languages ​​​​is that it does not distinguish between integer values ​​and floating point values. All numbers in JavaScript are represented by floating point types. JavaScript number format allows exact representation of all integers between -9007199254740992 (-2^53) and 9007199254740992 (2^53), but using integers beyond this range, you lose mantissa precision.

Escape sequence, in JavaScript strings, the backslash (\) has a special purpose. Adding a character after the backslash symbol can represent characters that cannot appear in the string.

The above is the detailed content of An explanation of JavaScript itself. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn