Plugin creation issue

Greetings all,
I am pretty new to the RPG maker community, so hello. I am starting to look into making my own plugin and seem to be possibly missing something. I have gone through almost all of the official tutorial steps.
I am starting with a new project, no plugins and nothing edited. I have created a file myPlugin.js and saved it into the plugins directory. I was starting to follow Write a Plugin that reads Notetags - Beginner
Spoiler: file contents
(function () {
console.log('loaded plugin...')
// Retain a reference to the original function
const Game_Actor_setup = Game_Actor.prototype.setup;
Game_Actor.prototype.setup = (actorId) => {
// Call the original function
Game_Actor_setup.call(this, actorId)
this.race = $dataActors[actorId].meta.race || null;​
}​
})();

But when I try to start the game I get this:
upload_2019-1-21_20-22-50.png


and in the console:
Spoiler: console
rpg_managers.js:1949 TypeError: this.initImages is not a function
at Game_Actor.setup (rpg_objects.js:3440)
at Game_Actor.setup (NameTag.js:7)
at Game_Actor.initialize (rpg_objects.js:3408)
at new Game_Actor (rpg_objects.js:3393)
at Game_Actors.actor (rpg_objects.js:4587)
at Game_Party.<anonymous> (rpg_objects.js:4871)
at Array.forEach (<anonymous>)
at Game_Party.setupStartingMembers (rpg_objects.js:4870)
at Function.DataManager.setupNewGame (rpg_managers.js:219)
at Scene_Boot.start (rpg_scenes.js:402)

I looked at rpg_objects.js at 3440 and see the call but am not sure why/how I am affecting that.

Thanks all for your time and help.
The line

Game_Actor.prototype.setup = (actorId) => {

should be

Game_Actor.prototype.setup = function(actorId) {

You must have mistyped it or your text editor got the best of you.
Thank you ChampX, that doesn't bomb. I thought we could use ES6 features in RMMV though?
I don't think you can use all ES6 features and the ones you can use will depend on the version of MV you have installed. Javascript, however, isn't my primary language by a long shot, so I can't be 100% sure on that.
You can use ES6 in MV 1.6.0 and 1.6.1. However, what you wrote was just incorrect syntax. You can't use prototypes with arrow functions.
In ES6, an arrow function preserves context. It allows you to pass instances of "this" into functions without having to .bind, .call, or .apply.

So, when you declare
Code:
Game_Actor.prototype.setup = (actorId) => {

"this" is no longer going to refer to the instance of Game_Actor, because you've preserved the outer context of "this" - which, in this case, is the context of the IIFE you've defined, which is going to be the window object that most browsers have.

Code:
const boundFunction = function(actorId) {
  console.log(this);
}.bind(this);

// This will do the same thing as the above function,
// because the arrow function implicitly passes the
// "this" context that .bind(this) does in the above one
const arrowFunction = actorId => {
  console.log(this);
};

You can't use prototypes with arrow functions.

To expand on this - it's not that you can't, per se, there's just not really a reason to, because the biggest benefit of prototype methods is being able to reference "this" as the instance of the original constructor.
Ya know I knew those ideas but didn't place them together in context. Also new to RMMV so, Thank you both Poryg and Zevia.

Original thread: https://forums.rpgmakerweb.com/threads/plugin-creation-issue.104742/