O'Reilly logo

A Beginner’s Guide to Writing Minecraft Plugins in JavaScript by Walter Higgins

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Appendix E. Function Declarations vs. Function Expressions

In JavaScript the two most common ways to define functions are by using function declarations and function expressions. A function declaration looks like this:

function myFunction(){}

...whereas a function expression looks like this:

var myFunction = function(){};

Throughout this book I have defined functions using function declarations rather than function expressions. I’ve done so because:

Image This is a book for beginners. Wherever there are two or more possible approaches to doing something in JavaScript, I’ve endeavored to present only the simplest approach so that beginners are not overwhelmed ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required