Well, you need to use javascript if you want it to run in a browser. So
that's one reason to pick it, and the main reason people pick it for
it's most popular uses.
It will be very difficult to get javascript running in a browser to do
what you just said though. Not sure if you were running your js in an
arbitrary client's browser, or server-side.
You _can_ run javascript server-side, but it requires setting up a JS
interpreter of some kind, etc., and most people don't do it just for the
heck of it, they do it because they have some specific reason to want
javascript for that. They want to be on the cutting edge trying out
crazy new things, they just love javascript, they particularly want the
non-blocking functionality of the node.js server, they need to interact
with other libraries of functions already written in js, they have some
crazy plan to share code between server-side and client-side, etc.
So, yeah, I think you were on the right track, I'm not sure why you were
trying to do that in javascript either!
|