Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community!
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trial
usha addala
Full Stack JavaScript Techdegree Student 3,403 Pointsitem.kill(); what does this method do when its called?
what does this method do when its called?
function itemHandler(player, item) {
item.kill();
if (item.key === 'coin') {
currentScore = currentScore + 10;
} else if (item.key === 'poison') {
currentScore = currentScore - 25;
} else if (item.key === 'star') {
currentScore = currentScore + 25;
}
if (currentScore === winningScore) {
createBadge();
}
}
Unit #!

Michael Hulet
47,906 PointsHmm, it's still not really clear from that code what kill
does. Which video are you following?
1 Answer

usha addala
Full Stack JavaScript Techdegree Student 3,403 PointsI'am looking at the game.js file unit #1
Michael Hulet
47,906 PointsMichael Hulet
47,906 PointsIt looks like this question didn't get linked to a video/quiz/challenge properly, so it's really difficult to know what
item
is. Can you post the code that defines it?