Where Is My console.log() Result?
Lately I’ve seen a few Meteor beginners who are getting help from someone and
are told to console.log()
something. Usually they have issues finding the
result, because they don’t know where to look.
The result of a console.log()
depends if you are executing it on the client or
server. If you are in the client
folder, the console.log()
result will be
shown in the browser console. If you are executing it from the server
folder,
the result will be shown in the terminal.
If you want the result to appear in your browser console (regardless what folder you are in), wrap the statement in:
if (Meteor.isClient) {
console.log("something");
}
If you want the console.log()
to be returned into your terminal, simply wrap
it with:
if (Meteor.isServer) {
console.log("something");
}
Hope this helps those that are learning Meteor!