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
Tom
@moT01
yea, i played around with that for a while, ...if youre interested
http://codepen.io/moT01/pen/LRoxrQ?editors=1010
here's what i came up with
Ken Haduch
@khaduch

@johnnunns - there are a few problems here.

  • you should be testing for value === '' or value !== '' somewhere in your code to be able to handle that situation, as described in the problem description
  • collection[id].tracks.hasOwnProperty(value) - this is not correct. tracks does not contain an object as its value, so it cannot be used with .hasOwnProperty() in the way you have it coded. (You would most likely get an error in the console if you looked at it when this code was attempted to be run.)
  • collection[id].tracks.push("Addicted to Love"); would work - if prop === "tracks" (you were supposed to be operating on the "tracks" property) and if value === "Addicted to Love" - In other words, you have hard-coded something that should be using the function arguments.
  • if(collection[id].hasOwnProperty(prop)) { - this test is not useful here. The function should always return collection; after it updates the record.
  • collection[id].push("tracks","artists"); - this is also not useful here - there is no condition here where you should be pushing the words "tracks" and "artists" into an object (which probably will fail anyway, since it collection[id] is not an array...

You have some of the concepts going in the right direction, but things are quite jumbled and confused, but let's try another approach. Look at the conditions that they want you to check - one of the biggies is value === "" or value !== "". If the value is blank, you are just supposed to delete the property that is given in the variable prop, at the ID that is given in the variable id. You have to use the delete function. You can write this code like this:

if ( value === '' ) {
    delete collection[id][prop]; // because the value is blank, just delete this
} else {
    // the value is not blank - there are other things to consider, most specifically, if `prop === "tracks"`
    if (prop === "tracks" ) {
        // do the things here to properly handle the "tracks" property
    } else {
        // the prop variable is not "tracks", just add the prop and value to the given record.
    }
}
return collection; // this is always done at the end of the function

that is what you should have as a basic idea for your function - you need to fill in the details. Look at the description of the problem, with this framework in mind, and see if you can get some of the tests to pass.

Tom
@moT01
@khaduch wow
Ken Haduch
@khaduch
@johnnunns @moT01 - I hate to be a party pooper, but I have to sign off for tonight. That's why I put so much detail & hints into my previous comment... 5 minutes for any followup?
Tom
@moT01
that's like a whole novel
John Nunns
@johnnunns
huge thanks for your patience. Both @khaduch and @moT01 . I'll give it a shot. And thanks for going into that much detail for me. Means a ton
CamperBot
@camperbot
johnnunns sends brownie points to @khaduch and @mot01 :sparkles: :thumbsup: :sparkles:
:cookie: 441 | @mot01 |http://www.freecodecamp.com/mot01
:star2: 2181 | @khaduch |http://www.freecodecamp.com/khaduch
Ken Haduch
@khaduch
@johnnunns - as I said - this is a big stepping stone in writing a function that does something a little more complex than the problems up until this point. It's not good to just have the answer given to you, but it's not good to get too frustrated. I hope that helps. You can always find hints in the wiki, if you get too bogged down, but people here will help you, it's better to try and make it through and learn as much as you can. Step, step, step... good luck!
khaduch @khaduch - going offline for the night... going once... going twice... gone! Good night all - happy coding!
Josh
@joshfilippi
Can anyone help me get bootstrap working? I've just finished all the functionality of my local weather project and now i can't get button in the right place
There is a button under the temperature. I want it to be beside it
Bootstrap is loaded on the pen, everything is nested in a container-fluid element. but when i nest 2 elements in a 'row' class element, they dont appear in a row
Tom
@moT01

adding...

#temp {
  display: inline;
}

gets it close

@joshfilippi
livonian-router
@livonian-router
@joshfilippi and round your temp result
Josh
@joshfilippi
@moT01 thanks. it's a little better. I'd love to know why bootstrap grid isnt working
CamperBot
@camperbot
joshfilippi sends brownie points to @mot01 :sparkles: :thumbsup: :sparkles:
:cookie: 442 | @mot01 |http://www.freecodecamp.com/mot01
Tom
@moT01
im not great with bootstrap, there might be a better way with one of their classes, ...i might consider just turning you <p> with the temp in it to something clickable, and use that to toggle instead of a separate button
DavidMinAZ
@DavidMinAZ
@someone Anyone up for tackling a jQuery question? I'm trying to grab some jSON data using .getJSON() but although the API is clearly returning data in a browser it doesn't appear to be hitting my script...
$.getJSON("http://api.forismatic.com/api/1.0/?method=getQuote&key=457653&format=json&lang=en", function(data) { console.log("OPoop"); });
Rex Smith Jr.
@rsmith731
does anyone know if it is possible to embed tumblr as the entire page on a website - a client asked me
Josh
@joshfilippi
@livonian-router does the temperature in my pen appear with lots of numbers after the decimal place? I see a whole number.. ?
DavidMinAZ
@DavidMinAZ
Incidentally, the console.log() should be console.log(data);
livonian-router
@livonian-router
@joshfilippi Yeah, it appears with too many numbers here
Josh
@joshfilippi
ok thanks @livonian-router
CamperBot
@camperbot
joshfilippi sends brownie points to @livonian-router :sparkles: :thumbsup: :sparkles:
:cookie: 286 | @livonian-router |http://www.freecodecamp.com/livonian-router
James Payne
@jamespayne
Hey everybody, I just finished Build a Random Route Machine. If anybody has any feedback, that would be great. Here is the pen: http://codepen.io/jlpayne/pen/yVZrLW
  • Quote. Not route!
Josh
@joshfilippi
@jamespayne It's looks really good. I didn't know about text-shadow css command. Nicely done
James Payne
@jamespayne
@joshfilippi Thanks a lot! Yeah its pretty handy but I guess you would have to be careful when it comes to browser compatibility. I added an extra user story where you can click on the authors name and it takes you to the wikipedia page for that author. Did you find that feature?
CamperBot
@camperbot
jamespayne sends brownie points to @joshfilippi :sparkles: :thumbsup: :sparkles:
:cookie: 265 | @joshfilippi |http://www.freecodecamp.com/joshfilippi
RakeshNerkar
@Rakesh18754
"data": {
    "locationName": "test tag",
    "address": "Bangladesh,Boalkhali",
    "assetTags": [
        {
            "tagType": "du",
            "tagValue": "aadadasd"
        }
    ]
}

var option_cate = '<li class="item"><span>' + malwareLabel +' : ' + dummyJson.data[key] + ' </span></li>';
$(option_cate).appendTo('#malware-menu');

but it gets printed as
locationName : test tag,
address : Bangladesh,Boalkhali,
Asset Tags : [object Object]

The data for assetTags gets printed as object as it is an array of object
How to print the values of the inner array also

James Payne
@jamespayne
@Rakesh18754 maybe try data.assetTags[0].whateverdatayouneed?
Might be wrong. I've just spent the whole day learning heaps about JSON.
RakeshNerkar
@Rakesh18754
@jamespayne actully it can contain n number of objects
James Payne
@jamespayne
maybe a nested loop would help you solve that problem?
DavidMinAZ
@DavidMinAZ
@jamespayne Looks great... and you used the same API that I have been trying to use without success
James Payne
@jamespayne
@DavidMinAZ Thanks. Yeah I really struggled to find a solution that worked. It took a fair amount of research to figure it out. Learnt a lot during that process.
CamperBot
@camperbot
jamespayne sends brownie points to @davidminaz :sparkles: :thumbsup: :sparkles:
:cookie: 265 | @davidminaz |http://www.freecodecamp.com/davidminaz
James Payne
@jamespayne
@DavidMinAZ Do you have a link to your pen?
DavidMinAZ
@DavidMinAZ
@jamespayne Yes, though it's far from complete... I'm stuck on trying to figure out how to use the .getJSON() with that API
My pen: http://codepen.io/dmattiuz/pen/zogGeB?editors=0011
@jamespayne I see you used the jsonp option in your call... which I avoided because I didn't know what sort of slippery slope there would be with trying to do something "unvanilla"
Lean Junio
@leanjunio
@leanjunio
Hey everybody,
Are front-end developers also responsible for making the websites dynamic?
In that sense, introducing a CMS to the site or something along those lines, are those under the web developer's job?