Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

HTML jQuery Basics (2014) Creating a Password Confirmation Form Improving the form validation

Toni Caktas
Toni Caktas
16,957 Points

dont quite get the assigment

What do I need to return?

1 Answer

Hi Toni!

In the programming the term return means a function after its execution should return some value. For example:

function iAmFunctionAndIreturnValue () {
    return "I am the returning value!";
}

On the other hand a function can do not return a value. For example:

function iAmFunctionButIdonNotReturnAnything () {
    alert("I just show you this message, but don't return any value.");
}

By the way, function also can accept values:

function iAmFunctionAndIacceptValue (incomingValue) {
    alert("Hi, I've accepted this value: " + incomingValue);
}

In the code challenge you need to return boolean value "true".

The answers for challenge:

Code challenge, step 1 of 2, lines 10 to 14:

function isUsernamePresent() {
  // If length of an entered username is greater than 0 (it's not empty), we return "true"
  if ($username.val().length > 0) {
    return true;
  }
}

Code challenge, step 2 of 2, lines 24-26:

function canSubmit() {
  return isPasswordValid() && arePasswordsMatching() && isUsernamePresent();
}