Monday, 9 July 2018

ES6 Classes - stuck on "this" (see what i did there?)

https://ift.tt/2NE11Mi haven't used ES6 Classes much and I have been trying to get this code to work for a couple hours now and I can't seem to figure this out. In my above code I have 2 classes (Blockchain and Block) Blockchain accepts a new Block and then is supposed to set a property called "previousHash" on Block (which is the equivalent of the hash on the next block in the chain). However whenever I call my toHash(data) method to create the hash this._previousHash is always undefined. I can't figure out what I am doing wrong....

Submitted July 09, 2018 at 05:24PM by maxwellsmart84

No comments:

Post a Comment