Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
  • Aug 17 09:32
    User @bjorno43 unbanned @linkin-park
  • Jun 20 21:19
    @bjorno43 banned @shenerd140
  • Apr 25 17:13
    @mstellaluna banned @cmal
  • Jan 08 22:05
    @mstellaluna banned @dertiuss323
  • Nov 07 2018 04:42
    User @texas2010 unbanned @ows-ali
  • Nov 02 2018 16:25
    @texas2010 banned @ows-ali
  • Oct 12 2018 05:50
    @bjorno43 banned @NACH74
  • Oct 05 2018 23:02
    @mstellaluna banned @JomoPipi
  • Sep 16 2018 12:21
    @bjorno43 banned @yash-kedia
  • Sep 16 2018 12:16
    @bjorno43 banned @vnikifirov
  • Sep 05 2018 08:12
    User @bjorno43 unbanned @androuino
  • Sep 05 2018 07:38
    @bjorno43 banned @androuino
  • Aug 23 2018 16:57
    User @bjorno43 unbanned @rahuldkjain
  • Aug 23 2018 16:23
    @bjorno43 banned @rahuldkjain
  • Jul 29 2018 14:13
    User @bjorno43 unbanned @jkyereh
  • Jul 29 2018 01:00
    @bjorno43 banned @jkyereh
  • Jul 10 2018 22:09
    @bjorno43 banned @manafn
  • Jul 06 2018 15:20
    @texas2010 banned @imlegend19
  • Jul 03 2018 12:28
    @bjorno43 banned @vbvmatta
  • Jun 29 2018 13:54
    @bjorno43 banned @OGTechnoBoy
CamperBot
@camperbot
mathematicscoding sends brownie points to @skycoder01 :sparkles: :thumbsup: :sparkles:
:warning: mathematicscoding already gave skycoder01 points
Alex Kuczera
@akubie
Hi there! Has anyone done "Record Collection" in the front end javascript? I am having difficulty with updating the properties of arrays within objects, but I swear I am doing it right! :D
Ken Haduch
@khaduch
@ImAlexanderK - what does your code look like?
@ImAlexanderK - just post the function part of it, not the entire collection object, if you want to show what you have.
Alex Kuczera
@akubie
Ok I'll do my best to share it
I haven't shared a code block before haha
Ken Haduch
@khaduch
use the Markdown format - three backticks ```, then a new line, then your code, then a newline, then three ```
This message was deleted
Alex Kuczera
@akubie
```
// Only change code below this line
function updateRecords(id, prop, value) {  

   if (value === "") {
        delete collection[id][prop];
    } else if (collection[id].hasOwnProperty(prop)) {
        if (prop === "tracks") {
            collection[id][prop].push(value);
            } else {
                collection[id][prop] = value;
            }
    } else {
        if (prop === "tracks") {
          collection[id] = prop;
          collection[id][prop] = "value";
        } else {
          collection[id] = "prop";
          collection[id][prop] = "value";
        }
    }
  return collection;
}
sweet! Thanks @khaduch for your patience
CamperBot
@camperbot
imalexanderk sends brownie points to @khaduch :sparkles: :thumbsup: :sparkles:
:star2: 2700 | @khaduch |http://www.freecodecamp.com/khaduch
Alex Kuczera
@akubie
Now I understand that maybe my function is incorrect, but I am mostly concerned with the bottom half of the function. The problem states to add in the 'prop' and 'value' if it does not exist... I thought I had it correct, but maybe I am messing up how I am adding in data to the arrays.
Ken Haduch
@khaduch
@ImAlexanderK - okay - you are not doing the tracks part properly - are any of the cases passing? It looks like it could be failing when the tracks property is not present in the object?
Alex Kuczera
@akubie
ahhhh I kind of looked past that part. now I know I have random quotation marks, its because I didn't know if
collection[id] = prop;
or
collection[id] = "prop"; is the correct way to add in a value to an array. Im about 99% sure its the first one
Ken Haduch
@khaduch
and actually, you are doing some of the things wrong if it isn't the tracks property. For instance - this: collection[id] = prop; is not correct. And this: collection[id][prop] = "value"; is not correct. None of the stuff on the bottom is correct...
Alex Kuczera
@akubie
haha ok, hence why none of it is working. I was able to get the top part working. I have half the problem solved, just a few cases aren't passing through
Ken Haduch
@khaduch
if you are accessing a record, you are using collection[id], and if you want to add a property with the value, and the value is being sent in the variable (the function arg) value, you would want to do this, for the non-"tracks" case: collection[id][prop] = value; Which is what you are doing in the top section of your code. The same thing should be done if the property is not already in the object.
@ImAlexanderK - the next thing is if you have a missing tracks property, you have to add it, in the same way, but the value has to be contained within an array.
Alex Kuczera
@akubie
oh right! I've been copying and pasting code all over the place and royally messed that up.
It should look like the upper half, except something like:
} else {
        if (prop === "tracks") {
          collection[id] = [];
          collection[id][prop].push(value);
thanks for the help @khaduch! Back to the drawing board, that definitely cleared up some questions I had
CamperBot
@camperbot
imalexanderk sends brownie points to @khaduch :sparkles: :thumbsup: :sparkles:
Ken Haduch
@khaduch
@ImAlexanderK - no! You do not want to do collection[id] = []; because that is just clobbering the entire object that exists in collection[id]! You could do collection[id][prop] = []; and then the push. Or you could do collection[id][prop] = [value];, creating the array on the fly.
CamperBot
@camperbot
:warning: imalexanderk already gave khaduch points
Alex Kuczera
@akubie
Oh yeah, that is what I meant to type out. Ok I'll let you know how it goes ;D
Josh Beyer
@Joshbeyer
can somone look at my code pen and help me figure out why my divs are collapsing please
Ken Haduch
@khaduch
@Joshbeyer - taking a quick look...
Josh Beyer
@Joshbeyer
@khaduch thanks
CamperBot
@camperbot
joshbeyer sends brownie points to @khaduch :sparkles: :thumbsup: :sparkles:
:star2: 2701 | @khaduch |http://www.freecodecamp.com/khaduch
Ken Haduch
@khaduch
@Joshbeyer - you're trying to make your own grid?
Josh Beyer
@Joshbeyer
@khaduch I am using the grid from http://getskeleton.com/#grid
Ken Haduch
@khaduch
@Joshbeyer - it kind of looks like it is working? What do you think is wrong?
Josh Beyer
@Joshbeyer
I was going to use bourbon neat, but I can't figure it out. I have used skeleton several times in the past without any issues.
For some reason, the paragragh that says "We'll help you design yours" is coming after the grid.. when in the markup its before
the grid is going through the header
wait thats backwards, the paragraph is going out of the header
actually, everything after nav is placed out side the header for some reason
Josh Beyer
@Joshbeyer
I can just take the h1 and p out of the header, and it works just fine.. I just don't like not know what I was doing wrong.
Ken Haduch
@khaduch
@Joshbeyer - I think that the margin and padding are pushing your h1 and that paragraph down outside of the header?
Josh Beyer
@Joshbeyer
I have been up for a long time.. I knew it was a simple mistake lol i can't believe I overlooked that
Ken Haduch
@khaduch
If you turn off the fixed height in the header code, then the row / column part drops down below the "We'll help you design yours" text...
@Joshbeyer - it's crazy stuff... I've been up a long time, too... going offline now - hope I gave you something to go on? Good luck!
Josh Beyer
@Joshbeyer
Yes, its working fine now. Thanks!
Faddah Wolf
@faddah
hi all, i could still use some help with my portfolio project, i keep getting it near done, then something messes up and i’m stuck again. here’s the codepen: https://codepen.io/faddah/pen/egVyrM — what is happening now is, in the portfolio section, suddenly, the top three panels that had actual <iframe>’s in them to actual projects of mine, suddenly vanished and are not showing. it may have been some typo or something left out in my HTML or CSS, i’ve combed them looking for what caused this, but can’t seem to find it. any help, please?
RakeshNerkar
@Rakesh18754
In console when i did this
var test = 1;
console.log(test);
1
undefined
why it returns 2 outputs?
any idea?
V Arun Kumar
@arunvkumr
Hey guys, i'm working on twitch project and based on the guidelines given in the project page of fcc, they mentioned to use https://wind-bow.gomix.me/twitch-api/ but when i try to use the link in console i get redirection error and redirecting to https://wind-bow.glitch.me/twitch-api/, and i switched to glitch.me and its working. i just want to ask whether it is alright to use glitch or is there any other way to use gomix?