Frankly, modern JS is roughly at the same level as PHP as far as language is concerned. What is messy is the variety of frameworks and the quality of some of them. The well-known PHP frameworks are by definition mature and stable. I can't say the same about JS frameworks though. The point is you create code using frameworks, not just the language itself.