Example1
by Taylor Lopez
HTML
<div id="content"></div>
CSS
html, body
{
width: 100%;
height: 100%;
margin: 0;
padding: 0;
/* Background Color */
background-color: black;
}
#content
{
padding: 10px;
font-family:"Lucida Console", "Courier New", "Courier";
/* Console Text Color */
color: #0F0; /* Lime Green */
}
/* console span properties */
.consoleLine
{
}
JavaScript
/* START CONSOLE FUNCTIONALITY -- DON'T TOUCH */
// This function intercepts the console.log() calls and prints the output to the result pane to the right like a standard console instead of the hidden console. Just pretend like this isn't heeeereee. ooooooooooohhh. *spooky*
var _console = document.getElementById("content"); var _body = document.getElementsByTagName("body")[0]; console.log = function (object) { var output = object === undefined ? "" : object.toString(); output = output.replace(/ /g, " "); while (output.search('\n') !== -1) output = output.replace('\n', "<br />"); _console.innerHTML += ("<span class='consoleLine'>" + output + "</span><br />"); window.scrollTo(0, _body.scrollHeight); };
/* END OF CONSOLE FUNCTIONALITY */
/****************************** YOUR CODE START ******************************/
var nameString = function(name) {
return "Hi, I am" + " " + name;
};
console.log(nameString("Nathan"));