Tell us what’s happening:
Describe your issue in detail here.
Hello my code doesn’t a display this in the console
};
this.setFirstName = function(name) {
fullName = name + " " + fullName.split(" ")[1];
};
this.setLastName = function(name) {
fullName = name;
};
};
const bob = new Person(‘Bob Ross’);
console.log(bob.getFullName());
Find
No results
// running tests
No properties should be added. Object.keys(bob).length should always return 6.
bob.getFullName() should return the string Haskell Curry after bob.setLastName(“Curry”).
bob.getFullName() should return the string Haskell Curry after bob.setFullName(“Haskell Curry”).
bob.getFirstName() should return the string Haskell after bob.setFullName(“Haskell Curry”).
bob.getLastName() should return the string Curry after bob.setFullName(“Haskell Curry”).
// tests completed
// console output
Bob Ross
Your code so far
const Person = function(firstAndLast) {
let fullName = firstAndLast;
this.getFirstName = function() {
return fullName.split(" ")[0];
};
this.getLastName = function(){
return fullName.split(" ")[1];
};
this.getFullName = function() {
return fullName;
};
this.setFirstName = function(name) {
fullName = name + " " + fullName.split(" ")[1];
};
this.setLastName = function(name) {
fullName = name;
};
};
const bob = new Person('Bob Ross');
console.log(bob.getFullName());
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/105.0.0.0 Safari/537.36 OPR/91.0.4516.95
Challenge: Intermediate Algorithm Scripting - Make a Person
Link to the challenge: