Skip to content

JAVASCRIPT II - #1

Open
Dannyyzz wants to merge 4 commits into
masterfrom
daniel-viera
Open

JAVASCRIPT II#1
Dannyyzz wants to merge 4 commits into
masterfrom
daniel-viera

Conversation

@Dannyyzz

Copy link
Copy Markdown
Owner

No description provided.

@Dannyyzz
Dannyyzz requested a review from LaikaFusion April 21, 2019 23:20

@LaikaFusion LaikaFusion left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants