Home Web Front-end Front-end Q&A Is javascript based on java?

Is javascript based on java?

Oct 18, 2022 pm 04:03 PM
javascript

Javascript is not based on Java, they are two completely different language architectures. Java is a language between interpreted and compiled languages. Before being passed to the client for execution, the source code of Java must be compiled and compiled independently of a specific platform through the interpreter on the corresponding platform. The constraints of the code; JavaScript is an interpreted programming language, and its source code does not need to be compiled before being sent to the client for execution. Instead, character codes in text format are sent to the client for interpretation and execution by the browser.

Is javascript based on java?

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

javascript is not based on java. Although Java and javascript are both programming languages, they are two completely different language architectures.

Java is a new generation of object-oriented programming language and a programming language launched by SUN Company, which is particularly suitable for Internet application development. It is an interpreted language with syntax rules similar to C.

JavaScript is a product of Netscape. Its purpose is to extend the functions of Netscape Navigator and develop an object-based and event-driven interpreted language that can be embedded in Web pages; it is a compliance with the ECMA 262 language specification. A realization.

The reason why the letters in the shapes of java and javascript are very similar

It is generally believed that the reason why Netscape named LiveScript JavaScript at that time was because Java was the most popular programming at the time. Language, with the name "Java" helping the spread of this new language.

To put it bluntly, isn't this a typical hot spot nowadays?

Many Java programmers want to learn a scripting language. When they see how it is so similar to Java, they feel very familiar with it, so they might as well learn it.

JavaScrip has taken advantage of Java's hot spots, which has greatly helped its development. Of course, its language itself is also excellent, and it has slowly been recognized by the public.

The similarities between Java and JavaScript:

  • Their syntax is very similar to the C language ;

  • They are all object-oriented (although the implementation methods are slightly different);

  • JavaScript was designed with reference to Java’s naming Rules;

The difference between javascript and java

1. JavaScript and Java are produced by different companies different products developed.

Javascript is a product of Netscape. Its purpose is to extend the functions of Netscape Navigator and develop an object-based and event-driven interpreted language that can be embedded in Web pages;

Java is a new generation of object-oriented programming language launched by SUN Microsystems, which is particularly suitable for Internet application development. In fact, the original name of javascript was not javascript, but LiveScript. The "Java" in the name was authorized by SUN Microsystems.

2. Java and JavaScript are essentially different

Javascript is object-based, a scripting language, and an object- and event-driven programming language. , thus it itself provides a very rich set of internal objects for designers to use. Java is object-oriented, that is, Java is a true object-oriented language. Even when developing simple programs, objects must be designed.

3. JavaScript and Java are executed in different ways in the browser

javascript is an interpreted programming language, and its source code is sent to the client It does not need to be compiled before execution, but the character code in text format is sent to the client, that is, the javascript statement itself is downloaded along with the Web page and interpreted and executed by the browser.

The Java source code must be compiled before being passed to the client for execution. Therefore, the client must have an emulator or interpreter on the corresponding platform. It can be independent of the compiler or interpreter. Compile code for a specific platform.

4. Java mainly runs on the server side; javascript mainly runs on the client browser.

5. The variables used by javascript and Java are different. Similarly, variable declarations in JavaScript use weak types, that is, variables do not need to be declared before use, but the interpreter checks their data type at runtime. Java uses strong type variable checking, that is, all variables must be declared before compilation.

6. Different binding methods

Javascript uses dynamic binding, that is, JavaScript object references are checked at runtime. Java uses static binding, that is, Java object references must be made at compile time so that the compiler can implement strong type checking.

7,

javascript does not directly operate on text and graphics. It works together with HTML element combinations in Web pages, but it can control the browser and let the browser directly operate on text. and graphics processing. Java can directly operate on text and graphics.

8.

Java’s grammatical rules are much stricter than JavaScript, and its functions are much more powerful.

9, Java language code is a language that has nothing to do with HTML; JavaScript language code is a text character format that can be directly embedded in HTML documents and can be loaded dynamically.

10. The uses of the two are also different

java is widely used in personal PCs, data centers, game consoles, scientific supercomputers, mobile phones and the Internet, etc. .

The purpose of Javascript is:

1). Embed dynamic text in HTML pages;

2).Respond to browser events;

3).Read and write HTML elements;

4).Verify data before the data is submitted to the server;

5).Detect the visitor’s browser information;

6). Control cookies, including creation and modification.

Explanation:

In addition to looking more similar to Java, JavaScript has a very different language style. JavaScript was designed with reference not to Java, but to languages ​​like Self and Scheme.

