Home > Web Front-end > JS Tutorial > body text

Which is easier, java or javascript?

醉折花枝作酒筹
Release: 2023-01-07 11:44:18
Original
4316 people have browsed it

It is definitely JavaScript that is easy to learn, because it is not a complete language, it is just a simple statement that is used to control the elements in the web page and make them move. In addition, many smart phones now support JAVASCRIPT, and it is very convenient to use JAVASCRIPT to write programs.

Which is easier, java or javascript?

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

It is definitely JavaScript that is easy to learn, because it is not a complete language, it is just a simple statement that is used to control the elements in the web page and make them move.

In addition, many smart phones now support JAVASCRIPT. It is really convenient to write programs with JAVASCRIPT. I especially like to write some small text database query programs on smart phones. It is easy to write and easy to run.

JavaScript is an interpreted scripting language that mainly runs on browser clients and is a weakly typed language; while Java is a strongly typed programming language, like VC and C#!

JavaScript is like a child, still growing, while Java is more like a man who can already stand alone, so it is definitely easier to communicate with the latter, but if you want to communicate with the former, you need to pay some costs , but the result may be a different programming experience.

Extended information:

In fact, JavaScript is more and more similar to Java in some aspects. For example, the current JavaScript is defined like this:

class Cat {
constructor(name) {
this.name = name;
}
}
const mCat = new Cat('yorkie');
console.log(mCat.name);
Copy after login

Did you see that the current writing method is very similar to Java's class definition, and it is much simpler than the original writing method.

In my opinion, JavaScript is indeed a bad language because it is not concise enough, easily causes ambiguity, etc. However, there are also some reasons for its existence. The biggest advantage and disadvantage of JavaScript is that it is first used for browsing. It is a programming language for server services, which means that the machine on which the code runs is very uncontrollable. It also means that we always have to ensure that the previous code is available, so the community also has such a saying as the best code standard.

If the subject is familiar with Java, you can start with TypeScript. The syntax is more similar. For example, in Pipcook, an LRU implemented using TypeScript:

export default class LruCache {
private values = new Map();
private maxEntries: number;
constructor(maxEntries = 100) {
this.maxEntries = maxEntries;
}
public get(key: string): T {
const hasKey = this.values.has(key);
let entry: T;
if (hasKey) {
entry = this.values.get(key);
this.values.delete(key);
this.values.set(key, entry);
}
return entry;
}
public put(key: string, value: T) {
if (this.values.size >= this.maxEntries) {
const keyToDelete = this.values.keys().next().value;
this.values.delete(keyToDelete);
}
this.values.set(key, value);
}
}
Copy after login

Is it suitable for What about Java students who don’t have any difficulty reading?

[Recommended learning: javascript advanced tutorial]

The above is the detailed content of Which is easier, java or javascript?. 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