Step 1: Add this in your DOCUMENT_ROOT/.htaccess
file:
# Append file to bottom of page
php_value auto_append_file "includes/footer.php"
Step 2: Create DOCUMENT_ROOT/includes/footer.php with this content
<script>
document.writeln('Its from javascript in footer');
// put any JS code here
</script>