about the shortcomings of JavaScript
for a long time. The most annoying thing in development is Javascript code. So today I am going to talk about the shortcomings of Javascript.
Let’s talk about some basic issues first.
1: Low compatibility
. There are many browsers on the WWW, such as Netscape Navigator, Mosaic and HotJava, etc., but each browser supports JavaScript to a different extent. Browsers that support JavaScript and those that do not fully support JavaScript need to browse a browser with When using JavaScript scripts on the home page, there will be a certain gap in the effect, and sometimes it may not even be displayed.
As a result, JavaScript developers often need to develop different versions for different browsers. The workload has increased virtually, and it is basically all repetitive work. This is what we don't want to see
2: Cause memory leak
JavaScript is a memory management language. This means that JavaScript has built-in packet collection capabilities, so it can extract variables that are no longer used by reference paths and reallocate the memory used by these variables.
This is fine as a basic working principle, but because of these circular references when model objects and view elements reference each other, you can't rely on this feature to optimize your memory usage. In principle, if the object is zero, the element is zero, but if there are backward references from elements to objects, the packet collector will not touch these objects.
Now, the problem arises: in the file object model, any DOM node in the file tree may be referenced by other elements in the tree, regardless of whether it is referenced by other objects! Therefore, any object marked in the packet collector that is referenced backward by a DOM node must be empty in this direction, otherwise its memory will remain in the allocated state. In fact, programmers often ignore this. This is why the memory of many large-scale web games increases rapidly after being opened.
3: There is no support for streaming media
. You can only use the method of embedding other players.
The original design goal of Javascript is to "make web pages move." This has been achieved, and there have been some breakthroughs. However, "move" is just "move", which is not enough. When Javascript faces Rich Application, it is somewhat powerless.
Now, if you want to discuss the development of javascript, you should not be limited to Javascript, but should consider HTML (DHTML), DOM, Javascript, and CSS jointly. Think about it from the perspective of a browser application (forgive me for inventing the word "browser application").