Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialSteven Walters
10,573 PointsAnybody else make a function for console.log?
I got sick of typing console.log(); so I made a function for it.
var cl = function(string) {
console.log(string);
};
Then I can type
cl(); and be done with it.
--StevenKW
1 Answer
Ken Alger
Treehouse TeacherSteven;
Great thought! Just be aware that as time progresses or as you get involved with team coding projects that others may not know what cl()
does so make sure to comment and document your code well.
Ken
Steven Walters
10,573 PointsSteven Walters
10,573 PointsMaybe I should name the function consoleLog :)
I also need to add a way to accept multiple variables.
Is there a better way to alias a JavaScript keyword?
var cl = console.log.bind( console );
seems to work.
Anyway I'm just messing around.
Thanks! --StevenKW