From the ArcGIS.com website and with a subscription, you can take a shapefile or CSV and create a feature serivce from the data. At the present time, the only way to create a hosted tiled map service is to publish it from ArcGIS Desktop. What functionlality is the JavaScript sample doing? There are some differences between hosted map services and map services published to ArcGIS Server. ArcGIS Server map services have a "dynamic" mapping capability where images are generated on the fly, and also they support queries against the data. Hosted map services don't support queries, because they consist of just the tiles. However, if you've created a hosted feature service along with the hosted tiled map service, then the feature service can support queries.
Thanks,
Mike