For as long as Ruby on Rails has existed, Rails developers have tried not to write JavaScript. They even embraced a subset of it, called CoffeeScript. It would let you write JavaScript that looked more like Ruby. But today, JavaScript has improved a fair bit. Yes, it is still more verbose than Ruby, but if you can see beyond the excess of characters, you will find a language that can be almost as expressive as Ruby.
A language that, if you want to write modern web- and SaaS-applications, you cannot do without. In this book I want to show useful features, explain some of the quirks and present some modern and readable syntax.
This pragmatic book is short (~31,000 words). You should be able to read it in several hours. My aim is not to cover every feature or utility available in JavaScript, but to show you how to write elegant code with JavaScript. It is set up to build a code editor using CodeMirror (https://codemirror.net/) within a Stimulus controller. This book is written as a journey from start to finish, with each chapter introducing new features and explaining new JavaScript techniques and syntax discovered along the way. Not another JavaScript documentation rewrite without any practical context.
Who am I to write this book? I am a designer, turned developer, turned founder of multiple successful SaaS apps built in Ruby on Rails for more than 10 years (and I've been designing for the web since 1997). I have also helped numerous teams around the world with their Ruby on Rails apps with loads of JavaScript. In early 2024, I founded Rails Designer (railsdesiger.com): a Rails UI components library, a one-man agency, a product studio, and a vessel for hundreds of articles around modern Rails and front-end development.
I hope that in several hours, when you finish this book, you will get the same joy that I do writing JavaScript for your Rails app.
If you find you are stuck or something is unclear, feel free to reach out at: jsbook@railsdesiger.com.