Short answer: both. In most cases, it is used for the development of the frontend part of websites or apps. However, you cannot deny the ever-growing amount of frameworks and libraries (e.g., Node.js) that make it more and more viable for back-end development using JavaScript.