Skip to content

Commit 64ac9c8

Browse files
committed
WIP - Creates first assignment, implements steps in readme
0 parents  commit 64ac9c8

File tree

2 files changed

+53
-0
lines changed

2 files changed

+53
-0
lines changed

README.md

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# JavaScript - I
2+
3+
* The point of these assignments is to take your knowledge of JavaScript and start putting into practice the principles learned throughout JavaScript I.
4+
5+
## Assignment Description
6+
7+
* Fork/Clone this repository.
8+
* Complete all the exercises as described inside each assignment file.
9+
* Use `console.log()` statements to check to see if your code does what it is supposed to do.
10+
* To test your `console` statements you can either run `node /assignments/<fileName>` and see what prints in your terminal. You can also use an online REPL like `JSBin`, `REPL.it`, `JSFiddle` or even your `Chrome developer console`.
11+
* Once you finish the exercises in a file, commit your code, and push it to your fork.
12+
* Once your assignments are logging out the expected output, and you've
13+
14+
### Callbacks
15+
16+
* In this file you'll be receiving a lot of training on how to use callbacks to pass around data.
17+
* Write out each function using the `ES5` `function` keyword syntax.
18+
* Remember that a callback function is simply a function that is being passed around to other functions.
19+
* **Stretch Problem** After you're done with all of the functions, go ahead and re-factor all of them to use `ES6` `Arrow Functions`

assignments/callbacks.js

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
const items = ['Pencil', 'Notebook', 'yo-yo', 'Gum'];
2+
3+
function firstItem(arr, cb) {
4+
// firstItem passes the first item of the given array to the callback function.
5+
}
6+
7+
function getLength(arr, cb) {
8+
// getLength passes the length of the array into the callback.
9+
}
10+
11+
function last(arr, cb) {
12+
// last passes the last item of the array into the callback.
13+
}
14+
15+
function sumNums(x, y, cb) {
16+
// sumNums adds two numbers (x, y) and passes the result to the callback.
17+
}
18+
19+
function multiplyNums(x, y, cb) {
20+
// multiplyNums multiplies two numbers and passes the result to the callback.
21+
}
22+
23+
function contains(item, list, cb) {
24+
// contains checks if an item is present inside of the given array/list.
25+
// Pass true to the callback if it is, otherwise pass false.
26+
}
27+
28+
/* STRETCH PROBLEM */
29+
30+
function removeDuplicates(array, cb) {
31+
// removeDuplicates removes all duplicate values from the given array.
32+
// Pass the duplicate free array to the callback function.
33+
// Do not mutate the original array.
34+
}

0 commit comments

Comments
 (0)