In Microsoft CRM 2011, many a times we used had to get the name of the logged in user using client side script. Xrm.Page.context.getUserId() used to give us the guid of the user. But alas as simple as it may sound, getting the user name meant to query the user entity with the guid and then get the user name.
Well long time we wished if Microsoft is listening to our prayers, and indeed it has. We now have the method Xrm.Page.context.getUserName() that servers our purpose.
Hope this helps!