validateInputs() {
    const authorName = this.removeDangerousInput(document.getElementById('review-author').value);
    const rating = Array.from(document.getElementsByName('rating')).find(r => {
      r.checked ? r.setAttribute('aria-checked', true) : r.setAttribute('aria-checked', false)
      return r.checked
    });
    const comment = this.removeDangerousInput(document.getElementById('review-comment').value);
    const formError = document.getElementById('validation-error');
    if (authorName && rating && comment) {
      formError.hidden = true;
      document.getElementById('review-form').reset();
      this.addNewReview(authorName, rating.value, comment);
    } else {
      formError.hidden = false;
    }
  }
/**
   * Validate inputs, remove dangerous content and conditionally trigger
   * addNewReview method or show warning for the badly filled form.
   */
Validate inputs, remove dangerous content and conditionally trigger
addNewReview method or show warning for the badly filled form.
Validate inputs remove dangerous content and conditionally trigger addNewReview method or show warning for the badly filled form .
validateInputs() {
    const authorName = this.removeDangerousInput(document.getElementById('review-author').value);
    const rating = Array.from(document.getElementsByName('rating')).find(r => {
      r.checked ? r.setAttribute('aria-checked', true) : r.setAttribute('aria-checked', false)
      return r.checked
    });
    const comment = this.removeDangerousInput(document.getElementById('review-comment').value);
    const formError = document.getElementById('validation-error');
    if (authorName && rating && comment) {
      formError.hidden = true;
      document.getElementById('review-form').reset();
      this.addNewReview(authorName, rating.value, comment);
    } else {
      formError.hidden = false;
    }
  }
validateInputs ( ) { const authorName = this . removeDangerousInput ( document . getElementById ( 'review-author' ) . value ) ; const rating = Array . from ( document . getElementsByName ( 'rating' ) ) . find ( r => { r . checked ? r . setAttribute ( 'aria-checked' , true ) : r . setAttribute ( 'aria-checked' , false ) return r . checked } ) ; const comment = this . removeDangerousInput ( document . getElementById ( 'review-comment' ) . value ) ; const formError = document . getElementById ( 'validation-error' ) ; if ( authorName && rating && comment ) { formError . hidden = true ; document . getElementById ( 'review-form' ) . reset ( ) ; this . addNewReview ( authorName , rating . value , comment ) ; } else { formError . hidden = false ; } }
Validate inputs, remove dangerous content and conditionally trigger
 addNewReview method or show warning for the badly filled form.
Validate inputs remove dangerous content and conditionally trigger addNewReview method or show warning for the badly filled form .