JavaScript Pros: (Counter to JavaScriptSucks)
JavaScript is a great language, supports OO, Prototypical, Functional, and Procedural paradigms. To the best of my knowledge, on the power/availability scale, nothing can touch it. Most of the power of Lisp, with C's syntax and widely available and accepted, unlike Lisp and SmallTalk, most of us are actually allowed to use JavaScript. First class functions, lexical closures, automatic delegation, dynamic typing, prototype based, just about every feature you'd have in your wishlist. Hell, you should be thankful such a flexible language is available in nearly every browser, and natively in the Windows shell (really? or just through WindowsScriptingHost?), you could be stuck with VBScript.
The RhinoInterpreter from Mozilla comes with a shell out of the box. Scripts have access to the entire java platform, so this shell can do anything you want it to.
Many people who think JavaScriptSucks, don't know JavaScript well enough, or are really complaining about BrowserDomSucks? and wrongly blaming JavaScript.
In situations where users were migrating from local excel sheets to an html based interface that stored the data on a server, I found JavaScript very helpful. They wanted for instance to enter tabular data and scroll up and down with the headers and side column fixed similar to how they had it in excel ("freeze panes") the only way to do that was with scripting. You could use VBScript but given the server-side code was C and Java, JavaScript was more similar (and some users had Netscape). There was no way to avoid being "visually quite as fancy" since the UI had to be in HTML, and they would have rejected it if the look and feel was not as dynamic as excel. JavaScript gives a lot of options. I agree keep as much code server side as possible but to make "ergonomic" user interfaces, JavaScriptRocks.
JavaScriptSucks expresses the opposing view.
I agree that mostly JavaScriptRocks, but it has a couple of warts:
function foo(arg1, arg2, arg3) { arguments.unshift('blah'); alert('arg1='+arg1+',arg2='+arg2+',arg3='+arg3); } foo('arg1','arg2');to alert "arg1=blah,arg2=arg1,arg3=arg2"?
Yes, it rocks! If you think otherwise, you never saw GreaseMonkey in action!
--OsiasJota?
It's not quite prototypical, but doesn't exaclty have classes either. Some would call that a problem, but I think that it's elegant. There are no classes, only functions which happen to make objects. new Something() is a wart, but other than that, I like it. Just tell me if this works:
function Accumulator(a) { this.a = a } Accumulator.prototype = { add : function (b) {this.a += b}, sub : function (b) {this.a -= b}, get : function () {return this.a} } var acc = new Accumulator(0) acc.add(10) acc.mul = function (c) {this.a *= c} acc.mul(10) alert(acc.get()) // Should be 100.This does indeed work!