Javascript is used only in XPages development.
You can use javascript in many places, for example in forms and in fields, even in cleinet applications. I use javascript in all my phone number fields to automatically reformat the number entered when the user leave the field. Simply put javascript in the onBlur event. You can even use different javascript for client and web access.