In SharePoint 2013 is enriched with the Script Editor web part. The web part makes it very easy to add JavaScripts and Jquery script to your SharePoint 2013 site.
Solution
1. Edit the page where you want to use JavaScript.
2. Add the web part Script Editor.
3. Edit the web part Script Editor.
4. Insert the needed Javascript, in this example the JavaScript will show the current date and time.
5. Save the changes and enjoy the result.
Result