To set the indent width when editing Javascript files in Emacs, set the variable js-indent-level to the desired width. This can be done by calling setq in the init file, but these days I just invoke the describe variable function by C-h v, then customize the variable there, this also sets the variable in the init file.
- C-h v
- js-indent-level [Enter]
- Focus on the customize link and hit enter
- Chang the indent value in the customize page
- Focus on the Apply and Save button and hit enter