Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
  • Jun 19 2020 20:09
    @krisb1220 banned @Gastony
  • May 14 2020 22:39
    @bjorno43 banned @minitechtips_twitter
  • May 14 2020 22:38
    @bjorno43 banned @real-action
  • Feb 01 2020 00:27
    @bjorno43 banned @Ndoua
  • Jan 07 2020 03:10
    @bjorno43 banned @doctor-sam
  • Aug 17 2019 09:32
    User @bjorno43 unbanned @linkin-park
  • Jun 20 2019 21:19
    @bjorno43 banned @shenerd140
  • Apr 25 2019 17:13
    @mstellaluna banned @cmal
  • Jan 08 2019 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
JD Tadlock
@jdtdesigns
@johnnunns You're getting close
John Nunns
@johnnunns
function convertObjectToList(obj) {
  for(var i in obj){
    var x = []
    x.push(obj[i])
  }
  return obj
}

convertObjectToList(obj)
JD Tadlock
@jdtdesigns
nope :P
John Nunns
@johnnunns
so when I run it I'm still returning the exact same object haha
JD Tadlock
@jdtdesigns
the empty array should be outside the for loop
and you'll be returning the array, not the obj
because the whole goal is to convert the object to an array :P
asmaamoussa
@asmaamoussa
Hello;
I am almost done with my pen. plz let me know ur opinion and I also want to know how to center align the social media buttons at the very end?
John Nunns
@johnnunns
var x = []
function convertObjectToList(obj) {
  for(var i in obj){

    x.push(obj[i])
  }

  return x
}

convertObjectToList(obj)
JD Tadlock
@jdtdesigns
@johnnunns Not outside the function, just above the for loop
And you're pushing an array to the array, not just the value
and the array's first value will be the property and the second value is the object value
John Nunns
@johnnunns
oh wow
function convertObjectToList(obj) {
    var x = []
  for(var i in obj){

    x.push([i,obj[i]])
  }

  return x
}

convertObjectToList(obj)
I think I did it?
Sorin Ruse
@sorinr
@asmaamoussa as i said yesterday using same colors fur the buttons in the nav as you have the on the picture's doors it will make sense to the user that clicking that button will open a specific door (get some specific info)
JD Tadlock
@jdtdesigns
;)
@johnnunns
John Nunns
@johnnunns
ok, here's the barrage of questions now :)
i by itself equaled all of the values in the object correct?
JD Tadlock
@jdtdesigns
the properties
John Nunns
@johnnunns
only the properties?
JD Tadlock
@jdtdesigns
yep
John Nunns
@johnnunns
so if i console.log(i) it would just be name, age, etc
JD Tadlock
@jdtdesigns
correct
John Nunns
@johnnunns
ok, well that's that then
because it makes sense to me that obj[i] then equals the values
cool stuff.
JD Tadlock
@jdtdesigns
eezypeezy
John Nunns
@johnnunns
Still got to it with your help and some very random tinkering haha
asmaamoussa
@asmaamoussa
@sorinr yes I loved your idea and on my way to execute it. Now I am more concerned with positioning the social media buttons. can u help
John Nunns
@johnnunns
thanks bud @jdtdesigns
CamperBot
@camperbot
johnnunns sends brownie points to @jdtdesigns :sparkles: :thumbsup: :sparkles:
:cookie: 860 | @jdtdesigns |http://www.freecodecamp.com/jdtdesigns
JD Tadlock
@jdtdesigns
@johnnunns welcome
John Nunns
@johnnunns
what's the higher level function you could use for it?
or is there one?
JD Tadlock
@jdtdesigns
.reduce() is for arrays so wouldn't work for that
lodash allows you to use any of the higher orders on objects as well
which is why most devs use it on every project
as well as me :P
Sorin Ruse
@sorinr
@asmaamoussa suppose you want them centered. right?
alpox
@alpox
@johnnunns @jdtdesigns Converting the object keys to an array and then map over it:
Object.keys(obj).map((key, idx) => [idx, obj[key]]);
asmaamoussa
@asmaamoussa
@sorinr yup
JD Tadlock
@jdtdesigns
@alpox ;)
Sorin Ruse
@sorinr
@asmaamoussa just add text-align: center; to #social-media{ in css
asmaamoussa
@asmaamoussa
@sorinr I did already and it wasn't working. now it did work :D
Sorin Ruse
@sorinr
@asmaamoussa maybe u had some other code before that was canceling that property