Changed namespace to avoid potential naming conflicts (namespaces should be unique, and URLs that belong to you are ideal for this).
Wrapped the script in a function to enable strict mode throughout.
Added support for users with no completed courses, and adjusted the hours output to 2 decimal places.
Removed the alert in favour of adding the information to the element on the page.