Tell us what’s happening:
Just a query on syntax. I’m still solving the challenge. Okay. Here is my query:
I initially tried to use arrow functions but the got back errors. I don’t quite understand why I would get that. I’m not sure if I received errors because I’m just not writing it out correctly or if there is something about arrow functions that are not appropriate to this particular scenario. Would some one please clear this up for me? Thank you
Your code so far
var Person = function(firstAndLast) {
//getters
this.first = firstAndLast.split(' ')[0];
this.last = firstAndLast.split(' ')[1];
this.fullName = this.first + ' ' + this.last;
//setters
this.setFirstName = function(str){
this.first = str;
},
this.setLastNam = function(str){
this.last = str;
},
this.setFullName = function(str){
this.fullName = firstAndLast;
}
}
var bob = new Person('Bob Ross');
bob.getFullName();
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.100 Safari/537.36
.
Link to the challenge:
https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/make-a-person/