title: Add, update and query SharePoint list items from CSOM using javascript
body: <p>Using javascript and SharePoint's CSOM, can someone provide an example for the follow scenario: </p>
  
  <p>Get field value from the selected items in a list (ListA).</p>
  
  <p>Then for each item selected, take a fields value and use it to query a different list (ListB).</p>
  
  <p>If the query returns 0 rows, create item in ListB and update selected item in ListA.</p>
  
  <p>Else if the query returns 1 row, update selected item in ListA.</p>