Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
188 commits
Select commit Hold shift + click to select a range
3f20c0c
JS-I&II Push 1
Mar 21, 2018
64ac9c8
WIP - Creates first assignment, implements steps in readme
ryan-hamblin Apr 9, 2018
5d0f761
Updates to JS Fundamentals
BigKnell Apr 14, 2018
7cbcb08
Updates made to arrays.js instructions
BigKnell Apr 14, 2018
c7d9ba4
Stretch Task header
mixelpixel Apr 15, 2018
7a6f473
minor copy edits
mixelpixel Apr 16, 2018
5f7204c
minor
mixelpixel Apr 16, 2018
ac6fdec
Updating arrays instruction
BigKnell Apr 16, 2018
12f6c43
Merge branch 'master' of https://github.com/LambdaSchool/JavaScript-I
BigKnell Apr 16, 2018
5551e4d
Merge pull request #2 from LambdaSchool/mixelpixel-patch-2
BigKnell Apr 16, 2018
335d554
Merge pull request #1 from LambdaSchool/mixelpixel-patch-1
BigKnell Apr 16, 2018
8e18a1a
updates to readme
BigKnell Aug 6, 2018
1abe623
Merge branch 'master' of https://github.com/LambdaSchool/JavaScript-I
BigKnell Aug 6, 2018
31b6ef9
updates to readme
BigKnell Aug 10, 2018
24af335
adding arrow function stretch
BigKnell Sep 10, 2018
05715f9
update to file path
BigKnell Sep 10, 2018
af193aa
adding index.html file to JS I
BigKnell Oct 15, 2018
e6c7c92
Forgot to commit previously
kkhaag Oct 25, 2018
8fcec1e
Initial commit
Oct 2, 2017
52fb8df
Fixed linting errors
Oct 2, 2017
2feb65c
Updated eslint and instructions in Array.js
Oct 2, 2017
2b932c9
Updated instructions
Oct 2, 2017
562b033
Modified eslint rules
Oct 2, 2017
d07f981
marked problems as EC
Oct 2, 2017
66e6665
Updated instructions spacing
Oct 2, 2017
d0c2428
Updated instructions
Oct 2, 2017
1368e2a
typographical changes
Oct 2, 2017
596ac7a
Updated reduce instructions
Oct 2, 2017
64a1d1a
Re factored callbacks to fit the testing suite. started tests
ryan-hamblin Nov 3, 2017
0eb2079
testing up and running for callbacks
ryan-hamblin Nov 4, 2017
35a3e9c
EC to STretch Problem
ryan-hamblin Nov 4, 2017
b736828
Update README.md
Dec 4, 2017
1e4bd03
fixed some linting rules and updated some instructions. More to come.
ryan-hamblin Feb 13, 2018
8b67e55
added descrition to ReadMe
ryan-hamblin Feb 13, 2018
9474129
removed vars
ryan-hamblin Feb 20, 2018
1f11634
reformat readme
ryan-hamblin Feb 20, 2018
2042266
fixed some instructions
ryan-hamblin Feb 20, 2018
8431210
map test was testing each not map
ryan-hamblin Mar 16, 2018
62f362b
fixed for new babel preset and yarn
ryan-hamblin Mar 16, 2018
dc1da47
JS-I&II Push 1
Mar 21, 2018
30b3bda
Forgot to commit previously
kkhaag Oct 25, 2018
5508f10
Rebasing the repo
kkhaag Oct 25, 2018
5f0a836
Initial commit
Oct 2, 2017
ba0f29a
Fixed linting errors
Oct 2, 2017
40f98bd
Updated eslint and instructions in Array.js
Oct 2, 2017
eefb0be
Updated instructions
Oct 2, 2017
95aeb7a
Modified eslint rules
Oct 2, 2017
39f89f0
marked problems as EC
Oct 2, 2017
062ef52
Updated instructions spacing
Oct 2, 2017
ca7edf1
Updated instructions
Oct 2, 2017
2bf1668
typographical changes
Oct 2, 2017
63943d4
Updated reduce instructions
Oct 2, 2017
af37541
Re factored callbacks to fit the testing suite. started tests
ryan-hamblin Nov 3, 2017
6b9f397
testing up and running for callbacks
ryan-hamblin Nov 4, 2017
ae42472
EC to STretch Problem
ryan-hamblin Nov 4, 2017
af5963b
Update README.md
Dec 4, 2017
d926cc8
fixed some linting rules and updated some instructions. More to come.
ryan-hamblin Feb 13, 2018
ed3a5eb
added descrition to ReadMe
ryan-hamblin Feb 13, 2018
a99bb2c
removed vars
ryan-hamblin Feb 20, 2018
4f31478
reformat readme
ryan-hamblin Feb 20, 2018
1f151d1
fixed some instructions
ryan-hamblin Feb 20, 2018
09ba0eb
map test was testing each not map
ryan-hamblin Mar 16, 2018
991b887
fixed for new babel preset and yarn
ryan-hamblin Mar 16, 2018
944cf23
JS-I&II Push 1
Mar 21, 2018
a4f4485
Forgot to commit previously
kkhaag Oct 25, 2018
20e45cc
Initial commit
Oct 2, 2017
db614cf
Fixed linting errors
Oct 2, 2017
f8bb8f5
Updated eslint and instructions in Array.js
Oct 2, 2017
0733587
Updated instructions
Oct 2, 2017
2e06ff0
Modified eslint rules
Oct 2, 2017
7e42716
marked problems as EC
Oct 2, 2017
895296b
Updated instructions spacing
Oct 2, 2017
4d8ef58
Updated instructions
Oct 2, 2017
4e2a0be
typographical changes
Oct 2, 2017
51f8fc1
Updated reduce instructions
Oct 2, 2017
7dd5187
Re factored callbacks to fit the testing suite. started tests
ryan-hamblin Nov 3, 2017
07c2874
testing up and running for callbacks
ryan-hamblin Nov 4, 2017
1d2c2ba
EC to STretch Problem
ryan-hamblin Nov 4, 2017
9d8a490
Update README.md
Dec 4, 2017
9ac6e65
fixed some linting rules and updated some instructions. More to come.
ryan-hamblin Feb 13, 2018
cb51a92
added descrition to ReadMe
ryan-hamblin Feb 13, 2018
d465365
removed vars
ryan-hamblin Feb 20, 2018
d9e0e21
reformat readme
ryan-hamblin Feb 20, 2018
3063d8b
fixed some instructions
ryan-hamblin Feb 20, 2018
f855cc6
map test was testing each not map
ryan-hamblin Mar 16, 2018
eb7dd64
fixed for new babel preset and yarn
ryan-hamblin Mar 16, 2018
b3af50e
JS-I&II Push 1
Mar 21, 2018
5a3ba70
Forgot to commit previously
kkhaag Oct 25, 2018
c6990bc
rebase and merge
kkhaag Oct 25, 2018
0dd77c5
Deleted all. Rebasing issues
kkhaag Oct 25, 2018
18e7f00
Initial commit
Oct 2, 2017
c0cf386
Fixed linting errors
Oct 2, 2017
04f21c9
Updated eslint and instructions in Array.js
Oct 2, 2017
a7a9330
Updated instructions
Oct 2, 2017
018be3d
Modified eslint rules
Oct 2, 2017
cd5d9a6
marked problems as EC
Oct 2, 2017
8d275b4
Updated instructions spacing
Oct 2, 2017
fdf9a22
Updated instructions
Oct 2, 2017
f1f2bb0
typographical changes
Oct 2, 2017
e0cfdf2
Updated reduce instructions
Oct 2, 2017
6ccb06e
Re factored callbacks to fit the testing suite. started tests
ryan-hamblin Nov 3, 2017
7f59eaf
testing up and running for callbacks
ryan-hamblin Nov 4, 2017
6d09c88
EC to STretch Problem
ryan-hamblin Nov 4, 2017
ff44f23
Update README.md
Dec 4, 2017
350129d
fixed some linting rules and updated some instructions. More to come.
ryan-hamblin Feb 13, 2018
0fefc09
added descrition to ReadMe
ryan-hamblin Feb 13, 2018
3110982
removed vars
ryan-hamblin Feb 20, 2018
3e3e6c6
reformat readme
ryan-hamblin Feb 20, 2018
31658bf
fixed some instructions
ryan-hamblin Feb 20, 2018
20f45e6
map test was testing each not map
ryan-hamblin Mar 16, 2018
8b343f3
fixed for new babel preset and yarn
ryan-hamblin Mar 16, 2018
c95ce83
JS-I&II Push 1
Mar 21, 2018
b0297a2
Forgot to commit previously
kkhaag Oct 25, 2018
b22bacc
Initial commit
Oct 2, 2017
4da6caf
Fixed linting errors
Oct 2, 2017
ad686e6
Updated eslint and instructions in Array.js
Oct 2, 2017
d32e97d
Updated instructions
Oct 2, 2017
b59d1df
Modified eslint rules
Oct 2, 2017
e610ac9
marked problems as EC
Oct 2, 2017
bad20a7
Updated instructions spacing
Oct 2, 2017
aba4299
Updated instructions
Oct 2, 2017
e46e99a
typographical changes
Oct 2, 2017
00edcc5
Updated reduce instructions
Oct 2, 2017
d07f6d3
Re factored callbacks to fit the testing suite. started tests
ryan-hamblin Nov 3, 2017
1ba4583
testing up and running for callbacks
ryan-hamblin Nov 4, 2017
427e1b6
EC to STretch Problem
ryan-hamblin Nov 4, 2017
ef0b09a
Update README.md
Dec 4, 2017
58cae01
fixed some linting rules and updated some instructions. More to come.
ryan-hamblin Feb 13, 2018
466302e
added descrition to ReadMe
ryan-hamblin Feb 13, 2018
a3c768a
removed vars
ryan-hamblin Feb 20, 2018
efcdac8
reformat readme
ryan-hamblin Feb 20, 2018
9480e26
fixed some instructions
ryan-hamblin Feb 20, 2018
37d234b
map test was testing each not map
ryan-hamblin Mar 16, 2018
d2bb122
fixed for new babel preset and yarn
ryan-hamblin Mar 16, 2018
87ff57e
JS-I&II Push 1
Mar 21, 2018
82c5981
Forgot to commit previously
kkhaag Oct 25, 2018
09d94b8
Initial commit
Oct 2, 2017
4052579
Fixed linting errors
Oct 2, 2017
60572c0
Updated eslint and instructions in Array.js
Oct 2, 2017
79861c7
Updated instructions
Oct 2, 2017
b0a40a1
Modified eslint rules
Oct 2, 2017
7f28a68
marked problems as EC
Oct 2, 2017
7325c46
Updated instructions spacing
Oct 2, 2017
bdc1b86
Updated instructions
Oct 2, 2017
2632a75
typographical changes
Oct 2, 2017
20f83b7
Updated reduce instructions
Oct 2, 2017
7e06b72
Re factored callbacks to fit the testing suite. started tests
ryan-hamblin Nov 3, 2017
3ca6440
testing up and running for callbacks
ryan-hamblin Nov 4, 2017
bbae680
EC to STretch Problem
ryan-hamblin Nov 4, 2017
aab1b9c
Update README.md
Dec 4, 2017
382a7a3
fixed some linting rules and updated some instructions. More to come.
ryan-hamblin Feb 13, 2018
5dcb88a
added descrition to ReadMe
ryan-hamblin Feb 13, 2018
a4718d3
removed vars
ryan-hamblin Feb 20, 2018
2d89367
reformat readme
ryan-hamblin Feb 20, 2018
1f1f453
fixed some instructions
ryan-hamblin Feb 20, 2018
e7e8e0f
map test was testing each not map
ryan-hamblin Mar 16, 2018
755d3cb
fixed for new babel preset and yarn
ryan-hamblin Mar 16, 2018
328def3
JS-I&II Push 1
Mar 21, 2018
9f5f6e2
Forgot to commit previously
kkhaag Oct 25, 2018
35fdef8
Work
kkhaag Oct 25, 2018
199d144
Fixed linting errors
Oct 2, 2017
6f3bd2d
Updated eslint and instructions in Array.js
Oct 2, 2017
58c2e8d
Updated instructions
Oct 2, 2017
0bc468d
Modified eslint rules
Oct 2, 2017
84eb171
marked problems as EC
Oct 2, 2017
924ac7f
Updated instructions spacing
Oct 2, 2017
a0dd388
Updated instructions
Oct 2, 2017
8e866d0
typographical changes
Oct 2, 2017
e2dc7e7
Updated reduce instructions
Oct 2, 2017
86b4dbe
Re factored callbacks to fit the testing suite. started tests
ryan-hamblin Nov 3, 2017
f2b3b75
testing up and running for callbacks
ryan-hamblin Nov 4, 2017
8ec6ea1
EC to STretch Problem
ryan-hamblin Nov 4, 2017
160e961
Update README.md
Dec 4, 2017
3a3144a
fixed some linting rules and updated some instructions. More to come.
ryan-hamblin Feb 13, 2018
e56d68a
added descrition to ReadMe
ryan-hamblin Feb 13, 2018
d9b9b01
removed vars
ryan-hamblin Feb 20, 2018
4583359
reformat readme
ryan-hamblin Feb 20, 2018
81e49bc
fixed some instructions
ryan-hamblin Feb 20, 2018
ac22c62
map test was testing each not map
ryan-hamblin Mar 16, 2018
876be8c
fixed for new babel preset and yarn
ryan-hamblin Mar 16, 2018
4eb2194
JS-I&II Push 1
Mar 21, 2018
dbbd75c
Forgot to commit previously
kkhaag Oct 25, 2018
13386a8
Deleted all. Rebasing issues
kkhaag Oct 25, 2018
4703f23
I need this to complete merge
kkhaag Oct 25, 2018
31249d4
readded
kkhaag Oct 25, 2018
7a1fb3a
test
kkhaag Oct 26, 2018
75b6be3
wotking now?
kkhaag Oct 26, 2018
325ff45
Add files via upload
kkhaag Oct 26, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions src/arrays.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,33 +14,63 @@ const each = (elements, cb) => {
// This only needs to work with arrays.
// You should also pass the index into `cb` as the second argument
// based off http://underscorejs.org/#each

for (let i = 0; i < elements.length; i++) {
cb(elements[i], i);
}
};


