Closed michael0793 closed 1 year ago
the block isn't a constructor. add a constructor
How do I add a constructor?
Here's an example from the code:
class Transaction {
constructor(fromAddress, toAddress, amount) {
this.fromAddress = fromAddress;
this.toAddress = toAddress;
this.amount = amount;
}
I get this error any fix?
TypeError: Block is not a constructor at Blockchain.createGenesisBlock (C:\Users\PC\Desktop\BLOCKCHAIN\blockchain.js:10:16) at new Blockchain (C:\Users\PC\Desktop\BLOCKCHAIN\blockchain.js:5:28) at Object. (C:\Users\PC\Desktop\BLOCKCHAIN\blockchain.js:27:19)
at Module._compile (node:internal/modules/cjs/loader:1108:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1137:10) at Module.load (node:internal/modules/cjs/loader:973:32) at Function.Module._load (node:internal/modules/cjs/loader:813:14) at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:76:12) at node:internal/main/run_main_module:17:47 PS C:\Users\PC\Desktop\BLOCKCHAIN>