Run and display code as text without repeating
<p>I want to store javascript code in an object, and then run parts of it when the user clicks a button. So far I have this:</p>

<pre><code>var exampleCode = {
    test: "$('body').css('background: pink');"
}
$(document).ready(function(){
    console.log(exampleCode.test);
    exampleCode.test;
});
</code></pre>

<p>I have two questions, the first is, how to I get the code to actually run?</p>

<p>The second is, what do I do if I want to have some html in my javascript, say like the following line of code:</p>

<pre><code>$('body').append('&lt;div class="whatever"&gt;&lt;/div&gt;');
</code></pre>

<p>This wont play well with the double quotes around the object value.</p>

<p>My goal with all of this is to be able to both run and display code as text on the same page without having the code written twice, so if you have other suggestions, that would be great.</p>
