- Joined
- Jun 8, 2023
- Messages
- 2
- Reaction score
- 1
i need some help...
function concatenator(a , b) {
return "a and b must be numbers or strings";
}
// CHALLENGE
// concaten ator takes two arguments a and b:
// * If a and b are strings, return them concatenated
// * If a and b are numbers, return their sum
// Edge cases:
// * Both a and b must be of the same type (use typeof). Else return the string "a and b must be of the same type"
// * a and b can be either numbers or strings. Else return "a and b must be numbers or strings"
<!-- my test pages returns this with what code i have in there already. -->
CHALLENGE 1 - concatenator
index.html:221 Test 1 fails: concatenator(1,"a") should return "a and b must be of the same type" but returns "a and b must be numbers or strings"
index.html:221 Test 2 fails: concatenator("a",1) should return "a and b must be of the same type" but returns "a and b must be numbers or strings"
index.html:220 Test 3 passes
index.html:220 Test 4 passes
index.html:221 Test 5 fails: concatenator("toyota"," camry") should return "toyota camry" but returns "a and b must be numbers or strings"
index.html:221 Test 6 fails: concatenator(3,5) should return 8 but returns "a and b must be numbers or strings"
index.html:221 Test 7 fails: concatenator(3,-5) should return -2 but returns "a and b must be numbers or strings"
function concatenator(a , b) {
return "a and b must be numbers or strings";
}
// CHALLENGE
// concaten ator takes two arguments a and b:
// * If a and b are strings, return them concatenated
// * If a and b are numbers, return their sum
// Edge cases:
// * Both a and b must be of the same type (use typeof). Else return the string "a and b must be of the same type"
// * a and b can be either numbers or strings. Else return "a and b must be numbers or strings"
<!-- my test pages returns this with what code i have in there already. -->
CHALLENGE 1 - concatenator
index.html:221 Test 1 fails: concatenator(1,"a") should return "a and b must be of the same type" but returns "a and b must be numbers or strings"
index.html:221 Test 2 fails: concatenator("a",1) should return "a and b must be of the same type" but returns "a and b must be numbers or strings"
index.html:220 Test 3 passes
index.html:220 Test 4 passes
index.html:221 Test 5 fails: concatenator("toyota"," camry") should return "toyota camry" but returns "a and b must be numbers or strings"
index.html:221 Test 6 fails: concatenator(3,5) should return 8 but returns "a and b must be numbers or strings"
index.html:221 Test 7 fails: concatenator(3,-5) should return -2 but returns "a and b must be numbers or strings"