It's the test task on the job.
A farmer has rabbits. Each rabbit is its weight. When the time comes, he kills them function cut(rabbit).
You must write a function of cut so that it had the appearance of
cut(rabbit1)(rabbit2)...(rabbitN) and deduced the total mass and the number of rabbits.
For example:
var rabbit1 = {weight: 5},
rabbit2 = {weight: 4};
console.log(cut(rabbit1)(rabbit2));
In the console we will see "9 kg of rabbits or 2 pieces".
JSFiddle - https://jsfiddle.net/sjao7ut8/
How I can write function cut()?
console.log(cut(rabbit1)(rabbit2)());