Skip to content

Commit caa28ff

Browse files
committed
Finished array-methods.js. Taking my time and exploring multiple options.
1 parent f8110d2 commit caa28ff

3 files changed

Lines changed: 20 additions & 3 deletions

File tree

‎assignments/array-methods.js‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,4 +148,9 @@ function lgDonation(donation){
148148

149149

150150
// Problem 3
151-
//
151+
// Sort alphabetically for the start order.
152+
let company = runners.map(function(array) {
153+
return array.company_name;
154+
});
155+
156+
console.log(company.sort());

‎assignments/closure.js‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
// Write a simple closure of your own creation. Keep it simple!
33

44

5+
56
/* STRETCH PROBLEMS, Do not attempt until you have completed all previous tasks for today's project files */
67

78

@@ -19,3 +20,14 @@ const counterFactory = () => {
1920
// `increment` should increment a counter variable in closure scope and return it.
2021
// `decrement` should decrement the counter variable and return it.
2122
};
23+
24+
function showName (firstName, lastName) {

25+
var nameIntro = "Your name is ";
26+
// this inner function has access to the outer function's variables, including the parameter
27+
function makeFullName () {

28+
return nameIntro + firstName + " " + lastName;

29+
}
30+
return makeFullName ();

31+
}

32+
33+
showName ("Michael", "Jackson"); // Your name is Michael Jackson


‎assignments/index.html‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@
77

88
<title>JS II</title>
99

10-
<script src="array-methods.js"></script>
10+
<!-- <script src="array-methods.js"></script> -->
1111
<!-- <script src="callbacks.js"></script> -->
12-
<!-- <script src="closure.js"></script> -->
12+
<script src="closure.js"></script>
1313
<!-- <script src="stretch-function-conversion.js"></script> -->
1414
</head>
1515

0 commit comments

Comments
 (0)