Skip to content

Lajawanti-Dhake - #683

Open
innovationcode wants to merge 9 commits into
bloominstituteoftechnology:masterfrom
innovationcode:master
Open

Lajawanti-Dhake#683
innovationcode wants to merge 9 commits into
bloominstituteoftechnology:masterfrom
innovationcode:master

Conversation

@innovationcode

Copy link
Copy Markdown

@mmargo10 "Sprint-challenge-Javascript"

@mmargo10 mmargo10 left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you have a solid grasp of the material. Keep up the good work!

Comment thread Answers.md
2) What is the difference between a function and a method?
--> In programming, function is a named section of a program that performs a specific task. In javascript you can define function
anywhere in your program because of HOISITNG.
A function defined inside of an object is known as method.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correct!

Comment thread Answers.md
--> .forEach() works similar as for loop, using .forEach() you can iterate through every element in the array, .forEach() method doesn’t
return anything.
.map() method will also call a provided function on every element in the array. The difference is that map() utilizes return values
and actually returns a new Array of the same size.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, good answer!

Comment thread Answers.md

3) What is closure?
--> A closure is an inner function that has access to the outer (enclosing) function's variables—scope chain. The closure has three
scope chains: it has access to its own scope (variables defined between its curly brackets), it has access to the outer function's variables, and it has access to the global variables.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correct!

Comment thread Answers.md
We call these explicit because you are explicitly passing in a this context to call() or apply().

new Binding : whenever we’ve got a function invoked with the new operator, the this keyword here is bound to the new object being
built by the function constructor.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correct!

Comment thread challenges/classes.js
const cube = new CubeMaker(5);
console.log(cube);
console.log(cube.volume()); // 125
console.log(cube.surfaceArea()); // 150 No newline at end of file

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well done. You completed each task correctly.

'roar' : function() {
return "RAWERSRARARWERSARARARRRR!";
}
};

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would suggest that in future you use const or let instead of var.

'period' : 'Late Cretaceious'
};

// Using your dinosaur objects, log answers to these questions:

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where are your logs?

Comment thread challenges/objects-arrays.js Outdated
Once you have the new array created, sort the universities alphabetically and log the result. */
const universities = [];
console.log(universities)
const universities = graduates.map(function(element) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your answer is a correct use of .map, however you were instructed to NOT use any array methods. A for loop would have been the correct answer.

const populationTotal = zooAnimals.reduce(function(total, animalPopulation) {
return total + animalPopulation.population;
},0);
console.log(populationTotal) No newline at end of file

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The answers to the zoo animals questions are correct.

Comment thread challenges/prototypes.js
this.length = length;
this.width = width;
this.height = height;
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

correct.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants