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
Vamshi Gudipati
@vamshikrishna144
Then use this
this doesnt use dangerouslySetInnerHtml
Ashwin
@ashwins93
@vamshikrishna144 Thanks! this is exactly what i was looking for. I need to upgrade my googling skills, i wandered for a couple of hours
CamperBot
@camperbot
ashwins93 sends brownie points to @vamshikrishna144 :sparkles: :thumbsup: :sparkles:
:cookie: 5 | @vamshikrishna144 |http://www.freecodecamp.com/vamshikrishna144
Ashwin
@ashwins93
Next time i should check here first i guess
Vamshi Gudipati
@vamshikrishna144
Haha, I use in my project, so I knew. And yes googling is indeed an important skill
B
@B-keen
@sjames1958gm i know that is what the exercise says but i was looking to navigate JSON and try it another way looping through each element if found i.e. if the index id is 2548 prop is artist and artist is Bon Jovi (return collection[id][prop]; ) should equal Bon Jovi in the Free Code Camp window i'm getting the entire JSON but in chrome dev tools i'm getting Bon Jovi

var collection = {
    "2548": {
      "album": "Slippery When Wet",
      "artist": "Bon Jovi",
      "tracks": [ 
        "Let It Rock", 
        "You Give Love a Bad Name" 
      ]
    },
    "2468": {
      "album": "1999",
      "artist": "Prince",
      "tracks": [ 
        "1999", 
        "Little Red Corvette" 
      ]
    },
    "1245": {
      "artist": "Robert Palmer",
      "tracks": [ ]
    },
    "5439": {
      "album": "ABBA Gold"
    }
};


// Keep a copy of the collection for tests
var collectionCopy = JSON.parse(JSON.stringify(collection));

// Only change code below this line
function updateRecords(id, prop, value) {

//var json = JSON.parse(collection);

  //var jkl = collection[id][prop].push(value);

  //var jkl = id;

  return collection[id][prop];
}

// Alter values below to test your code
//updateRecords(5439, "artist", "ABBA");
updateRecords(2548, "artist", "Bon Jovi");


"Bon Jovi"
Chrome
FCC
B
@B-keen
  collection = {
 "1245": {
      "artist": "Robert Palmer",
      "tracks": [ ]
},
    "2548": {
      "album": "Slippery When Wet",
      "artist": "Bon Jovi",
      "tracks": [ 
        "Let It Rock", 
        "You Give Love a Bad Name" 
      ]
    },
    "2468": {
      "album": "1999",
      "artist": "Prince",
      "tracks": [ 
        "1999", 
        "Little Red Corvette" 
      ]
    },
    "1245": {
      "artist": "Robert Palmer",
      "tracks": [ ]
    },
    "5439": {
      "album": "ABBA Gold"
    }
}
Stephen James
@sjames1958gm
@B-keen Looping is entirely unnecessary, they give you the keys to look up everything
@B-keen You need to test the incoming parameters first then change the collection
B
@B-keen

@sjames1958gm ```
var collection = {
"2548": {
"album": "Slippery When Wet",
"artist": "Bon Jovi",
"tracks": [
"Let It Rock",
"You Give Love a Bad Name"
]
},
"2468": {
"album": "1999",
"artist": "Prince",
"tracks": [
"1999",
"Little Red Corvette"
]
},
"1245": {
"artist": "Robert Palmer",
"tracks": [ ]
},
"5439": {
"album": "ABBA Gold"
}
};

// Keep a copy of the collection for tests
var collectionCopy = JSON.parse(JSON.stringify(collection));

// Only change code below this line
function updateRecords(id, prop, value) {

//var json = JSON.parse(collection);

//var jkl = collection[id][prop].push(value);

//var jkl = id;

if(prop === 'tracks' ){
collection[id][prop].push(value);

}
return collection;
}

// Alter values below to test your code
//updateRecords(5439, "artist", "ABBA");
updateRecords(1245, "tracks", "Addicted to Love");
//updateRecords(2548, "artist", "Bon Jovi");
```

var collection = {
    "2548": {
      "album": "Slippery When Wet",
      "artist": "Bon Jovi",
      "tracks": [ 
        "Let It Rock", 
        "You Give Love a Bad Name" 
      ]
    },
    "2468": {
      "album": "1999",
      "artist": "Prince",
      "tracks": [ 
        "1999", 
        "Little Red Corvette" 
      ]
    },
    "1245": {
      "artist": "Robert Palmer",
      "tracks": [ ]
    },
    "5439": {
      "album": "ABBA Gold"
    }
};


// Keep a copy of the collection for tests
var collectionCopy = JSON.parse(JSON.stringify(collection));

// Only change code below this line
function updateRecords(id, prop, value) {

//var json = JSON.parse(collection);

  //var jkl = collection[id][prop].push(value);

  //var jkl = id;


  if(prop === 'tracks' ){
    collection[id][prop].push(value);


  }
  return collection;
}

