web/apps/hello-elasticsearch/js/hello-elasticsearch.js
function parseQuery() {
  let query = {};

  try { query = JSON.parse(queryBox.value); }
  catch(error) {
    queryError.textContent = 'Query must be valid JSON';
    hide(queryButton);
    hide(queryResults);
    show(queryError);
    return null;
  } 

  hide(queryError);
  show(queryButton);
  return query;
}
function parseQuery() {
  let query = {};

  try { query = JSON.parse(queryBox.value); }
  catch(error) {
    queryError.textContent = 'Query must be valid JSON';
    hide(queryButton);
    hide(queryResults);
    show(queryError);
    return null;
  } 

  hide(queryError);
  show(queryButton);
  return query;
}
function parseQuery ( ) { let query = { } ; try { query = JSON . parse ( queryBox . value ) ; } catch ( error ) { queryError . textContent = 'Query must be valid JSON' ; hide ( queryButton ) ; hide ( queryResults ) ; show ( queryError ) ; return null ; } hide ( queryError ) ; show ( queryButton ) ; return query ; }
Parse the query as typed in the box and confirm it is valid JSON
Parse the query as typed in the box and confirm it is valid JSON