scrimba
Solution for day 1 of #javascriptmas
Go Pro!Bootcamp

Bootcamp

Study group

Collaborate with peers in your dedicated #study-group channel.

Code reviews

Submit projects for review using the /review command in your #code-reviews channel

Solution for day 1 of #javascriptmas
AboutCommentsNotes
Solution for day 1 of #javascriptmas
Expand for more info
main.js
run
preview
console
function candies(children, candy) {
// write code here.
const totalEach = Math.floor(candy/children);
const totalEaten = totalEach*children;
return totalEaten;
}



/**
* Test Suite
*/
describe('candies()', () => {
it('returns ammount of total equal candy to be eaten', () => {
// arrange
const children = 3;
const candy = 10;

// act
const result = candies(children, candy);

// log
console.log("result: ", result);

// assert
expect(result).toBe(9);
});
});
Console
"result: "
,
9
,
/index.html
LIVE