const map = (elements, cb) => {
// Do NOT use .map, to complete this function.
// Produces a new array of values by mapping each value in list through a transformation function (iteratee).
// Return the new array.
const myMap = [];
for (let i = 0; i < elements.length; i++) {
myMap.push(cb(elements[i]));
}
return myMap;
};


const reduce = (elements, cb, startingValue) => {
// Do NOT use .reduce, to complete this function.
// Combine all elements into a single value going from left to right.
// Elements will be passed one by one into `cb` along with the `startingValue`.
// `startingValue` should be the first argument passed to `cb` and the array element should be the second argument.
// `startingValue` is the starting value. If `startingValue` is undefined then make `elements[0]` the initial value.
if (startingValue === undefined) {
startingValue = elements[0];
}
for (let i = startingValue; i < elements.length; i++) {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let i = startingValue

Starting value can be anything a number, string, object attempting to set i (the index) to starting value is nonsensical. We went over this briefly last night where i should be dynamic dependent on if startingValue is undefined.

startingValue = cb(startingValue, elements[i]);
}
return startingValue;
};

const find = (elements, cb) => {
// Do NOT use .includes, to complete this function.
// Look through each value in `elements` and pass each element to `cb`.
// If `cb` returns `true` then return that element.
// Return `undefined` if no elements pass the truth test.
for (let i = 0; i < elements.length; i++) {
if (cb(elements[i]) === true) {
return elements[i];
}
} return undefined;
};


