Check out this series (unit on JS):

    http://www.w3schools.com/js/default.asp

I've played around with some of their other tutorials, and was fairly
impressed, though I'd like to go a bit deeper. Nice thing about the
tutorials is they are hands on and live. Type in a CSS or HTML (or JS)
expression, and it's evaluated right there.

Let me know what you think.

--Don Ellis



On Thu, Mar 26, 2009 at 1:54 PM, Robert Citek <[email protected]>wrote:

>
> Can anyone recommend a good tutorial for using JavaScript at the command
> line?
>
> Most JavaScript (JS) tutorials are written for using JS within a
> browser.  But JS can also be used from the command line if you install
> the stand-alone JS interpreter Spidermonkey:
>
> $ sudo apt-get install spidermonkey-bin
>
> The canonical simple example:
>
> $ js -e 'print("Hello, world") ;'
> Hello, world
>
> And a simple line numbering loop:
>
> $ yes "Hello, world" | head | js -e 'var count=0 ; while
> (line=readline()) { count++ ; print(count, ": ", line) ; } '
> 1 :  Hello, world
> 2 :  Hello, world
> 3 :  Hello, world
> 4 :  Hello, world
> 5 :  Hello, world
> 6 :  Hello, world
> 7 :  Hello, world
> 8 :  Hello, world
> 9 :  Hello, world
> 10 :  Hello, world
>
> Unfortunately, it took me a bit of digging and guessing to find out
> how to do even those simple examples. For example, the readline()
> function isn't even mentioned in the "Javascript: the Definitive
> Guide" book.  I stumbled upon that by looking at this Mozilla page:
>
> https://developer.mozilla.org/en/Introduction_to_the_JavaScript_shell
>
> What I'm looking for is more in line with this tutorial on awk, a
> series of one- or two-liners that get across the basic functionality
> of the language:
>
> http://www.vectorsite.net/tsawk_1.html#m2
>
> I'm still Googling, but can anyone recommend a good JS or Spidermonkey
> tutorial?
>
> Regards,
> - Robert
>

--~--~---------~--~----~------------~-------~--~----~
Central West End Linux Users Group (via Google Groups)
Main page: http://www.cwelug.org
To post: [email protected]
To subscribe: [email protected]
To unsubscribe: [email protected]
More options: http://groups.google.com/group/cwelug
-~----------~----~----~----~------~----~------~--~---

Reply via email to