{"action":"created","issue":{"url":"https://api.github.com/repos/FreeCodeCamp/freecodecamp/issues/1395","labels_url":"https://api.github.com/repos/FreeCodeCamp/freecodecamp/issues/1395/labels{/name}","comments_url":"https://api.github.com/repos/FreeCodeCamp/freecodecamp/issues/1395/comments","events_url":"https://api.github.com/repos/FreeCodeCamp/freecodecamp/issues/1395/events","html_url":"https://github.com/FreeCodeCamp/freecodecamp/issues/1395","id":97468036,"number":1395,"title":"Tests for \"Make a Person\" bonfire don't make sense","user":{"login":"LimeBlast","id":219206,"avatar_url":"https://avatars.githubusercontent.com/u/219206?v=3","gravatar_id":"","url":"https://api.github.com/users/LimeBlast","html_url":"https://github.com/LimeBlast","followers_url":"https://api.github.com/users/LimeBlast/followers","following_url":"https://api.github.com/users/LimeBlast/following{/other_user}","gists_url":"https://api.github.com/users/LimeBlast/gists{/gist_id}","starred_url":"https://api.github.com/users/LimeBlast/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/LimeBlast/subscriptions","organizations_url":"https://api.github.com/users/LimeBlast/orgs","repos_url":"https://api.github.com/users/LimeBlast/repos","events_url":"https://api.github.com/users/LimeBlast/events{/privacy}","received_events_url":"https://api.github.com/users/LimeBlast/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-07-27T13:51:35Z","updated_at":"2015-07-29T05:21:31Z","closed_at":null,"body":"I think there might be something wrong with the [Make a Person bonfire](http://www.freecodecamp.com/challenges/bonfire-make-a-person), as what I've found as a passing solution goes against everything that I'd just learnt in the Udacity tutorials.\r\n\r\nUsing the following solution, I'm able to get all of the tests passing, except for the first:\r\n\r\n```javascript\r\nvar Person = function(firstAndLast) {\r\n  this.setFullName(firstAndLast);\r\n};\r\n\r\nPerson.prototype.getFirstName = function() {\r\n  return this.first;\r\n};\r\n\r\nPerson.prototype.getLastName = function() {\r\n  return this.last;\r\n};\r\n\r\nPerson.prototype.getFullName = function() {\r\n  return this.first + ' ' + this.last;\r\n};\r\n\r\nPerson.prototype.setFirstName = function(first) {\r\n  this.first = first;\r\n};\r\n\r\nPerson.prototype.setLastName = function(last) {\r\n  this.last = last;\r\n};\r\n\r\nPerson.prototype.setFullName = function(firstAndLast) {\r\n  names = firstAndLast.split(' ');\r\n  this.first = names[0];\r\n  this.last = names[1];\r\n};\r\n\r\nvar bob = new Person('Bob Ross');\r\nbob.getFullName();\r\n```\r\nI'm no expect at this, and I'm sure my code could probably be slightly better refactored, but based on what udacity has just been teaching, this seems like a fairly good solution - except that it fails on the first test, the one stating `expect(Object.keys(bob).length).to.eql(6);` should be true;\r\n\r\nSo I've spent a bit of time looking at other solutions, such as [this one](https://github.com/StrongeLeeroy/freecodecamp-solutions/blob/master/bonfires/intermediate-algorithm-scripting/01-make-a-person.js), and the [one listed here](http://www.freecodecamp.com/adventurebear), which both satisfy the test condition, but in an inefficient way.\r\n\r\nAnyway, I could be missing something, if so, please let me know what. Thank you."},"comment":{"url":"https://api.github.com/repos/FreeCodeCamp/freecodecamp/issues/comments/125847029","html_url":"https://github.com/FreeCodeCamp/freecodecamp/issues/1395#issuecomment-125847029","issue_url":"https://api.github.com/repos/FreeCodeCamp/freecodecamp/issues/1395","id":125847029,"user":{"login":"clintoncampbell","id":7392492,"avatar_url":"https://avatars.githubusercontent.com/u/7392492?v=3","gravatar_id":"","url":"https://api.github.com/users/clintoncampbell","html_url":"https://github.com/clintoncampbell","followers_url":"https://api.github.com/users/clintoncampbell/followers","following_url":"https://api.github.com/users/clintoncampbell/following{/other_user}","gists_url":"https://api.github.com/users/clintoncampbell/gists{/gist_id}","starred_url":"https://api.github.com/users/clintoncampbell/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/clintoncampbell/subscriptions","organizations_url":"https://api.github.com/users/clintoncampbell/orgs","repos_url":"https://api.github.com/users/clintoncampbell/repos","events_url":"https://api.github.com/users/clintoncampbell/events{/privacy}","received_events_url":"https://api.github.com/users/clintoncampbell/received_events","type":"User","site_admin":false},"created_at":"2015-07-29T05:21:31Z","updated_at":"2015-07-29T05:21:31Z","body":"I ran into the same issue, and I don't think the problem aligns well with the methodology Udacity taught. \r\n\r\nI think they're approaching it this way to prevent you from directly accessing bob.first or bob.last. I think the way you accomplish this is to take advantage of closures by pulling the functions into Person() and declaring local variables rather than properties of the object.\r\n\r\nSo code starts out like so:\r\n\r\n```\r\nvar Person = function(firstAndLast) {\r\nvar first, last;\r\n\r\nvar setFullName = function(firstAndLast) {\r\n  names = firstAndLast.split(' ');\r\n  first = names[0];\r\n  last = names[1];\r\n};\r\n\r\n```\r\nI imagine you could also do this.\r\n\r\n```\r\nvar Person = function(firstAndLast) {\r\nvar first, last;\r\n\r\nPerson.prototype.setFullName = function(firstAndLast) {\r\n  names = firstAndLast.split(' ');\r\n  first = names[0];\r\n  last = names[1];\r\n};\r\n\r\n```\r\n\r\nHowever, I think you'll fail the property count check. I don't think you prevent the functions being recreated every time either. \r\n\r\nIt'd be cool if the trickier Bonfires opened up an extra Waypoint to discuss issues like this and alternate implementations."}}