9th
Mar 2015
Tyler Haas
@tylerthehaas
Mar 09 2015 02:09

so working on the make person challenge here is my code

var Person = function(firstAndLast) {
var arr = firstAndLast.split(' ');
this.getFirstName = function(){
return arr[0];
};
this.getLastName = function(){
return arr[arr.length - 1];
};
this.getFullName = function(){
return arr.join(' ');
};
this.setFirstName = function(first){
return this.firstName = first;
};
this.setLastName = function(last){
return this.lastName = last;
};
this.setFullName = function(firstAndLast){
return this.fullName = firstAndLast;
};
};

var bob = new Person('Bob Ross');

saying bob.getLastName should equal happy on the tests I'm not understanding what I need to add to pass the tests...seems to work fine when bob ross is passed in

any help pointing me in the right direction would be appreciated
Chris Dziewa
@chrisdziewa
Mar 09 2015 02:10
You don't want to set get first name to arr[0];
This bonfire is super specific on what it wants which wouldn't make sense in production necessarily
If the program doesn't explicitly call setFirstName, it should be undefined
Tyler Haas
@tylerthehaas
Mar 09 2015 02:11
should I use object literal notation and use key value pairs instead?
Chris Dziewa
@chrisdziewa
Mar 09 2015 02:11
the way you are doing it now is fine actually
but for getFirstName it should just return this.firstName
the only thing that should work after creating an instance is the fullName method
until you later change the first or last name
also if you want you can use the || operator to check if this.firstName and this.lastName are set otherwise you can have it choose to return the parameter that was passed
in the fullName method that is
Tyler Haas
@tylerthehaas
Mar 09 2015 02:16
hmm...so I changed it to that but now the bob ross test arent passing
Chris Dziewa
@chrisdziewa
Mar 09 2015 02:18
what is your updated code?
Tyler Haas
@tylerthehaas
Mar 09 2015 02:18
this is my code now
var Person = function(firstAndLast) {
this.getFirstName = function(){
return this.firstName;
};
this.getLastName = function(){
return this.lastName;
};
this.getFullName = function(){
return this.fullName;
};
this.setFirstName = function(first){
return this.firstName = first;
};
this.setLastName = function(last){
return this.lastName = last;
};
this.setFullName = function(firstAndLast){
return this.fullName = firstAndLast;
};
return firstAndLast;
};

var bob = new Person('Bob Ross');
Cristián Berríos
@crisberrios
Mar 09 2015 02:24
@haasDev when doing a constructor function you don't have to return anything
the function will run on the context of the new object being created
Tyler Haas
@tylerthehaas
Mar 09 2015 02:25
so take out the returns on all the functions?
Chris Dziewa
@chrisdziewa
Mar 09 2015 02:25
alright it looks like the tests do care about having first and last set for the first one passed in, just not when you change it
take the last one out
Cristián Berríos
@crisberrios
Mar 09 2015 02:25
@chrisdziewa did you crack no repeats?
Chris Dziewa
@chrisdziewa
Mar 09 2015 02:25
haha no.
:worried:
Cristián Berríos
@crisberrios
Mar 09 2015 02:26
did you understand the pseudo function I wrote?
Tyler Haas
@tylerthehaas
Mar 09 2015 02:26
wait...take the last what out?
Chris Dziewa
@chrisdziewa
Mar 09 2015 02:26
the last return statement that was there when you started
Cristián Berríos
@crisberrios
Mar 09 2015 02:27
 this.setFullName = function(firstAndLast){
return this.fullName = firstAndLast;
};
return firstAndLast;
Suzanne Atkinson
Mar 09 2015 02:27
Chris, I have some advice for you...
Cristián Berríos
@crisberrios
Mar 09 2015 02:27
the last return statement, and also setFullName is wrong as you are returning an assignment
in fact, you don't need to return anything for setters
Chris Dziewa
@chrisdziewa
Mar 09 2015 02:28
@crisberrios I kind of do but I apparently am doing everything wrong to it in my recursive case
Cristián Berríos
@crisberrios
Mar 09 2015 02:29
want to pair?
Chris Dziewa
@chrisdziewa
Mar 09 2015 02:29
I would love that actually haha
Cristián Berríos
@crisberrios
Mar 09 2015 02:29
I only have teamviewer
Chris Dziewa
@chrisdziewa
Mar 09 2015 02:30
I have it but have never used it
would be good to try it
Cristián Berríos
@crisberrios
Mar 09 2015 02:30
send me your id/pass
Chris Dziewa
@chrisdziewa
Mar 09 2015 02:31
@AdventureBear haha I've seen that. I had a roommate who loved learning to paint from that guy's videos :P
@haasDev when I'm done pairing if you are still stuck, I can maybe pair with you yet tonight
Tyler Haas
@tylerthehaas
Mar 09 2015 02:33
var Person = function(firstAndLast) {
this.getFirstName = function(){
return this.firstName;
};
this.getLastName = function(){
return this.lastName;
};
this.getFullName = function(){
return this.fullName;
};
this.setFirstName = function(first){
this.firstName = first;
};
this.setLastName = function(last){
this.lastName = last;
};
this.setFullName = function(firstAndLast){
this.fullName = firstAndLast;
};
};

