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) {
return Math.floor(candy/children) * children;
}



/**
* 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?spec=candies()%20returns%20ammount%20of%20total%20equal%20candy%20to%20be%20eaten
LIVE