// Alter values below to test your code
//updateRecords(5439, "artist", "ABBA");
updateRecords(1245, "tracks", "Addicted to Love");
//updateRecords(2548, "artist", "Bon Jovi");
Stephen James
@sjames1958gm
@B-keen That is one case. But you should probably check the primary case of value != "" first
B
@B-keen
@sjames1958gm i still have the question as to why is the behaviour different in the IDEs when i do a "return collection[id][prop] " i get just that element in chrome dev & node.js but when i do it in FCC it gives me the entire JSON
no problem i will do that Stephen
Stephen James
@sjames1958gm
@B-keen Where are you seeing that it gives you the whole collection
B
@B-keen

var collection = {
    "2548": {
      "album": "Slippery When Wet",
      "artist": "Bon Jovi",
      "tracks": [ 
        "Let It Rock", 
        "You Give Love a Bad Name" 
      ]
    },
    "2468": {
      "album": "1999",
      "artist": "Prince",
      "tracks": [ 
        "1999", 
        "Little Red Corvette" 
      ]
    },
    "1245": {
      "artist": "Robert Palmer",
      "tracks": [ ]
    },
    "5439": {
      "album": "ABBA Gold"
    }
};


// Keep a copy of the collection for tests
var collectionCopy = JSON.parse(JSON.stringify(collection));

// Only change code below this line
function updateRecords(id, prop, value) {

//var json = JSON.parse(collection);

  //var jkl = collection[id][prop].push(value);

  //var jkl = id;

  return collection[id][prop];
}

// Alter values below to test your code
//updateRecords(5439, "artist", "ABBA");
updateRecords(2548, "artist", "Bon Jovi");


"Bon Jovi"
if you put that in Chrome or Node.js it gives you Bon Jovi
but when you run it in FCC it gives you the entire JSON
Spyrantis Theodoros
@thodorisanta
lets say that i have a code that makes the user choose beetween the numbers 1 or 2 and accordingly to what he chose we add a class,either one or two accordinly to a paragraph p . how can i make an if statement that goes something like "if paragraph has the class one in it do that" else if "it has the class "two" in it do this?
Stephen James
@sjames1958gm
@B-keen The console window is not showing the result of the function call - not sure why.
@thodorisanta You can use Element.classList.contains("one")
https://developer.mozilla.org/en-US/docs/Web/API/Element/classList
3gimpfingers
@3gimpfingers

Why does it not make a difference if I write this:

str = str.slice(0, num).slice(0, num-3) + '...';

like this:

str = str.slice(0, num-1).slice(0, num-3) + '...';

?

Tom
@moT01
i think it's cause the part that matters gets cut off @3gimpfingers
i haven't a slice on a slice like that before
so im thinking
arr = [0,1,2,3,4,5,6,7,8]
num = 5;
arr.slice(0, 4) = [0,1,2,3,4]
.slice(0, 2) = [0,1,2]
it would change that first slice by 1 digit, but you don't print it out or anything so you don't see it
B
@B-keen
ok i will just complete the task for now and comeback to it later thanks @sjames1958gm
CamperBot
@camperbot
b-keen sends brownie points to @sjames1958gm :sparkles: :thumbsup: :sparkles:
:star2: 8551 | @sjames1958gm |http://www.freecodecamp.com/sjames1958gm
K Smith
@klinton24
pertaining to bootstrap, is there anyone that can tell me why this dropdown isn't drop downing? I've been wanting to put a drop down in my list of nav pills so I can have a 1 stop click for links etc -- https://codepen.io/ksmith24/pen/rGZqQW?editors=1010
Fabien SHAN
@X140hu4
I think it is a problem with codepen
Fabien SHAN
@X140hu4
@klinton24 Go to settings > Javascript. Add jQuery and then Bootstrap 3 (in this order or it will not work properly)
Chris Cullen
@123xylem
https://www.rosalievillagebarber.com
Can anyone think of a way of adding the rosalievillage barber logo (seen in about section) to the header text? Or above it?
I tried changing the css of the header h1 to have a backgroind image but no workie... Also its a wordpress theme so not sure I can add an image above the header
Ivan Ngundela
@ingundela
Hello everyone... please help me with my project... I'm working on my portfoliio Website and there is something that I cannot fixe... when I click on the navigation menu I have this blue color with the undeline that I don't kow how to remove it... I have added the text-decoration: none at the nav a and also at the nav a:hover but it is still there on a click.. please visit https://ingundela.github.io/ ... I look forward for your help and Thank you in advance
Amit Patel
@AmitP88
hey guys, I need help in making my match 3 game. I'm trying to swap two selected tiles that the user clicks on. So far I'm able to do it in the console, but I'm having trouble figuring out how to do it on the actual canvas
https://codepen.io/AmitP88/pen/pWyaNY
K Smith
@klinton24
Thank you so much @X140hu4
CamperBot
@camperbot
klinton24 sends brownie points to @x140hu4 :sparkles: :thumbsup: :sparkles:
:cookie: 298 | @x140hu4 |http://www.freecodecamp.com/x140hu4
Nitin Sahu
@globefire
hii there
I can't undersstand how to implement the local weather challenge
can anyone help me out, pldd
please*