Challenge Write Reusable JavaScript with Functions has an issue.
We might want to use something other than console.log for the function example so we don't have to worry about trying to show them how to open developer tools (which depends on their browser).
Developer tools are covered in the video challenges - there's no need to cover them here in the JavaScript section.
I'd be interested in tackling this. Would using an alert (albeit very annoying) be a better idea over the console.log
?
Beginners like me trying the other ways will hate alert sometimes. For example:
var data = {a: 'foo', b: 'bar'};
console.log(data);
alert(data);
You'll see that console.log shows you the object, while alert gives you [object Object], which isn't useful
why don't we just return the output than console.log .. Any particular reason for console.log??
I had a look at this yesterday and my thought was to use alert in the first lesson and switch the order of the lessons so that "Return a Value from a Function Using Return" is the lesson after this. That way, alert only gets used in one lesson (and with a string), they don't have to use console.log, and the return statement will also be explained immediately when introduced.
What about document.write("Heyya, World")
. Would it work?
What about just adding an "as well" to the end of:
/**
* Your output will go here
* Any console.log() -type
* Statements will appear in
* Your browser's DevTools
* JavaScript console
*/
since the results do indeed show up there.
And maybe add a "For more info about DevTools" link to the video challenges?
@QuincyLarson I got this weird idea today.. i am not sure this is possible or not.. we got some empty space at bottom of every challenge.. Maybe we could have a proxy Console the one which works in every browser.. like the one CodePen and Jsbin are having.. CodePen had mentioned in their blog Thanks to JS Bin for some of the code
that they used the code from the open source code... There could be some way or some one could build this.. then we don't have to worry about trying to show them how to open developer tools
@ChaituVR We have thought about that, but we don't want to clutter up the UI. It's tempting to fill up empty space, but it makes things much more complicated for new comers who are like "what's this box down here? So complicated." and then leave.
I agree with @ChadKreutzer that we should update the copy to say "as well."
Regarding @vcooley's suggestion, the intention of the challenge is to introduce the console.log function, which is commonly used in debugging, so I don't know whether alert()
or @darwinrc's suggestion of document.write()
will suffice either.
I think since we are expanding our challenges and creating new quality assurance/testing challenges, we will ultimately get rid of this challenge or introduce the concept of logging in a more comprehensive, proper way. So I will close this issue for now and open a new one for "as well".
Most helpful comment
I had a look at this yesterday and my thought was to use alert in the first lesson and switch the order of the lessons so that "Return a Value from a Function Using Return" is the lesson after this. That way, alert only gets used in one lesson (and with a string), they don't have to use console.log, and the return statement will also be explained immediately when introduced.