<h3>Open the console to see the output from this code</h3>
<p>There are two exercises in this practice set</p>
<ol>
http://jsfiddle.net/lakenney/w4pjeesw/#update <li>In the first, you must write the logMessage() function that will make the call on line 6 write the argument to the console. </li>
<li>In the second, you will add input validation to this function so that the test cases work. If you've done it correctly, test cases 1-3 should output a truncated string (or the original, if the "targetLength" value isn't greater than the string length) , while test cases 4 and 5 will output the string "Invalid Input".</li>
</ol>
JavaScript
/*
#1
This code is calling on a function logMessage(), that should accpet a single parameter, and write that parameter to the console. No input validation is required - just echo the parameter to the console. Write the logMessage() function so that this code works.
*/
var name = "Ellen Ripley";
logMessage("My name is "+ name);
function logMessage(name) {
}
console.log(logMessage);
Please Whitelist JSFiddle in your content blocker.
Help keep JSFiddle free for always by one of two ways:
Whitelist JSFiddle in your content blocker (two clicks)
Go PRO and get access to additional PRO features →
Join the 4+ million users, and keep the JSFiddle dream alive.
Ad-free
All ads in the editor and listing pages are turned completely off.
Use pre-released features
You get to try and use features (like the Palette Color Generator) months before everyone else.
Fiddle collections
Sort and categorize your Fiddles into multiple collections.
Private collections and fiddles
You can make as many Private Fiddles, and Private Collections as you wish!
Console
Debug your Fiddle with a minimal built-in JavaScript console.