views:

168

answers:

5

Hello, I started learning JavaScript a while ago. It's a fairly easy programming language considering that I learned Java in university, that I know php pretty well and that I already played around with python and ruby. The problem is that to properly learn a programming language I usually create a project. In javascript, I just don't know what kind of project I could create - that is, a project that is not web-based or related to the web browser. Can I create javascript shell scripts? Where is javascript commonly used beside the web browsers?

So, can someone actually give me some ideas please?

+4  A: 

windows Sidebar Gadgets, Apple's Widgets, and Google Desktop Gadgets are all created using HTML/ JS/ CSS.

I learnt Javascript by creating a few small Windows Sidebar Gadgets.

Getting Started

Sidebar Reference

Matt
A: 

Common uses of javascript outside of browsers are WSH scripts and HTA applications on Windows and Dashboard widgets on Mac.

stereofrog
+5  A: 
T.J. Crowder
@T.J. Crowder This all sounds very nice, but how on earth can javascript execute shell command lets say "uptime" in *nix, with what will you execute it? if you have php file you can execute it with `php file.php` , how do you execute javascript? `javascript file.js` ? I think you can't or perhaps I don't know how
c0mrade
@c0mrade: It depends on what interpreter you're using to make it happen. For instance, on Windows, you can use the various WSH objects to do that. If using Rhino, you'd use the `java.lang.Process` or similar. I'm sure `jsc` provides functionality along these lines. You're confusing *language* with *runtime environment*. :-)
T.J. Crowder
yea totally, tnx for the explanation though
c0mrade
@c0mrade: Actually, sorry, I think I misunderstood your question. You can run a JavaScript files as a shell script on Windows in the way I explain in my answer. On *nix, the usual thing would be to set up an interpreter (for instance, it could be `/bin/javascript` if you like) and then use `#!/bin/javascript` at the top of the script to tell the command interpreter what to run it with (this is just like with python and others). That would refer to `jsc` (probably) on a Mac, could refer to Rhino on Linux, or something else. There are lots of JavaScript interpreter projects out there. :-)
T.J. Crowder
A: 

You could write a non-blocking TCP server. Node.js supports that.

Ivo Danihelka
+1  A: 

You could use javascript to make HTA (HTML Applications) that can be run outside of the the web browser sandbox.
MSDN intro to HTA Applications
Javascript Tutorial on HTML Applications

Terrance
Older technologies I know but still can be fun none the less.
Terrance