title: Uncaught referenceError: newMoney is not defined
body: <p>Why is it not defined though i already defined newMoney at the top here is my code :</p>
  
  <pre><code>             var deduct = 100;
               var newMoney = {{user.e_money}} - deduct;
               var username = getUserName(); //get the current user
                // send a message to the server that the e-money value has changed
               socket.emit('update e-money', username, newMoney);
  
               console.log("Emitting the data to the server side - emoney: " + newMoney + " with the name money of : " + username);
              //end 
  
              clearTimeout(interval);
              //send the data to the server
              socket.emit('chat message', getUser());
              var interval = setTimeout(function(){
                  $('.'+getUser()).fadeIn();
              },5000);
          });
  
               socket.on('update e-money response', function (data) {
               alert("Your money is: "+ data.newMoney);
               console.log("Your money is: "+ data.newMoney);
               });
  </code></pre>
  
  <p>and on my server side here is my code :</p>
  
  <pre><code> //emoney
  socket.on('update e-money', function (data) {
   var userName = data.username;
   var newMoney = data.newMoney;
  //var query = {"name": userName};
  
    // update the entry on the database
    User.findOneAndUpdate({"username":userName}, {"$set":{"e_money": "300" }}, { upsert: true, returnOriginal:false }, function (err, doc) {
  
  if (err) {
    console.log("There was an error: " + err);
    console.log(userName);
    io.emit('update e-money error', { error: err });
  
  } else {
  
      io.emit('update e-money response', { newMoney: newMoney });
      console.log(newMoney);
  }
    });
    });
  </code></pre>
  
  <p>I dnt know why it is undefined . Can you help me guys . Anyone.</p>