Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

JavaScript is an extremely powerful and flexible language and has been used to make some incredible web applications.

As a scripting language it seems very useful and powerful so I would like to know why it is still mainly regarded/implemented as a web language?

I know things like node.js are starting to change this but I'm wondering why it has taken until now for this transition. Are there any reasons why it isn't used in replacement of other scripting languages like Python? Is it lacking anything significant that prevents it from being a true application/system programming language?

share|improve this question
    
It's easier to create C or C++ bindings for Python and Lua than it is to create C or C++ bindings for Javascript, isn't it? That could be factor. –  user16764 Mar 22 '13 at 23:21
    
Sorry I'm not sure I know what you mean. Are you referring to C/C++ applications communicating with Python/JS/etc. ? –  AverageMarcus Mar 22 '13 at 23:25
    
What are you talking about?Plenty of stuff is done with JS offline. For example Windows 8 and gnome apps are in JS. –  Benjamin Gruenbaum Mar 22 '13 at 23:25
    
Windows 8 apps use the Internet Explorer engine to run (as far as im aware). I wasn't aware of Gnome apps using JS. That's something for me to look in to. Thanks :) –  AverageMarcus Mar 22 '13 at 23:26
    
I actually meant to say "It's easier to create Python or Lua bindings for C or C++ code than it is to create Javascript bindings for C or C++ code, isn't it?" –  user16764 Mar 22 '13 at 23:27
add comment

marked as duplicate by Glenn Nelson, Martijn Pieters, Doc Brown, Oleksi, gnat Mar 23 '13 at 5:00

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

3 Answers

One big factor is that JavaScript historically had a single thread execution model. There are lots of use cases (for example processing lots of data) where not having multiple threads would make programming very hard and/or the execution very slow.

Edit. you can use web workers now to do multithreaded JavaScript.

share|improve this answer
    
That is something I hadn't considered. –  AverageMarcus Mar 22 '13 at 23:31
    
On the web, yes it is single-threaded, but that isn't to say you can't do multi-threaded programming with it. There is such as thing as Web Workers which allows you to write multi-threaded Javascript. –  Glenn Nelson Mar 22 '13 at 23:32
1  
Adobe Flex is Javascript with a custom class library. You can write complex desktop apps with it, as many have done. It has a kind of threading. OP: As far as who 'considers' what, ask that at the bar. In the meantime, if you've got an idea for an application and want to program it JS, knock yourself out. Heck, I still write MFC code whenever I can, despite the mockery I get from my C++ friends. –  Jim In Texas Mar 23 '13 at 1:09
add comment

Because Javascript isn't unambiguously better then any of the other scripting languages that we're already using. There are lots of powerful and flexible scripting languages available today. Why should we go to the time and trouble of shifting technology unless it has a clear benefit?

share|improve this answer
2  
How about being able to write front-end code in the same language as my back-end? A unified language is a definite plus. –  Glenn Nelson Mar 22 '13 at 23:32
    
So: "because the other languages were there first"? –  user16764 Mar 22 '13 at 23:39
    
@GlennNelson, but that's particular to the line of work you are in. I (and of course many others) don't have any front end code. Note that I am not saying that JavaScript sucks, I'm saying that in many realms of programming it offers no benefit over say Python. –  Charles E. Grant Mar 22 '13 at 23:40
1  
@user16764, that's not what I'm saying, but of course it certainly plays a role in people's decisions. What I'm saying is: "I have 15,000 lines of Python and C that generates a tab delimited list of numbers. What benefit is JavaScript going to bring me over my existing languages?" After seeing a few dozen scripting languages come and go you get less evangelistic about converting the world to the language you love. –  Charles E. Grant Mar 22 '13 at 23:46
1  
@AverageMarcus, I could equally ask that the world adopt LISP as a first class web front end language because that would allow me to branch out to writing front ends. There is no silver bullet, there is no one language that is the best choice for all branches of programming. There are huge existing codebases, it costs time and treasure and horrible regression bugs to convert them, so no one is going to do that simply for the sake of making life easier for programmers who only want to learn one language. –  Charles E. Grant Mar 22 '13 at 23:58
show 1 more comment

The question is based on a false assumption. Increasingly, JavaScript (and a complete HTML5 stack) is being used as a full application development language.

One public example is the Netflix Playstation3 Application. They use a WebKit port that has JavaScript bindings to allow access from the client application to the hardware. The Application otherwise is a standard web application, though designed to look like device UI.

share|improve this answer
add comment

Not the answer you're looking for? Browse other questions tagged or ask your own question.