26

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

7
  • 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
    Commented May 9, 2011 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 Py
    Commented May 9, 2011 at 2:20
  • 1
    Theres also spidermonkey which is Mozillas javascriptparser. It's also standalone and can be used in any application.
    – jgauffin
    Commented May 9, 2011 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. Commented Oct 20, 2012 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. Commented Oct 20, 2012 at 3:06

11 Answers 11

22

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.

6

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.

1
  • KDE may support it too since Qt has QtScript but I'm not sure of this.
    – Vitor Py
    Commented May 9, 2011 at 2:22
5

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.

3

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.

2

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.

2

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).

2
  • There's also PowerShell on Windows. Commented Apr 14, 2012 at 0:18
  • PowerShell isn't installed by default with pre-2008/7 versions of windows as far as I know. Commented Apr 16, 2012 at 11:53
2

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.

1

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.

2
  • 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
    Commented May 9, 2011 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
    – Jay
    Commented Aug 27, 2012 at 19:24
1

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.

0
1

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.

1

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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