Console Logging explainer

Aim of the puzzle: Use console.log() to print output to the console area of the screen.

Walk through of solution: The print() function you have been using is a custom function that will only work in Grasshopper. For the same functionality anywhere you use JavaScript, there is console.log(). The value of anything you pass as an argument will be printed.

Tap the empty space below the console.log() that is already there. Then tap the console button. Next, tap the .log() button to attach it to console. Finally, add any string of text inside the parentheses as an argument. Run the code to see the output of your console.log().

Sample code solution:
(Tap below to reveal)

print('In Grasshopper, the print() function logs strings and numbers to the console window');
console.log('console.log can also log to the console window');
console.log('and also works outside Grasshopper.');

Javascript Concepts: Strings, Console

Grasshopper Concepts: print()

what does the log and console does means ?

console is a global object built in to JavaScript, representing the browser’s debugging console. .log() is a method of this object that prints text to the console.

You can read more about console here.

1 Like

i dont understand at all