Problems!!!! & solutions

Please add any additional solutions separately to show alternate ways of solving!!
Problems
1
Search
Title & WITH WHO?
Problems
Problem info
Solution 1
Solution 1 Feedback & BY WHO?
Solution 2
Solution 2 Feedback
Solution 3
Solution 3 Feedback
Solution 4
Solution 4 Feedback
1
KATA Multiples of 3 or 5
With Kim
Screenshot 2022-01-17 at 14.13.54.png
My attempt started with:
function solution(number){
let multiplesSum = 0;
if (number < 0 ) {
return multiplesSum;
} else for (let i = 0; i < number; i++) {
(i % 3 === 0 && i % 5 === 0 || i % 3 === 0 && i % 5 !== 0 || i % 3 !== 0 && i % 5 === 0) {
return multiplesSum += i
}
return multiplesSum;
}
}
grapefruit example.jpg
Untitled_Artwork 21.png
what?
2
KATA Persistent Buggar
with Kim
Screenshot 2022-01-17 at 14.16.10.png
Screenshot 2022-01-17 at 14.16.32.png
Screenshot 2022-01-17 at 14.16.22.png
HAHAHHAHAHHAHHAHAH wtf am I doing ughhh:
function persistence(num) {
let firstP = 0;
let secondP = 0;
let thirdP = 0;
let fourthP = 0;
if ( num.length === 1 ) {
return 0;
} else if ( num.length === 2 ) {
return firstP += num[0]*num[1]
} else if ( num.length === 3 ) {
return firstP += num[0]*num[1]*num[2]
} else if ( num.length === 4 ) {
return firstP += num[0]*num[1]*num[2]*num[3]
}
if ( firstP.length === 1 ) {
return 1;
} else if ( firstP.length === 2 ) {
secondP += firstP[0]*firstP[1]
} else if ( firstP.length === 3 ) {
secondP += firstP[0]*firstP[1]*firstP[2]
} else if ( firstP.length === 4 ) {
secondP += firstP[0]*firstP[1]*firstP[2]*firstP[3]
}
if ( secondP.length === 1 ) {
return 2;
} else if ( secondP.length === 2 ) {
thirdP += secondP[0]*secondP[1]
} else if ( secondP.length === 3 ) {
thirdP += secondP[0]*secondP[1]*secondP[2]
} else if ( secondP.length === 4 ) {
thirdP += secondP[0]*secondP[1]*secondP[2]*secondP[3]
}
if ( thirdP.length === 1 ) {
return 3;
} else if ( thirdP.length === 2 ) {
fourthP += thirdP[0]*thirdP[1]
} else if ( thirdP.length === 3 ) {
fourthP += thirdP[0]*thirdP[1]*thirdP[2]
} else if ( thirdP.length === 4 ) {
fourthP += thirdP[0]*thirdP[1]*thirdP[2]*thirdP[3]
}
if ( fourthP.length === 1 ) {
return 4;
}
}
3
4
There are no rows in this table

Want to print your doc?
This is not the way.
Try clicking the ⋯ next to your doc name or using a keyboard shortcut (
CtrlP
) instead.