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.

I heard Javascript is a full language just like c++. Is this true? What else is it good for programming besides web stuff?

share|improve this question
    
really it's only good for webstuffs, because it requires some form of parser, most of which are only built into web browsers. I mean, you could build your own JS parser for desktop use, but than it wouldn't use most of javascript, which interacts with the html on your page... –  dkuntz2 May 9 '11 at 2:11
3  
@DKuntz2 I think Chrome V8 JS Engine is a independent library and you could reuse it in a desktop application. You would still have to develop your own API. Link: code.google.com/apis/v8/embed.html –  Vitor May 9 '11 at 2:20
1  
Theres also spidermonkey which is Mozillas javascriptparser. It's also standalone and can be used in any application. –  jgauffin May 9 '11 at 10:46
    
@dkuntz2 Javascript isn't just good for "web stuff" - I use node.js as a general purpose scripting tool, and for developing desktop applications. –  Anderson Green Oct 20 '12 at 3:04
    
@VitorBraga I think developing applications with node.js would be one good option - it has a comprehensive set of libraries that are useful for general-purpose scripting tasks such as image editing and file reading/writing. –  Anderson Green Oct 20 '12 at 3:06

11 Answers 11

up vote 23 down vote accepted

I think it's worth learning because it's quite different to your run-of-the-mill OO language and at the very least you'll learn a different programming paradigm.

Can it be useful anywhere other than in-browser? Sure: check out node.js, which uses javascript's asyncronicity to create a purely non-blocking dev platform, and couchapps, which lets you build an entire web app with it.

If you believe some people, javascript will be the major future dev language, purely because of its wide usage. It's by far the most popular language on github, and almost every dev has some exposure to it. With projects like node.js, javascript has an interesting future.

share|improve this answer

As far as I know, besides web programming, JavaScript is also used for some new desktop environment too. For example, GNOME 3 (a desktop environment for Linux) using JavaScript+CSS to let users and developers customize their desktop environment.

share|improve this answer
    
KDE may support it too since Qt has QtScript but I'm not sure of this. –  Vitor May 9 '11 at 2:22

While Javascript is a full language syntactically,object oriented, etc., it does mostly lack libraries to interface with stuff not already built in. It is well purposed for accessing and modifying XML data, for example, but doesn't really provide many interfaces to hardware.

This question on Stack Overflow addresses some examples of where it is and can be used outside web programming.

share|improve this answer

I'd say that a language with dynamic and functional capabilities is worth learning, but it needn't necessarily be Javascript.

LISP is takes the above concepts much farther than Javascript, and is thus considered an excellent language to learn, even if you never need to use LISP itself.

share|improve this answer

It is not worth learning beyond the basics.

Even if you work in web applications, but in the backend, devote your learning resources in subjects more related to your field. Javascript is just another language with no special message that will enrich you significantly.

share|improve this answer
2  
I disagree. It is the only widespread prototype-based language. Moreover, among widespread languages, it has one of the best support for closures. So one can learn something valuable using it. Finally, it is blazingly fast for an interpreted language. –  Andrea May 9 '11 at 13:32
    
@Llistes_Sugra If you seriously hold and believe that opinion, you don't know enough about JavaScript. I'd recommend that you learn more about it and see if you want to revise this opinion; I'm almost certain that you will –  Jayraj Aug 27 '12 at 19:24

Javascript is also used for Greasemonkey scripts that you can use to customize or add functionality to sites you visit. (That link points to the Firefox extension, but it's also available for other browsers)

Technically of course this is still "web stuff", but it's different in that the web developers aren't the (only) ones using it.

share|improve this answer

JavaScript can be used for "out of the box" shell scripting on both windows and mac:

In my opinion, on Windows it's the most palatable choice, because the alternatives are VBScript and BAT files (at least if you can't rely on additional installs).

share|improve this answer
    
There's also PowerShell on Windows. –  JBRWilkinson Apr 14 '12 at 0:18
    
PowerShell isn't installed by default with pre-2008/7 versions of windows as far as I know. –  Joeri Sebrechts Apr 16 '12 at 11:53

There are other technologies based on Javascript that you could learn instead if you want. Learning them would at least let you understand the syntax of javascript when you run across it reading source code for web pages. And lets admit it, we all say we're not going to ever do X, but in the end at some point we always do. At least a little bit.

A good javascript-like language to check out is Qt's new QML language, which is javascirpt like syntax but for a normal application GUI. It's very interesting to play with, and you'll learn some javascript in the process of not-writing-web-pages.

share|improve this answer
    
+1 for mentioning QML –  Simone Aug 29 '13 at 6:56

I was going to add this as a comment to the accepted answer but then realized it might be better served as a separate answer. That said, it is meant more as a complement to the accepted answer rather than a competing answer.

Scripting extension

There are many Javascript engine available for most of the big languages that you can embed in a system. This makes it a good choice for extending your platform with scripting capabilities and beats hands down inventing your own language. You instantly gain all the learning material so getting resources to configure and script your system will be a lot easier.

share|improve this answer

Creating Metro style app using JavaScript would be using JavaScript for Windows 8 that may be interesting to see where this goes. Just another idea to add to the other answers here.

share|improve this answer

Javascript is a great foundation language

It is :

  • powerful
  • easy to learn
  • supports both procedural and object-oriented paradigms
  • is quick to write and get running
  • popularised many modern language concepts - closures, anonymous functions, asynchronous/event-driven programming, dynamic types/inference
  • has great tools ( editors, runtimes, lint tools, browsers)
  • has amazing online support with lots of active communities
  • can do maths functions
  • has graphics abilities (via HTML/Canvas)
  • can use it to write Apps

I personally believe it is worth learning even if you won't use it daily. It will broaden your mind such that you consider different solutions when using other languages like C++ or C# - e.g. Iteration versus Algorithmic solution, dynamic typing and type inference.

I have seen people use it to crunch numbers/data dumps faster than professional tools, by pasting their data into an HTML text area of a page they'd constructed with some JS code behind to work through the data.

What else is it good for?

Embedding inside something else:

All of the companies I've worked for in the last 12 years have built both commercial products and internal development tools that used JavaScript (or close relative - ECMAScript, ActionScript, etc) as the foundation as it was easy to learn, had easily-integrated (free) implementations ready to go (SpiderMonkey and Microsoft Active Scripting SDK) and performance was 'good enough' to begin with and has just kept on getting better.

Before jQuery/Prototype and the whole AJAX movement came along, the choice of JS seemed non-obvious - why not use VBA (shudder), something lex+yacc-able or roll your own language? The power of JS as a language combined with rich widgets/frameworks meant not a whole lot of code needed to be written, so an off-the-shelf solution was attractive as more effort could be spent on the rest of the product.

As the language has increased in capability and speed, the bet on JS has paid off. With more developers able to grok JS, hiring is easier too.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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