Console.log Party explainer


#1

Aim of the puzzle: Replace the Grasshopper function print() with JavaScript’s built-in console.log() function to print text to the console.
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() statements that are 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:

print('print is a Grasshopper-created function that uses console.log to print to the console window');
console.log('console.log is a built-in JavaScript function used to print text to the console. It can be used outside the Grasshopper app');
console.log('Add a 1 or more console.log statements. You can print anything you like.');

Javascript Concepts: Strings, Console
Grasshopper Concepts: print()