forked from sarabeth-russert/forkDemo
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfunctions.js
More file actions
47 lines (33 loc) · 1.17 KB
/
functions.js
File metadata and controls
47 lines (33 loc) · 1.17 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
43
44
45
46
47
'use strict';
// -------- Challenge 1 -------- //
// put this code block into a function, add a return statement, and call the function
function myBestPet(){
let bestPet = 'dog';
let petName = 'indiana';
let petString = 'The best pet is a ' + bestPet + ' named ' + petName;
return petString;
}
myBestPet();
// return the petString here
// call your function here
// yea
// -------- Challenge 2 -------- //
// put this code block into a function, add a return statement, and call the function
function anotherGreatPet(){
let anotherGreatPet = 'bunny';
let anotherPetName = 'opal';
let anotherPetString = 'The best pet is a ' + anotherGreatPet + ' named ' + anotherPetName;
// return the anotherPetString here
return anotherGreatPetString;
}
anotherGreatPet()
// -------- Challenge 3 -------- //
// is there another way to write this function so we can use one function for different pets?
let anotherGreatPet = 'bunny';
let anotherPetName = 'opal';
function greatPetB(anotherGreatPet, anotherPetName) {
let anotherPetString = 'The best pet is a ' + anotherGreatPet + ' named ' + anotherPetName;
return anotherPetString;
}
// return the anotherPetString here
greatPetB();