Lua is a nicer language, but the sheer number of developers who are familiar with JavaScript gives it a huge edge. I suspect that's the driving reason.
On the other hand, Lua is much easier to embed into programs. And it is used a lot in games. If I remember correctly, Redis is also using Lua for scripting.