Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make a person challenge #4

Closed
pconcurrently opened this issue Apr 19, 2016 · 1 comment
Closed

Make a person challenge #4

pconcurrently opened this issue Apr 19, 2016 · 1 comment
Assignees
Labels

Comments

@pconcurrently
Copy link

I think you're probably wrong on this challenge. According to your original code, it's not possible to change fullName when using function setFirstName or setLastName. Here is my fix to make it work.

var Person = function(firstAndLast) {

  var arr = firstAndLast.split(' ');

  this.getFirstName = function() {
    return arr[0];
  };

  this.getLastName = function() {
    return arr[1];
  };

  this.getFullName = function() {
    return arr.join(' ');
  };

  this.setFirstName = function(first) {
    arr[0] = first;
  };

  this.setLastName = function(last) {
    arr[1] = last;
  };

  this.setFullName = function(firstAndLast) {
    arr = firstAndLast.split(' ');
  };
};

var bob = new Person('Bob Ross');
bob.getFullName();
@Rafase282
Copy link
Owner

I think this has been corrected on the code already.

@Rafase282 Rafase282 added the bug label May 17, 2016
@Rafase282 Rafase282 self-assigned this May 17, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants