What is wrong with JavaScript?

time to read 13 min | 2499 words

Stefan asks What Is Wrong With Javascript, I think that I've at least a partial answer to that. Here are my reasons:

  • Until very recently, Javascript was just too slow by far to consider writing applications with it.
  • Lack of a rich class library.
  • Until recently, lack of good debugging tools.
  • The browser is a really sucky place to develop in.
  • The impression of being a Toy Languague.
  • Lack of strong typing, this bytes me so often that I feel like screaming. I missed a semi column, or misspelled a varaible... go figure when/where this is going to blow (usually silently).
  • The browser is not a nice place to work with.
  • Easily modificable by the users.
  • Easily disabled by the users.
  • While the langauge is mostly standartize, there were (and are) problems with the environments that you work with, which makes life painful.
  • No typing is annoying to me.
  • Did I mention that the browser is not an application platform?

Maybe I'm bitter, but I'm butting my head against the wall in a relatively simple JavaScript problem for a couple of days now, and this is not a new feeling. Everytime that I need to do something with Javascript I approach it with disdain, not because the langauge is bad, I actually enjoy a lot of the things that I can do with Javascript. I don't like it because I know that I'm going to spend quite a few hours chasing stupid stuff all over the place.

For instance, take the most recent puzzle, creating input controls dynamically and sending them to the server:

<script language="javascript" type="text/javascript">

function addUser()


    var users = document.getElementById('users');

    var hidden = document.createElement('input');

    hidden.value = 'foo';


    var i =0;

    for(var node = users.firstChild;node !=null; node = node.nextSibling)


        if(node.nodeType != 1) //input


            node.id = 'project.Users['+i+'].Id';





And the HTML:

<form id="form1" runat="server">

    <div id="users">

        <input id="Button1" type="button" value="Add User" onclick="javascript:addUser();" />


    <asp:TextBox ID="PostBackValues" runat="server" Height="225px" TextMode="MultiLine" Width="596px"></asp:TextBox><br />

    <asp:Button ID="submit" runat="server" Text="submit" OnClick="submit_Click" /><br />


Now, pressing the add users cause a nice text input to be added to the page, I then hit sumbit, and watch the result from this code-behind:

protected void submit_Click(object sender, EventArgs e)


    foreach (string key in Request.Params.AllKeys)


        PostBackValues.Text += string.Format(" {0}: {1}\r\n", key, Request.Params[key]);



I don't see the values I just put in. Even more important, I can't see them in the request stream when I'm using Fiddler to check this. What happened to them, I don't know, and all my debugging turned out blank. I know that there is a two line fix for this, and probably a reasonable explanation, but getting to this point wasn't a fun process, and hitting a wall like that isn't uncommon for me when using Javascript. I had similar problems doing some smart UI with tables & colors in Javascript, especially since I wanted to do this on both IE and Firefox.