"Write once, run anywhere". This is partly, I think, the same reason why Java skyrocketed to popularity in the mid 90's. It gave hope of transcending the boundaries of the operating system.
Java, of course, failed in delivering on this promise. However, nothing has come as close to delivering this as Javascript has. Write once and your code will work on a mac, windows, linux, iPhone, android, and on.