Index.js does not compile

@thecil Sir Please Look Into this code.

I get this error: " ‘,’ expected" but adding this semi-colon does not fix this issue.
thanks in advance.

index.js
var web3= new Web3(Web3.givenProvider);

var instance;

var user;

var contractAddress=" 0x3106B3544EaAcA6f41A39935De16752bB2260eE2";

$(document).ready(function(){

window.ethereum.enable().then(function(accounts){

   instance = new web3.eth.Contract(abi, contractAddress, {from: accounts[0]})

   user = accounts[0];

  

   console.log(instance);

   function createKitty(){}

   var dnaStr = getDna();

  instance.methods.createCatGen0(dnaStr).send({}, function(error, txHash){

      if(error)

          console.log(err);

      else{

          console.log(txHash);

          

      }

  })  

   instance.events.Birth().on('data', function(event){

     console.log(event);

     let owner= event.returnValues.owner;

     let kittenId= event.returnValues.kittenId;

     let mumId=event.returnValues.mumId;

     let dadId= event.returnValues.dadId;

     let genes = event.returnValues.genes

     $("#kittyCreation").css("display","block");

     $("#kittyCreation").text("owner:"+ owner

                             +"kittyId:"+ kittenId

                             +"mumId;"+ mumId

                             +"dadId;"+ dadId

                             +"genes;" + genes)                         }

   })

   .on('error',console.error);

})
1 Like

You are missing a ) to close the .on method.

instance.events.Birth().on('data', function (event) {
...
});

Carlos Z

Thanks a lot for the reply dear sir.

1 Like