Why do people say that JavaScript is a bad language?
ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Why do people say that JavaScript is a bad language?
So, what do you think, why do people say that JavaScript is a terrible language? In what other language can you make a web-app that converts arithmetic expressions to i486-compatible assembly in just 700 lines of code?
http;//flatassembler.000webhostapp.com/compiler.html
I am not a professional programmer, and, right now, JavaScript is the only language I am able to do that in.
Last edited by astrogeek; 11-30-2018 at 01:40 PM.
Reason: link moderated
if javascript can do that other languages will be able to do that too (probably even better).
I never told you JavaScript is terrible and I only think you need to be familiar with other languages, like C, perl, python, ruby ... to know the answer.
If you feel like advertising your software, just do that without beating around the bush.
I am not advertising what I've made, I am using it to make a point. I was trying to learn C++ for five years. After five years, the most complicated thing I was able to do was a tetrahedron rotating around its axis and casting a shadow in OpenGL. So pathetic. Then I tried to learn some Java. But it had so many features that appeared to serve no other purpose but to confuse the beginners. I gave up after a few weeks. I thought that maybe I just wasn't born for programming. But then I decided to take up some JavaScript. And, after just three weeks of learning, I was able to make a PacMan game playable on my smartphone. Then, after six months of learning JavaScript, I was able to make that web-app.
Quote:
There is a function called "toLisp" in there.
Yes, that function converts the AST to an S-expression (the way arithmetic expressions are written in LISP). S-expressions are useful in that they are human-readable representations of the parser's output.
Quote:
Beware of some low level javascript functions used in malicious code.
There is nothing low-level there, it's just some (relatively) complicated string manipulation and array manipulation.
Ah, but you can easily find people saying C++ and Java are bad languages too. In fact, you can find that for just about any language.
And I think I can understand them. But I don't understand people who claim that C++ or Java are better than JavaScript.
In C++, for example, you need to write 150 lines just to get a white triangle on a black background. So discouraging. In Java, although you can easily create a GUI using WYSIWYG tools, to make the GUI apps actually work, you need to, well, deeply understand the internals, and that's also quite a bit discouraging.
In HTML5, when you run your program, you already have the graphic window opened, and adding a button is a one-liner. It's so easy that a WYSIWYG tool would hardly help.
Although the programming languages Java and C++ claim to be portable, it's really hard to make a GUI C++ or Java program to run on both PC and Mac. The GUI Java programs that I've made to run on my Mac failed with some weird error messages when run on a Windows PC. And although C++ has a standard API for accessing files, a CLI program that correctly manipulates files on a Mac usually doesn't work when compiled on a PC.
In JavaScript, if you make a PacMan game responding to the mouse clicks on your Mac, chances are, it will work on your smartphone, by the PacMan responding to the tap-gestures, immediately. And even if the device you try to run your JavaScript program on doesn't support all the features your program tries to use, chances are, some features of your program will still be available. JavaScript programs, unlike Java programs (which don't even try to run on older versions of JVM than the one they were compiled for), usually fail gracefully.
It would be a good thing if they were just tools. A hammer is just a tool. So, how long does it take to learn how to use a hammer?
Well, backhoes are "tools" too. And in my neighbor's hands – he's been working with them for thirty years or so – they perform a graceful and fluid dance. (For his and my amusement, he let me sit in the operator's seat one time ... in a great big open area. Yeah, you can imagine. ...) Having worked with programming tools for a comparable amount of time, I can pick up any language or tool ... even one that I've never encountered before ... and quickly be productive with it. I've never "picked favorites" as I tried to pick the best tool for the job. And of course, I'm not bragging or anything – my experience is routine.
Although, talking about JavaScript, I'll freely admit that I thought Flash would be the winner. I never thought that source code would be freely running on the client machine. I see many things that, say, Google is doing with "compiled JavaScript" and wonder to myself ... "but, why?"
But I thought the same thing when I learned that Android runs Java. And in due time I've written Android apps in Java, albeit with a clothespin fitted firmly over my nose. I now watch what Apple is doing with Swift – finally, they seemed to have accepted the fact that "Objective-C sucks" – and I think they're on to something good.
Last edited by sundialsvcs; 04-02-2018 at 07:51 AM.
Although, talking about JavaScript, I'll freely admit that I thought Flash would be the winner.
Well, ActionScript (the programming language internally used in Flash) has the same syntax for string manipulation, array manipulation and similar things as JavaScript, right? Had I done my web-app in ActionScript, it would have taken just as many lines of code to write the algorithm, but I couldn't do the I/O as simply as I can do it in JavaScript.
@FlatAssembler All the stuff you mentioned is high-level stuff for script-kiddies , Can you imagine building a kernel with JavaScript? Sorry but JavaScript sucks for some things, for one you have to run a HUGE(compared to c) interpretation engine(browser, etc) whereas c runs very low-level and fast.
And your wise-crack about the hammer....ever try pulling nails with a ball-peen, shingle or welding hammer? Ever try pounding in a 7in pole-barn spike with a farrier hammer? I have used all the hammers mentioned(+aLotMore) And I can tell you one hammer doesn't do it all and yet all are necessary.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.