var bob = new Person('Bob Ross');
thats my code now
what did I need to change with the setFullName method?
Tyler Haas
@tylerthehaas
Mar 09 2015 02:38
that might be good...thanks for your help
Julie Myers
@BlueOceanView
Mar 09 2015 02:40
@haasDev did you want to separate your first name from the last name?
Tyler Haas
@tylerthehaas
Mar 09 2015 02:42
thats what I originally tried but it didn't seem to do the trick
Julie Myers
@BlueOceanView
Mar 09 2015 02:43
It won't work how it is now because you are only passing in one argument that is named firstAndLast.
Mind if I give it a try?
Tyler Haas
@tylerthehaas
Mar 09 2015 02:46
i got it!!
Julie Myers
@BlueOceanView
Mar 09 2015 02:48
What did you do?
Tyler Haas
@tylerthehaas
Mar 09 2015 02:49
added a handler for the errors in the getter methods using the || operator
Julie Myers
@BlueOceanView
Mar 09 2015 02:49
Could you paste your coding?
Tyler Haas
@tylerthehaas
Mar 09 2015 02:49
I went on...How do I go back to it?
Julie Myers
@BlueOceanView
Mar 09 2015 02:51
What software did you type your coding out in?
Tyler Haas
@tylerthehaas
Mar 09 2015 02:53
nothing just did it directly in bonfire
Julie Myers
@BlueOceanView
Mar 09 2015 02:53
I learned to do constructor methods this way: using function declarations not function expressions.
function Cat(name, age) {
this.name = name;
this.age = age;
this.meow = function(){
console.log("Meow!");
};
}
var sophia = new Cat("Sophia", 17);
Oh...I dont' think you can get it back in bonfire. No worries.
i'm not saying using function expressions is wrong.
Tyler Haas
@tylerthehaas
Mar 09 2015 02:56
here:

var Person = function(firstAndLast) {
var arr = firstAndLast.split(' ');
this.getFirstName = function(){
return this.firstName || arr[0];
};
this.getLastName = function(){
return this.lastName || arr[1];
};
this.getFullName = function(){
return this.fullName || firstAndLast;
};
this.setFirstName = function(first){
this.firstName = first;
};
this.setLastName = function(last){
this.lastName = last;
};
this.setFullName = function(firstAndLast){
this.fullName = firstAndLast;
};
};

var bob = new Person('Bob Ross');`
thats the code I used
Yosi
@jparkton
Mar 09 2015 02:57
and we put a pretty little cloud right here
and some trees
I miss that guy
Tyler Haas
@tylerthehaas
Mar 09 2015 02:58
I know he was the best...spent a lot of saturday's with him as a kid
Julie Myers
@BlueOceanView
Mar 09 2015 02:58
Thanks for sharing. That's a neat way to split up the name.
Tyler Haas
@tylerthehaas
Mar 09 2015 02:58
somehow my pictures never turned out the same...
Yosi
@jparkton
Mar 09 2015 03:03
Also fun fact before that he was a USMC DI
Kinda funny to imagine him as a DI
Julie Myers
@BlueOceanView
Mar 09 2015 03:08
Usually once a Marine always a Marine.
Yosi
@jparkton
Mar 09 2015 03:09
yeah, hard to break out of that brainwashed mentality
Suzanne Atkinson
Mar 09 2015 03:11
@jparkton sometimes your comments seem very confrontational, do you mean them that way?
@BlueOceanView is referring to their internal culture I believe. http://en.wikipedia.org/wiki/United_States_Marine_Corps#Veteran_Marines
Julie Myers
@BlueOceanView
Mar 09 2015 03:12
@AdventureBear I didn't really take it that way. Some people think that anyone who enters the Marine's get brainwashed to always be a Marine.
Thanks though.
Suzanne Atkinson
Mar 09 2015 03:20
eh, OK, just thought the brainwashed comment was out of place. Who's to say who is brainwashed? Everyone travels their own path.
Julie Myers
@BlueOceanView
Mar 09 2015 03:21
@AdventureBear Yeah, I see what you mean. I wrote a paper back in college about how word definitions change over time.
How different parts of the country can say the same sentence, but mean different things.
I think all this diversity is what makes making things politically correct so hard.
Chris Dziewa
@chrisdziewa
Mar 09 2015 04:04
@BlueOceanView your code for a constructor is definitely how I would make an object too ha
that bonfire challenge is so specific
Julie Myers
@BlueOceanView
Mar 09 2015 04:05
@chrisdziewa :)
Chris Dziewa
@chrisdziewa
Mar 09 2015 04:09
@haasDev congrats on finishing!
Yosi
@jparkton
Mar 09 2015 04:27
@BlueOceanView No I know some great people who served I only mean the brainwashed part about those who get all jacked up and gung ho and then never drop the act. There are more who that training turns them into good men, honest men but some come out acting like macho morons
@AdventureBear Yes I do sound confrontational
Julie Myers
@BlueOceanView
Mar 09 2015 04:29
@jparkton That's cool. I've meet those gung ho types before.
Yosi
@jparkton
Mar 09 2015 04:30
They leave a lot of people with a bad taste for the marines
but then there are the decent people who used their training to grow, I like them
Julie Myers
@BlueOceanView
Mar 09 2015 04:30
Yeah. But, I think that is true for any group of people.
Yosi
@jparkton
Mar 09 2015 04:38
very true
yqyeoh
@yqyeoh
Mar 09 2015 12:36
anyone has done the bon-fire symmetric difference challenge?
assert.deepEqual(sym([1, 1, 2, 5], [2, 2, 3, 5], [3, 4, 5, 5]), [1, 4, 5], 'should return an array of unique values');AssertionError:should return an array of unique values: expected [ 1, 4 ] to deeply equal [ 1, 4, 5 ]
y should 5 be included?
Luke
@Lukukas
Mar 09 2015 14:00
yeah, it should. I think this video helps explain it well.
I was definitely confused at first though
Cristián Berríos
@crisberrios
Mar 09 2015 14:06
good video @Lukukas
yqyeoh
@yqyeoh
Mar 09 2015 14:18
i see! thanks!!
Tyler Haas
@tylerthehaas
Mar 09 2015 17:45
anyone know what equation to use to get the orbital period for the map the debris bonfire?
Oliver