Home » Jquery » javascript – Error message from if statement – Uncaught SyntaxError: Invalid or unexpected token

javascript – Error message from if statement – Uncaught SyntaxError: Invalid or unexpected token

Posted by: admin February 22, 2020 Leave a comment

Questions:

I’m getting an error on this the if statement on the last function.

Uncaught SyntaxError: Invalid or unexpected token –

if (errorFirstName == false && errorLastName == false && errorJobTitle == false && errorEmail == false &&

But the console gives the errors with the “&#038 ; &#038 ;” in between each && in the console if statement error. Without the spaces.

Any idea what may be causing this?

   var errorFirstName = false;
    var errorLastName = false;
    var errorJobTitle = false;
    var errorEmail = false;
    var errorCompanyName = false;

  $('#toSlide-2').on('click', function () {

    errorFirstName = false;
    errorLastName = false;
    errorJobTitle = false;
    errorEmail = false;
    errorCompanyName = false;

    check_firstName();
    check_lastName();
    check_email();
    check_companyName();
    check_jobTitle();

    if (errorFirstName == false && errorLastName == false && errorJobTitle == false && errorEmail == false &&
      errorCompanyName == false) {
      console.log('yes');
      return true;
    } else {
      console.log('no');
      return false;
    }

  });
How to&Answer: