@hitmikey you can also edit or delete your own posts, the ... at the right of the timestampyou can't use dot notation with prop either, in fact whenever you use a var as a property, use bracket notation

@umairbalani - I think most people are leary about just giving the answer because the struggling through it is important. But, I thin it's fair to say you'll need an if statement with a second option. So, like an if-else

function dropElements(arr, func) {
for (var i = 0; i < arr.length; i++) {
if (func(arr[i])) { //<—— onthis line will this execute this line if func(arr[i]) isfalseor only when it istrue?
return arr;
} arr.shift()
}
}

@guruice4 If "tracks" is non-existent before you update it, create an empty array before pushing a track to it.

@hitmikey change this: collection[id][prop][value] to this collection[id][prop]push(); to this push(value);collection.hasOwnProperty[id][prop][value]to this collection[id].hasOwnProperty(prop)man, you messed things up

@Vanhealen I checked ,you do need to do i-- when you shift because say you had 4 element, you're looping for the first time so i = 0, it's false so you remove it, now the next loop starts at i is equal to 1 but you need to check position 0 since it's a new value because you just removed the first element

@hrokr internet doesn't work like that, and you're not supposed to go search the solution either, in time they'll update it, in the meantime, we have to help the people who can't work it out themselves

@Chrono79 - I agree. But a) I had already spent hours on it with no success. So, seeing where I was wrong was needed. But b) the code they have up there is almost the same as mine. All other things I had tried also had not worked.

@Chrono79 - and i've don't these exercises -- with great difficulty -- before. So, since many people have had/are having the same problems it's really safe to say the problem isn't with them/us. It's something missing in the course. That's why I add to the issues page.

@hrokr I'm gonna explain one last time, they've added the case where an object hasn't the property tracks, the code in your screenshots is the solution to the challenge before thatIf there is a bug for the right code for the challenge with this case (that wasn't added today or yesterday, just days ago and people was passing this challenge) is another story

@Chrono79 I guess I should read all of the requirements in the challenge so that i can logically assemble the code better right? for example, i had nested if's when i could've had it simplified as in the solution i posted.

Rando quote machine... 1st time incorporating JS into codepen project. Doesn't do so great with responsiveness because of the background photo placement. Got the twitter window to pop up instead of opening new window, and implemented a facebook sharing feature but its kind of buggy in CodePen - highlight quote to share on FB - only works in debug mode. Also, going to attempt a 2nd version using an API, this version uses a stored array since I had a specific request to do Frank Zappa quotes! Any feedback appreciated! http://s.codepen.io/no_stack_dub_sack/debug/GqqKyQ

@hrokr in this challenge, it didn't really talk about using multi dimension arrays in a for loop, it just gives the example. some feedback i'd give is that i'd prefer to have a little more explanation so that i can retain the concept and apply it to a future challenge:

Algorithm Seek and Destroy

:triangular_flag_on_post: Remember to use Read-Search-Ask if you get stuck. Try to pair program :busts_in_silhouette: and write your own code :pencil:

:checkered_flag: Problem Explanation:

This problem is a bit tricky because you have to familiarize yourself with Arguments, as you will have to work with two or more but on the script you only see two. Many people hardcode this program for three arguments. You will remove any number from the first argument that is the same as any other other arguments.

Hi. Do you all know how many challenges are required to be able to maintain a streak? I have been trying to do it every day for the past week yesterday I completed 4. Today I completed 1 and today I noticed it reads 1 day streak???

@caep2015 - I think that if you get one brownie point or complete one challenge in a day, it counts toward to streak? It seems like that to me, although I don't have an easy time remembering the numbers, but I'm on a 174 day streak, so it's been going for a while. I usually get more than one BP a day from helping people - but completing a challenge for the first time (a lesson, or whatever they are called) also gives you a point. It shows that you are active for that day.

@Code-Eric - you want to store the results in an array in some manner (just as you are reading them from an array) so that you have a complete set of the words to re-build the sentence.

I'm trying. It definitely keeps me coming back so that I don't loose my "streak". Today was a big day so I kind of wanted to call it a night after 1 challenge so I checked the streak and was dismayed at the streak = 1 day. Was wondering wondering if I should keep going for it to continue. I have been on here every day for the past 5 days so today would have been day 5 (not 1)....

@caep2015 - if you want to do another quick item that should get you a point, look at the bottom of the map for the videos on Computer Basics or Javascript L ingo - they are short and helpful videos with a few questions to answer. Give that a try!

@caep2015 - I'll give you a thanks for the interaction - always good to get some feedback!

QUESTION:: Im trying to write something that looks at the value of TIll and counts it to see if the till has sufficient funds to cover change...How do i access the numbers so I can count it or is it possible?

@micahbales - it is probably some kind of instability in using the setTimeout (not sure if that's the correct term, but that's the idea) - I think that things can affect the operation of the setTimeout for triggering, if the CPU is busy or something? I kind of read through the docs one time and remembered something like that?

@micahbales = there is a description on this page https://developer.mozilla.org/en-US/docs/Web/API/WindowTimers/setTimeout "Reasons for delays longer than specified" that talks about a number of different issues. Not sure if there is a real problem in this way with your app, or if there is a solution? Maybe not using setTimeout would be a solution? I don't really have the understanding of how your code works, but it seems like there are a lot of setTimeout calls - I wouldn't be surprised at some bad interactions there? Again, without really being an expert, it's just a gut feeling...

@gkcodeman - it seems to work, in general. There are times when it does things that violate the principle of least astonishment (as a former co-worker of mine used to say) - like when you get into editing a post and you are not in chat mode, it still posts when you hit enter, etc... And like @moigithub said - there are the two modes that give different types of interaction.

@micahbales - good question. I haven't done this challenge yet - I just started tinkering with setting up the display, because I don't know how to do that. But I was thinking that using setInterrupt and having some type of "event queue" would be a more consistent way of controlling the behavior? That's just another gut feeling - I'll see what happens when I get around to coding on this one! :)

@CurlyWS - it is a function argument - in my editor for this one, I have this: function findElement(arr, func) {, so func will be the value of the function that you pass in, and you just use that as the callback, instead of writing Array.filter( function( value ) { whatever you are doing here; });

@JKilk - I don't know if you can browser other's solutions - you might be able to accses their freecodecamp.com page. If you want to look at some recommended solutions, check the wiki for that challenge - they usually provide hints and "spoilers" with the best solutions.

@PeRoXiiDe - sometimes it does get to be a little hard to see what's going on. It is helpful to study the test cases and results - they tell you things that you might not have gotten from the first reading through the instructions, I've found that to be very helpful for some of the challenges where I just was not getting it... :)

@ConnHurr because if Object.keys(source) does not exist then it will return undefined.so for your function call source is last:"Capulet". If capulet is not found then it will throw undefinedI assume it is something to do with thatconsole.log each stage so you can identify the problem

@CurlyWS - if you read the description of the filter method, you'll see that it always passes some parameters when it calls the callback. The first one (if I remember correctly) is the number or the array element that you are work on - the value of that array element.

@jaywikid yes, so why did you said this: Howdo I get a - var to read out as NaN in this equation?I think I get it now, look the square root of a number less than 0 gives you NaNSo you have to catch a or b less than 0 before that calculation and return undefinedyou have to write an if with 2 conditions joined with a logical operator

@CurlyWS - I think that sometimes the "elegant" solutions are much slower than the straightforward for loop solutions - at least I saw someone posting something about that in some forum or text book. But I think that the statement was made that you shouldn't worry about speed unless you need to - I'm sure that if you're processing a million records or something, it's significant.

var newStr = "This is a " + myNoun + "about the lorem and the ipsum. They were "+ myAdjective +"Travelers of time and space. However the lorem " + myVerb +"too fast for the Ipsum and left the ipsum behind. So the ipsum had to catch up " + myAdverb +"in order to keep up with the Lorem.";

am I supposed to break it into several smaller strings because I tried that first

function wordBlanks(myNoun, myAdjective, myVerb, myAdverb) { var result = ""; // Your code below this linevar result = "This is a " + myNoun + "about the lorem and the ipsum. They were "+ myAdjective +" travelers of time and space. However the lorem " + myVerb +" too fast for the Ipsum and left the ipsum behind. So the ipsum had to catch up " + myAdverb +"in order to keep up with the Lorem.";

// Your code below this linevar result = "This is a " + myNoun + "about the lorem and the ipsum. They were "+ myAdjective +" travelers of time and space. However the lorem " + myVerb +" too fast for the Ipsum and left the ipsum behind. So the ipsum had to catch up " + myAdverb +"in order to keep up with the Lorem.";

The toLowerCase() method to return the calling string value converted to lowercase.
The replace() method to return a new string with some or all matches of a pattern replaced by a replacement. We will use one of the RegExp we just created earlier.
The split() method splits a String object into an array of strings by separating the string into sub strings.
The reverse() method reverses an array in place. The first array element becomes the last and the last becomes the first.
The join() method joins all elements of an array into a string.

@kutsuya1 could be true. I changed it after your advice, to if (Boolean(arr[i])=='false') , and now the 'wrong'messages next to that line dissappeared. But the whole of the code still doesn' t work, unfortunately

@adityaparab no it just worked out that way, never know why last name is what it is, apparently when my parents came to the US, their relatives last name was Dui, so Dui became the last name of our family

@Redoras : If you're on your website (say example.com) and you want to get data from different website (Say facebook.com). Since example.com and facebook.com are two different domains, the browsers won't let you send ajax request (unless you disable web security). So to be able to send ajax request from one domain to the other (Technically termed as cross domain) we use a construct called padded JSON (JSONP).

I assume you were making ajax call from your site (codepen.io) to Wiki (wikipedia.org) so that is cross domain.

Challenge Make Object Properties Private

Objects have their own attributes, called properties_, and their own functions, called _methods.

You can use the this keyword to reference public properties and methods of the current objects. However, when You need to create private ones so they are not accessible from the outside of the object you just remove the keyword this from the object property or method declaration and declare it with var so that it is private outside its scope.

@CurlyWS In javascript, arrays are one type of object. Putting some value into an array element makes an array [value]. Putting that as an element to another array makes an array with an array as an element var arr=[[value]]. You could get that value by arr[0][0].

@CurlyWSvar arr=[["catpants"]]; creates an array and assigns it to variable arr. It is an object. You can get the primitive value (string) out by accessing the array var str = arr[0][0];. Variable str then has value "catpants".

@Mats05 See the album with id 5439. If you attempt collection[id][prop].push(value);, it won't work, because it has no "tracks" property defined. So you need to create it. read about .hasOwnProperty() if you are not familiar with that :)

@IonatanMocan Some records in collection don't have tracks property. It prop is tracks, make a check with .hasOwnProperty() and if it returns false, assign [value] to tracks property. If true, just push the value to tracks array.