Chapter 14. Animal Sounds Revisited

In this chapter, you’ll revisit the Animal Sounds plugin from earlier, but this time, instead of using a switch statement, you’ll use a lookup table.

Objects

It’s time to take a closer look at objects. An object in JavaScript is something that can hold both data and functions. You’ve already been using objects throughout this book. You used the console object to log messages to the Minecraft server log and console window. You used the exports object to provide new properties and functions for others to use. You used array objects to sort arrays with sort(). Last but not least, you used some of Minecraft’s built-in objects such as Player and Event to respond to events that happen in the game.

Objects are useful ...

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.