So, printing can be easy or hard. You can print anything – that’s why you see so many examples of it in this list. But before we talk about printing, we need to talk about the print function. The print function takes a string and prints it.
So let’s start with this string “Hello World!”. If you call print(“Hello World!”) it will print it on the screen – as expected. So what if we want to do something different? Let’s say we want to print a string that’s a bit too long to fit into the screen. Or, let’s say we want to print a string that’s just a bit too small to fit into the screen.
The solution for this is to create a file called HelloWorld.js which contains the text of the string. Then we can go to to write it. We’ll add the text and its content in a few lines and then we’ll load the HelloWorld.js file into the browser.
I’ve got a few more tricks I’ll share in the coming days.