Open the WebInspector, press 'console' in the upper right corner, alternatively the lower left corner with the '>' symbol for a split view.
For a demo on this page try this:
Code:
$('body').css('background-color', 'red')
Edit: Also from Apple's documentation,
"The console offers a way to inspect and debug your webpages. Think of it as the Terminal of your web content. The console has access to the DOM and JavaScript of the open page. Use the console as a tool to modify your web content via interactive commands and as a teaching aid to expand your knowledge of JavaScript."