JAVASCRIPT II - #1
Open
Dannyyzz wants to merge 4 commits into
Open
Conversation
LaikaFusion
approved these changes
Apr 23, 2019
LaikaFusion
left a comment
Collaborator
There was a problem hiding this comment.
array-methods.js
They were looking for just the first and last in a string not an object, but it's pretty close
Callbacks.js
You wrote the functions but missed the invocations.
Remember .pop() is destructive and permanently alters the arrays. This will work but not repeatedly.
Your contains function needs some breaks around the if and else to help destinguish them. The result should be declared before the if statement, and in fact outside the for loop.
what you wanted to make here was:
function 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.
let result = false;
for(let i = 0; i < list.length; i++) {
if(list[i] === item)
result = true;
}
cb(result);
}```
if you're trying to do it the way I think you are.
Closures = 😐 but not because you didn't successfully make one
Overall keep up the hardwork!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.