JavaScrip and Java are essentially unrelated. In terms of historical sources, they still have a certain origin. In fact, JavaScript was called LiveScript in its early days. At that time, Java was already very popular, so LiveScript was renamed Javascr
Operating environment for this tutorial: Windows 7 system, JavaScript version 1.8.5, Dell G3 computer.
What is the relationship between JavaScript and Java?
What surprises me is that essentially they have nothing to do with each other.
I can’t believe it, then why do you look so similar?
As far as historical sources are concerned, they still have a certain origin. In fact, JavaScript was called LiveScript in its early days.
At that time, Java was already very popular, so LiveScript was renamed Javascript.
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.
It has always been at the top of the programming language rankings. When it comes to front-end Javascript, it is also an unavoidable hurdle.
I learned HTML a few days ago. If I say:
The main function of HTML is to create the structure of a web page.
The main function of CSS is to beautify the page.
Then the main role of JavaScript is to interact with users.
What is the difference between JavaScript and Java?
But the comment formats of js and Java are exactly the same. Next, we will study the syntax of js carefully.
1 Introduction of JavaScript
The introduction method is very similar to CSS. CSS is the style tag, and js is the script tag.
①Introduce
internally to write js code directly in the HTML file, and its representative tag is the script tag.
Just write the corresponding js syntax in the tag.
There can be multiple script tags in one HTML file.
②External introduction
Create a special js file externally, and the JavaScript code is written in it.
If necessary, just use the src attribute in the script tag to introduce it in the HTML file.