When I see examples of code on web pages, I sometimes wish I could test them immediately, rather than loading a test page or creating my own test page.
eval (gasp), to let you test code snippets and edit them, inline as it were.
Indeed I feel that this is a legitimate use of
eval, and perhaps a good reason for ensuring that it is retained in the language.
There are three types, with examples below:-
This lets you edit and display HTML snippets.
<p style="margin-left:10px; border:1px solid blue; padding:5px;">Some HTML</p>
This shows a whole web pages using either an
window.open to show the page contents. The latter may not work if you have pop-up blocking switched on.
<html> <body> <p style="margin-left:10px; border:1px solid blue; padding:5px;">Some HTML</p> </body> </html>