SavjeeCoin
SavjeeCoin copied to clipboard
TypeError: Block is not a constructor
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.
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>
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;
}