Hi Jose,
ArcGIS Online gives you a lot of features without even having to write any code. You can put together maps using a variety of services and share them with others. You can even consume services in ArcGIS Online maps from your own ArcGIS server.
You'd want to host your own application (javascript or otherwise) when you have requirements that ArcGIS doesn't meet. For example, we're building a custom javascript application to manage our Department of Natural Resources data and it integrates geolocation information from our ArcGIS server services. That's pretty custom. We also find ourselves extending ESRI templates to do new and different things, which means we need to customize and host ourselves.
So ArcGIS Online can get you pretty far and unless your requirements extend beyond its capabilities, it is a great choice. But when you need custom code, you need custom code. 🙂
I hope that helps somewhat. Best wishes!
ken.