These are chat archives for LPM42/JavaScript_Foundations_2

15th
Dec 2014
Stephanie Beaton
@StephanieBeaton
Dec 15 2014 02:55

Quiz 6 - question about "Have at least one child class over-ride a property"
But how exactly does a child class override a property of its parent class?

can the same property ("property1" for example) be in both parent and child constructors?

Or do we say --

function Child (x) {
this.x = x;
}

function Parent(y) {
this.z = "z1";
this.y = y;
}

Child.prototype = new Parent("y");

Child.prototype.z = "z2";

I asked Mel the above question and got this answer.

Child.prototype = new Parent("y");
Child.prototype.z = "z2";

would be over-writing the value of z in the parent. over-riding means putting the value earlier in the prototype chain.

so:

function Child() {
this.z = "z2";
}

is over-riding

Ansoo Chang
@anschang
Dec 15 2014 06:14
Question 2 lab3 - is this a fibonacci sequence?
Stephanie Beaton
@StephanieBeaton
Dec 15 2014 19:35

Question 2 lab3 - i think this is not Fibonacci

during hour 1 rate of consumption = 1
during hour 2 rate of consumption = 2 total people eaten = 2 + 1 = 3
during hour 3 rate of consumption = 3 total people eaten = 3 + 2 + 1 = 6
.......

at the end of hour n when there are no more people to eat
rate of consumption = n
total people eaten = n + (n-1) + (n-2) +... +3+2+ 1

Stephanie Beaton
@StephanieBeaton
Dec 15 2014 19:44

which equals (n+1)n/2 i think. google it.

Fibonacci is n = (n-1) + (n-2)
0
1
1 = 0 + 1
3 = 2 + 1
5 = 3 + 2
8 = 5 + 3
13 = 8 + 5
n = (n-1) + (n-2)

Stephanie Beaton
@StephanieBeaton
Dec 15 2014 20:37
@lpm42 i looked at "bootstrap" website. Not sure where to start with installing it. Not sure if I should install on my Windows 8.1 laptop or on my Ubuntu latop. Do you have time to look at this sometime?
'P divy' (Ingrid)
@icuthy
Dec 15 2014 20:46
@anschang and @StephanieBeaton Question2 lab3. I think the key is that the blob gets faster and stronger after each person he eats. So we need to calculate the total amount of time considering that the first person takes 1 hour, (now the rate is 2 people per hour) so the second person would take an hour divided by 2, the third person an hour divided by 3....... and so on. And we add the totals until we reach the last unfortunate resident of Dowington. :)
Livingston Martin
@LPM42
Dec 15 2014 21:11

@StephanieBeaton
Absolutly!
So the easiest way to use/install it is to:

  1. Go to this link: http://getbootstrap.com/getting-started/

  2. Copy all 3 links of the “Bootstrap CDN” code and paste in the <head></head> section of your HTML file.
    (CDN = “Content Delivery Network”, it tells your page to grab the bootstrap information from another server. As opposed to needing store your own copy of bootstrap.)

  3. You should now be able to access bootstrap CSS classes.
    Scroll down on the http://getbootstrap.com/getting-started/ page, you can see (and copy) the starter template. Or, go to this page: http://getbootstrap.com/css/ to see a wide variety of avalable styles.

I would be happy to walk you through it in class too if you want.

Note: you need access to the internet for this to work, as your page needs to be able to access the CDN.

Ansoo Chang
@anschang
Dec 15 2014 22:43
@StephanieBeaton @icuthy Thank you :-)