title: How do you handle splicing a variable that is shared among async functions?
body: <p>I'm worried about a splice in one of my async functions causing another function to throw an error in a situation like this: </p>
  
  <pre><code>var sharedObject = [{key: 'foo', value: {varA: 1, varB: 5}}]
  
  readObject: function(key) { 
      var index = findIndex(sharedObject, key)            &lt;- line 4
      var b = sharedObject[index].value.varB              &lt;- line 5
  }
  
  spliceObject: function(key) {
      var index = findIndex(sharedObject, key)
      sharedObject.splice(index,1)                        &lt;- line 10
  }
  </code></pre>
  
  <p>If the readObject and spliceObject functions are called asynchronously, and line 10 executes right in between line 4 and line 5, will line 5 throw an error because that entry in the object doesn't exist anymore? </p>
  
  <p>Or am I missing something with how async functions execute? </p>