$page->head_js = rawurldecode($page->theme_path).'/script.js';
is the safest route to go because it will even cope with theme folder names containing spaces and/or special characters.
AFAIK, $addonRelativeCode will only be availabe inside plugin hooks, which may be part of themes, but most themes don't implement such.
Once a theme uses plugin hooks, such as the getHead hook, you can add custom js and css via this hook using $addonRelativeCode.
E.g. Theme Cajón uses advanced techniques in this regard and makes use of several plugin hooks.