const filter = (elements, cb) => {
// Do NOT use .filter, to complete this function.
// Similar to `find` but you will return an array of all elements that passed the truth test
// Return an empty array if no elements pass the truth test
const newFilter = [];
for (let i = 0; i < elements.length; i++) {
if (cb(elements[i]) === true) {
newFilter.push(elements[i]);
}
} return newFilter;
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While this is fine, it's generally suggested that you separate these. It gets hard to debug if you've forgotten something small in this scenario.

}
return newFilter;

};

/* STRETCH PROBLEM */
Expand Down
8 changes: 8 additions & 0 deletions src/callbacks.js
Original file line number Diff line number Diff line change
@@ -1,26 +1,34 @@
const firstItem = (arr, cb) => {
// firstItem passes the first item of the given array to the callback function.
return cb(arr[0]);
};

const getLength = (arr, cb) => {
// getLength passes the length of the array into the callback.
return cb(arr.length);
};

const last = (arr, cb) => {
// last passes the last item of the array into the callback.
return cb(arr[arr.length - 1]);
};

const sumNums = (x, y, cb) => {
// sumNums adds two numbers (x, y) and passes the result to the callback.
return cb(x + y);
};

const multiplyNums = (x, y, cb) => {
// multiplyNums multiplies two numbers and passes the result to the callback.
return cb(x * y);
};

const contains = (item, list, cb) => {
// contains checks if an item is present inside of the given array/list.
// Pass true to the callback if it is, otherwise pass false.
for (let i = 0; i < list.length; i++) {
cb(item === list[i]);
}
};

/* STRETCH PROBLEM */
Expand Down
7 changes: 7 additions & 0 deletions src/objects.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,24 @@ const keys = (obj) => {
// Retrieve all the names of the object's properties.
// Return the keys as strings in an array.
// Based on http://underscorejs.org/#keys
return Object.keys(obj);
};

const values = (obj) => {
// Return all of the values of the object's own properties.
// Ignore functions
// http://underscorejs.org/#values
return Object.values(obj);
};

const mapObject = (obj, cb) => {
// Like map for arrays, but for objects. Transform the value of each property in turn.
// http://underscorejs.org/#mapObject
const myMap = {};
for (let i = 0; i < obj.length; i++) {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While you could add a property of length on obj obj doesn't inherently have a length. You can access it's keys; however, to get a length.

myMap.push(obj[i]);
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can't push into an object.

}
cb(myMap);
};

const pairs = (obj) => {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was pairs forgotten about?

Expand Down
Loading