Chapter 3. Exploring JavaScript in Minecraft
Once you’ve installed scriptcraft, you can use the js command to evaluate JavaScript code. The js command will try to evaluate any of the text that follows it as JavaScript. You must enter a space between the js and the JavaScript you want to evaluate. The js command will evaluate the JavaScript and print out the result of the expression. So if you type js 2 + 7, the js command will take 2 + 7, will try to evaluate it, and, if it can, will print the result. Let’s practice with a few simple JavaScript expressions.
Basic Math Operations
The expressions you’ve used so far are simple addition operations. JavaScript has a number of mathematical operations. I want you to type each of the following expressions ...
Get A Beginner’s Guide to Writing Minecraft Plugins in JavaScript now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.