JavaScript can't be cross-platform, right?

青灯夜游
Release: 2022-09-20 16:48:58
Original
3783 people have browsed it

No, javascript can be cross-platform. The JavaScript script language depends on the browser itself and has nothing to do with the operating environment (system). As long as the computer can run the browser and the browser supports JavaScript, it can be executed correctly; JavaScript has been supported by most browsers, so Can run on multiple platforms (such as Windows, Linux, Mac, Android, iOS, etc.).

JavaScript can't be cross-platform, right?

The operating environment of this tutorial: windows7 system, javascript version 1.8.5, Dell G3 computer.

No, javascript can be cross-platform.

JavaScript ("JS" for short) is a lightweight, interpreted or just-in-time compiled, cross-platform programming language with function priority. Although it is famous as a scripting language for developing Web pages, it is also used in many non-browser environments. JavaScript is a dynamic scripting language based on prototype programming, multi-paradigm, and supports object-oriented, imperative and declarative (such as functional programming) style.

The complete composition of JavaScript*

  • ECMAScript, which describes the syntax and basic objects of the language.

  • Document Object Model (DOM) describes the methods and interfaces for processing web content.

  • Browser Object Model (BOM) describes the methods and interfaces for interacting with the browser.

Characteristics of JavaScript

1. Script language for sequential interpretation and execution

Its basic structural form is very similar to c, c and java. But it does not need to be compiled first like these languages, but == is interpreted line by line during the running of the program. ==It needs to be embedded into the html page and let the browser interpret and execute it.

2. Object-based language

javascript is an object-based language. Objects can be created in the program

3. Simplicity

It is a simple and compact design based on java basic syntax statements and control flow. The syntax in basic java can be used

into javascript. Therefore, if you have learned the Java language, learning JavaScript is relatively simple

4. Weakly typed language

Its syntax is loose and the requirements are not rigorous, such as a variable It can be used directly without previous declaration. When declaring a variable, you can also not declare the type of the variable, etc.

5. Event-driven

on the page Operations, such as left/right click and double-click, monitoring of keyboard keys, mouse movement, mouse dragging, mouse scrolling and other event response processing can be handed over to JavaScript

6. Dynamics

JavaScript can respond directly to user or customer input without going through the web service program

7. Security

JavaScript does not allow access to the local hard disk, and cannot store data on the server. It does not allow modification and

deletion of network documents. Information browsing or dynamic interaction can only be achieved through the browser. . Thus effectively preventing the loss of data

8、Cross-platform

The JavaScript script language does not depend on the operating system and only requires the browser support. Therefore, a JavaScript script can be used on any machine after being written, provided that the browser on the machine supports the JavaScript script language. JavaScript has been supported by most browsers, so it can run on a variety of platforms (such as Windows, Linux, Mac, Android, iOS, etc.).

Simply put, JavaScript depends on the browser itself and has nothing to do with the operating environment. As long as the computer can run the browser and the browser supports JavaScript, it can be executed correctly. But different browsers and different versions of the same browser support JavaScript differently (browser compatibility).

Unlike server-side scripting languages, such as PHP and ASP, JavaScript is mainly used as a client-side scripting language to run on the user's browser and does not require server support. Therefore, in the early days, programmers preferred JavaScript to reduce the burden on the server, but at the same time it also brought about another problem, security.

As servers become more powerful, although programmers prefer scripts running on the server to ensure security, JavaScript is still popular for its cross-platform and easy-to-use advantages. At the same time, some special functions (such as AJAX) must rely on JavaScript to be supported on the client side.

The role of JavaScript

1. Dynamically improve the design layout of the web page (operate the label elements in the page)

2 , Verification form

3, Detect browser, control browser behavior

4, Create cookies

5, Handle events triggered on the page

6. JavaScript should also be used when using ajax

[Related recommendations: javascript video tutorial, Basic programming video]

The above is the detailed content of JavaScript can't be cross-platform, right?. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!