This repository was archived by the owner on Jan 14, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 477
Expand file tree
/
Copy path3-function-output.js
More file actions
42 lines (30 loc) · 1.32 KB
/
3-function-output.js
File metadata and controls
42 lines (30 loc) · 1.32 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
// Add comments to explain what this function does. You're meant to use Google!
function getRandomNumber() {
return Math.random() * 10;
}
//Math.random() returns a random number between 0 (inclusive), and 1 (exclusive)
// Add comments to explain what this function does. You're meant to use Google!
function combine2Words(word1, word2) {
return word1.concat(word2);
}
//The CONCAT function combines the text from multiple ranges and/or strings.
function concatenate(firstWord, secondWord, thirdWord) {
return firstWord + " " + secondWord + " " + thirdWord;
}
/*
===================================================
======= TESTS - DO NOT MODIFY BELOW THIS LINE =====
There are some Tests in this file that will help you work out if your code is working.
To run the tests for just this one file, type `npm test -- --testPathPattern 3-function-output` into your terminal
(Reminder: You must have run `npm install` one time before this will work!)
==================================
*/
test("concatenate example #1", () => {
expect(concatenate("code", "your", "future")).toEqual("code your future");
});
test("concatenate example #2", () => {
expect(concatenate("I", "like", "pizza")).toEqual("I like pizza");
});
test("concatenate doesn't only accept strings", () => {
expect(concatenate("I", "am", 13)).toEqual("I am 13");
});