Tell us what’s happening:
Hey everyone, so I’m trying to solve this challenge but Ive been staring at the screen for a couple hours and I’m really at my wits end. Can someone please nudge me in the right direction?
Thanks so much.
Your code so far
function Person(firstAndLast) {
// Complete the method below and implement the others similarly
let fullName = firstAndLast;
let splitNames = fullName.split(" ");
let first = splitNames[0];
let last = splitNames[1];
//Setters:
this.setFirstName = function(first) {
this.firstName = first;
};
this.setLastName = function(last) {
this.lastName = last;
};
this.setFullName = function(fullName) {
this.fullName = fullName;
};
//Getters:
this.getFirstName = function() {
return this.firstName;
};
this.getLastName = function() {
return this.lastName;
};
this.getFullName = function() {
return this.fullName;
};
}
var bob = new Person('Bob Ross');
bob.getFullName();
console.log(bob.getFirstName);
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.87 Safari/537.36.
Link to the challenge:
https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/make-a-person