I mean, Python3 .。 It seems that Python is better than JavaScript in every way.
Note: I do not want this problem to become a language dispute, so you do not have to use both languages of the students please light spray.
-------------------
In fact, JS is not so bad, just such a code to make people puzzling:
var extends = This.extends | | Function (sub, super) {for (Var p in super) if (Super.hasownproperty (p)) sub[p] = super[p]; function empty () {this.constructor = sub;} Empty.prototype = Super.prototype; Sub.prototype = new Empty ();};
Reply content:
So you're Py2, or Py3?
=====16/3/31 modifying =====
You don't make sense. To seduce and rip, I write Py3 dafa good Py2 is spicy chicken Other languages more spicy chicken ... We are all civilized people to speak the truth.
As for the question asked by the Lord, it is enough to feel the beginning of the sentence.
Then there is the lack of something like coroutine,module.
Does the landlord know ES6? No, JavaScript does have a lot of confusing designs.
However, the private thought is far less than the browser giants to achieve the different standards of the Web API brings great harm.
If IE supports py2,chrome support Py3,firefox support Py3.6, you will feel a little less beautiful. It doesn't seem to make sense to wait for webassembly to discuss past style.
In addition, JS is not good? I like it a lot, t^t.
I really want to say why JS is more suitable for the front end than Python.
- First, its prototype-based ideas are very simple and well suited for scenarios where the front end does not require too complex logic.
- And he's good at fault tolerance (which in turn can be said to be less rigorous), so people who don't write code can write code that works. It is probably the low requirements of this entry that guarantee the prosperity of today's front-end.
Attached to Mr. Ruan's blog for reference: The birth of JavaScript
What language is the Web scripting language? Netscape had two options: one was to use existing languages, such as Perl, Python, TCL, scheme, and so on, to allow them to embed directly into the web, and the other was to invent a new language.
Each of the two options has pros and cons. The first choice, to make full use of the existing code and programmer resources, promotion is relatively easy, the second choice, conducive to the development of a fully applicable language, easy to achieve.
In the end of the choice, Netscape internal disputes, management for a moment difficult to make up its mind.
Just then, another big thing happened: In 1995, Sun company renamed the Oak Language Java and formally launched it to the market.
Sun's hype promises that the language can be "written once, run Everywhere" (write Once, run Anywhere), which seems likely to dominate the future.
Netscape decided to forge a coalition with sun. Not only does it allow Java programs to run directly in the browser in the form of applets (small programs), it even considers embedding Java directly as a scripting language, just because it makes HTML pages too complex to be abandoned later.
In short, the situation at the time was that the entire management of Netscape was a believer in the Java language, and Sun was fully involved in the decision making of the Web scripting language. As a result, JavaScript was later brought to market by Netscape and Sun's two companies, a language named "Java+script" was not accidental.
At this point, the 34-year-old system programmer Brendan Eich debut. In April 1995, Netscape hired him.
The main direction and interest of Brendan Eich is functional programming, and the purpose of Netscape recruiting is to study the possibility of the scheme language as a scripting language for Web pages. Brendan Eich I think so, that after entering the new company, will mainly deal with scheme language.
Just one months later, in May 1995, Netscape made the decision that the future Web scripting language must "look like Java enough", but simpler than Java, making it easy for non-professional web authors to get started. This decision actually excludes Perl, Python, TCL, scheme, and other non-object-oriented programming languages.
Brendan Eich was designated as the designer of this "simplified Java language".
However, he has no interest in Java. In order to meet the company's assigned tasks, he designed the JavaScript in just 10 days.
Because the design time is too short, some of the language details are not sufficiently rigorous, resulting in a long period of time, JavaScript written out of the program chaotic. If Brendan Eich foresee that the future of this language will become the first language of the Internet, there are millions of of learners around the world, will he spend a little more time?
On the whole, his design idea is this:
(1) Learn the basic grammar of C language;
(2) Learn the Java language data type and memory management;
(3) using the scheme language to promote the function to the status of "first Class citizen";
(4) using the Self language, use the inheritance mechanism based on prototype (prototype).
So, the JavaScript language is actually a mixture of two language styles----(Simplified) functional programming + (Simplified) object-oriented programming. This is determined by Brendan Eich (functional programming) and Netscape (object-oriented programming).
Years later, Brendan Eich still despised Java.
He said:
The effect of Java (on JavaScript) is primarily to divide data into basic types (primitive) and object types (objects), such as strings and string objects, and introduce Y2K problems. That's unfortunate. "
It is advisable to wrap the basic data type as an object. The Y2K problem is directly related to Java. It is assumed that date.getyear () should return the last two bits of the year:
var date1 = new Date (1999,0,1);
var year1 = Date1.getyear ();
alert (YEAR1); 99
But in fact, for 2000, it returned 100!
var date2 = new Date (2000,0,1);
var year2 = Date2.getyear ();
alert (YEAR2); 100
If you use this function to generate the year, some pages may have a result of "19100". This problem comes entirely from Java, because JavaScript's date class directly uses the Java.util.Date function library. Brendan Eich was obviously dissatisfied with the result, which led to the subsequent addition of a date.getfullyear () function that returned a four-digit year.
If it weren't for the company's decision, Brendan Eich would never have Java as a prototype for JavaScript design. As a designer, he did not like his work at all:
"I hate it more than I love JavaScript," he said. It is the product of the C and self language one-night stands. The 18th century British writer Dr. Johnson said well: ' Its excellence is not original, its originality is not excellent. ' (the part of is good are not original, and the "and the" are original are not good.) "
JS at least compatible with the previous syntax, will not appear ES3 code to ES6 can not run the situation, this py do get it Brython
http://www. brython.info/
So you can use it on the front end
Python3syntax, you can use ' import ' to load modules, you can use iterators, and so on
GitHub Address: Github-brython-dev/brython:brython (Browser python) is a implementation of Python 3 running in the Browser
I have been concerned about this project more than a year ago, but it was not very useful at that time, how to develop the unknown, but his bottom is still the Python3 into JS run ( because browsers can't run Python directlyDo not discuss other, Python this forced line indentation of the language, even uglify can not do ...
In other words I use a angular also need to under 1MB source ...
If the project uses a variety of third-party libraries, loading speed is too beautiful to think/w\ if JS early in the feature not from Java, and is a clean, C-style scheme, then we do not need to py the world's best language is JavaScript