【Related recommendations: javascript video tutorial, programming video

The above is the detailed content of Is javascript based on java?. For more information, please follow other related articles on the PHP Chinese website!

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

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

How to implement an online speech recognition system using WebSocket and JavaScript How to implement an online speech recognition system using WebSocket and JavaScript Dec 17, 2023 pm 02:54 PM

How to use WebSocket and JavaScript to implement an online speech recognition system Introduction: With the continuous development of technology, speech recognition technology has become an important part of the field of artificial intelligence. The online speech recognition system based on WebSocket and JavaScript has the characteristics of low latency, real-time and cross-platform, and has become a widely used solution. This article will introduce how to use WebSocket and JavaScript to implement an online speech recognition system.

WebSocket and JavaScript: key technologies for implementing real-time monitoring systems WebSocket and JavaScript: key technologies for implementing real-time monitoring systems Dec 17, 2023 pm 05:30 PM

WebSocket and JavaScript: Key technologies for realizing real-time monitoring systems Introduction: With the rapid development of Internet technology, real-time monitoring systems have been widely used in various fields. One of the key technologies to achieve real-time monitoring is the combination of WebSocket and JavaScript. This article will introduce the application of WebSocket and JavaScript in real-time monitoring systems, give code examples, and explain their implementation principles in detail. 1. WebSocket technology

How to use JavaScript and WebSocket to implement a real-time online ordering system How to use JavaScript and WebSocket to implement a real-time online ordering system Dec 17, 2023 pm 12:09 PM

Introduction to how to use JavaScript and WebSocket to implement a real-time online ordering system: With the popularity of the Internet and the advancement of technology, more and more restaurants have begun to provide online ordering services. In order to implement a real-time online ordering system, we can use JavaScript and WebSocket technology. WebSocket is a full-duplex communication protocol based on the TCP protocol, which can realize real-time two-way communication between the client and the server. In the real-time online ordering system, when the user selects dishes and places an order

How to implement an online reservation system using WebSocket and JavaScript How to implement an online reservation system using WebSocket and JavaScript Dec 17, 2023 am 09:39 AM

How to use WebSocket and JavaScript to implement an online reservation system. In today's digital era, more and more businesses and services need to provide online reservation functions. It is crucial to implement an efficient and real-time online reservation system. This article will introduce how to use WebSocket and JavaScript to implement an online reservation system, and provide specific code examples. 1. What is WebSocket? WebSocket is a full-duplex method on a single TCP connection.

JavaScript and WebSocket: Building an efficient real-time weather forecasting system JavaScript and WebSocket: Building an efficient real-time weather forecasting system Dec 17, 2023 pm 05:13 PM

JavaScript and WebSocket: Building an efficient real-time weather forecast system Introduction: Today, the accuracy of weather forecasts is of great significance to daily life and decision-making. As technology develops, we can provide more accurate and reliable weather forecasts by obtaining weather data in real time. In this article, we will learn how to use JavaScript and WebSocket technology to build an efficient real-time weather forecast system. This article will demonstrate the implementation process through specific code examples. We

Simple JavaScript Tutorial: How to Get HTTP Status Code Simple JavaScript Tutorial: How to Get HTTP Status Code Jan 05, 2024 pm 06:08 PM

JavaScript tutorial: How to get HTTP status code, specific code examples are required. Preface: In web development, data interaction with the server is often involved. When communicating with the server, we often need to obtain the returned HTTP status code to determine whether the operation is successful, and perform corresponding processing based on different status codes. This article will teach you how to use JavaScript to obtain HTTP status codes and provide some practical code examples. Using XMLHttpRequest

How to use insertBefore in javascript How to use insertBefore in javascript Nov 24, 2023 am 11:56 AM

Usage: In JavaScript, the insertBefore() method is used to insert a new node in the DOM tree. This method requires two parameters: the new node to be inserted and the reference node (that is, the node where the new node will be inserted).

JavaScript and WebSocket: Building an efficient real-time image processing system JavaScript and WebSocket: Building an efficient real-time image processing system Dec 17, 2023 am 08:41 AM

JavaScript is a programming language widely used in web development, while WebSocket is a network protocol used for real-time communication. Combining the powerful functions of the two, we can create an efficient real-time image processing system. This article will introduce how to implement this system using JavaScript and WebSocket, and provide specific code examples. First, we need to clarify the requirements and goals of the real-time image processing system. Suppose we have a camera device that can collect real-time image data

See all articles