Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What are the grammatical differences between java and javascript

2025-04-03 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

This article focuses on "what are the grammatical differences between java and javascript". Interested friends may wish to have a look. The method introduced in this paper is simple, fast and practical. Next, let the editor take you to learn "what are the grammatical differences between java and javascript"?

Syntax differences: 1, java single quotation marks can only represent a single character and can not be empty, while JavaScript single quotation marks can be empty, can also wrap multiple characters; 2, java variables have a clear type, you must declare the type before use, and variables in JavaScript do not need, it is a dynamic type.

The operating environment of this tutorial: windows7 system, javascript1.8.5&&java8 version, Dell G3 computer.

Syntax differences between java and javascript

Character

Single quotation marks in java can only represent a single character and cannot be empty

'a '√' × 'aa' ×

Variable

Variables in java have explicit types (byte1,short2,int4,long8,float4,double8,char2,boolean1)

Variables in JavaScript are dynamic types.

The Java variable must declare a type before it can be used, while JavaScript does not.

Array

Java cannot change the length of an array after defining it, but javascript can

rule of grammar

The syntax rules of Java are much stricter and more powerful than JavaScript.

Extended knowledge: other differences between JavaScript and java

* * Features * Java** JavaScript** object-oriented object-oriented programming language is object-based and not completely process-oriented. There are some object-oriented features that run the compiled language and generate intermediate files. The intermediate file bytecode interpretation will not be generated, explain part of it, and then run another part. The cross-platform installation virtual machine runs in the browser, as long as the system has a browser. Data type strongly typed language, different data weak types, the same variable can be assigned to different data types. Types are strictly case-sensitive

JavaScript language composition

The specification of all ECMA Script scripting languages forms the core foundation of the JS language.

DOM Document Object Model document object model, which is used to manipulate various elements and tags in web pages

BOM Browser Object Model browser object model, which is used to manipulate various objects in the browser, such as windows

JavaScript five data types

Number numerical type

Boolean Boolean type: true/false

String string, no character type

Object object types: built-in objects, custom objects

Undefined undefined type, no initial value assigned, I don't know what type it is

Considerations for JavaScript

About weak types?

A variable can assign values of different data types

What are the quotation marks of characters and strings in JS?

In JS, there is no distinction between characters and strings, both are strings, and strings can use either single or double quotation marks.

What are the characteristics of variables defined by var?

The var keyword is not required and can be omitted, but is not recommended. If the var keyword is omitted from defining a variable in the function body, the variable is a global variable

Variables can be defined repeatedly

It is not the curly braces of a function and cannot limit the scope of a variable.

At this point, I believe you have a deeper understanding of "what are the grammatical differences between java and javascript". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report