title: modifying object synchronously, in nodejs
body: <p>how can i guarantee a line is done before another line in nodejs promise, when i am modifying an object property:</p>
  
  <pre><code>let getToken = function async (result) {
  
  return new Promise(function (resolve, reject) {
  
      result = JSON.parse(result)[0];
       //how can i make sure that this line will execute before the next if(), despite nodejs is executing asynchronously   
       result.token = jwt.sign({
          data: 'foobar'
        }, 'secret', { expiresIn: '1h' });
  
      if(result.token){
  
          console.log('Res:'+ result.Age);
          resolve(result);
      }
  
  
  });
  }
  </code></pre>
  
  <p>like you see in comment line, when i am modifying object property. how can i make sure the next line will execute just after current line operation?</p>