title: JS problem when creating a Class Function that is gonna validate name by calling function inside the Class
body: <p>So this is my code: pressing a button creates html mssg:
  Inside the class Student, I tried to check names for inv characters and empty fields.
  Then I wanted to pass through another f-on which would check if both f-ons doing their thing and to call her outside the class.
  I tried different ways to solve it but returns the same result.
  Please if someone knows to resolve or explain in more details would be grateful.</p>
  <p>TY all.</p>
  <pre><code>  constructor(fullName, address, phone, course) {
      this._fullName = fullName;
      this.address = address;
      this.phone = phone;
      this.course = course;
    }
    validateName(text) {
      let regex = /^[A-Za-z0-9 ]+$/;
      let isValid = regex.test(text);
      if (!isValid) {
        alert(&quot;Contains Special characters&quot;);
      } else {
        alert(&quot;OK&quot;);
      }
    }
  
    checkName(text) {
      text = text.trim();
      if (text === &quot;&quot;) {
        throw new Error(&quot;The name can not be empty&quot;);
      } else {
        return (this._fullName = text);
      }
    }
  
    sucess(text) {
      let notChars = this.validateName(text);
      let notEmpty = this.checkName(text);
  
      if (!notChars || !notEmpty) {
        return alert(&quot;chars or empty&quot;);
      } else {
        return alert(&quot;ok&quot;);
      }
    }
  
    getInfo() {
      return `Name: ${this._fullName} &lt;br&gt; Address: ${this.address}&lt;br&gt; Phone: ${this.phone}&lt;br&gt;  Course: ${this.course}`;
    }
  }
  
  let fullName = $(&quot;#fullName&quot;);
  let address1 = $(&quot;#inputAddress&quot;);
  let address2 = $(&quot;#inputAddress2&quot;);
  let inputCity = $(&quot;#inputCity&quot;);
  let inputZip = $(&quot;#inputZip&quot;);
  let phone = $(&quot;#phoneNumber&quot;);
  let show = $(&quot;#show&quot;);
  let course = $(&quot;#course&quot;);
  
  $(&quot;#signInBtn&quot;).on(&quot;click&quot;, (e) =&gt; {
    e.preventDefault();
    let address = `${address1.val()} ${address2.val()} ${inputCity.val()} ${inputZip.val()}`;
    let student1 = new Student(
      fullName.val(),
      address,
      phone.val(),
      course.val()
    );
  
    show.html(student1.sucess(&quot;Steva&quot;));
  });
  </code></pre>