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
Tyler Moeller
@TylerMoeller
Was going to say ^^ .map returns a new array. probably a better way to go over .reduce()
JD Tadlock
@jdtdesigns
after reading the challenge rules, i decided .map was better ;)
John Nunns
@johnnunns
var obj = {
  key: [2, 1, 5]
};

function square(arr) {

    var x = [];

    for (var i = 0; i< arr.length; i++) {
        x.push(arr[i] * arr[i]);
    }

    return x;     
}

function getSquaredElementsAtProperty(obj, key) {
     var x = [];
    if(!obj[key]){
        return x;
    }else if(obj[key].length === 0){
        return x;
    }else if(!Array.isArray(obj[key])){
        return x;
    }
    return square(obj[key])

}

getSquaredElementsAtProperty(obj, 'key')
JD Tadlock
@jdtdesigns
@johnnunns You're way over complicating it lol
John Nunns
@johnnunns
I looked up some info on google and came up with this
as usual! :)
show me your solution
JD Tadlock
@jdtdesigns
function getSquaredElementsAtProperty(obj, key) {
  if ( !obj[key] || !Array.isArray(obj[key]) || !obj[key].length ) return []

  return obj[key].map(val => val * val)
}
John Nunns
@johnnunns
oh so you didn't like all my if statements huh??
:) haha
yeah that looks much better
can you write the map without the =>
just so I know what that looks like
it works. And I'd hate to see the character comparison there lol
JD Tadlock
@jdtdesigns
return obj[key].map(function(val) { return  val * val; });
John Nunns
@johnnunns
ok so very similar to filter
in syntax
thanks @jdtdesigns
CamperBot
@camperbot
:cookie: 889 | @jdtdesigns |http://www.freecodecamp.com/jdtdesigns
johnnunns sends brownie points to @jdtdesigns :sparkles: :thumbsup: :sparkles:
JD Tadlock
@jdtdesigns
@johnnunns Your goal should always be to avoid any i
'if else'
John Nunns
@johnnunns
ok so exact same problem pretty much but using filter here, just have to take an array and return only the odd numbers. Are you able to make this shorter or have I not overcomplicated this time?
var obj = {
  key: [1, 2, 3, 4, 5]
};

function odd(number){
    return number%2 === 1;
}

function getOddElementsAtProperty(obj, key) {

if( !obj[key] || !Array.isArray(obj[key]) || !obj[key].length){
    return [];
}
return obj[key].filter(function(number){
    return odd(number);
});
}

getOddElementsAtProperty(obj,'key')
JD Tadlock
@jdtdesigns
if you're chaining 'if else' then you know you can DRY your code up
John Nunns
@johnnunns
gotcha
using the ||
JD Tadlock
@jdtdesigns
just move the number%2 === 1; to the return in getOdd...
no reason to have a second function
John Nunns
@johnnunns
yeap you're right
the growth is real though. Having a good day today
Thanks man @jdtdesigns
CamperBot
@camperbot
johnnunns sends brownie points to @jdtdesigns :sparkles: :thumbsup: :sparkles:
:warning: johnnunns already gave jdtdesigns points
JD Tadlock
@jdtdesigns
@johnnunns welcome ;)
Janina Pohorecki
@janepohorecka
In mobile/tablet size, why does my navigation bar only open 90%?? https://janepohorecka.github.io/Test-Northwest/ Please, please help me
:((
JD Tadlock
@jdtdesigns
@janepohorecka You have a few issues, but one glaring one is you have a <li> outside the <ul>
<h1 id="header-title">
          <img src="logo.svg">
          <a href="#"> Test Northwest</a>
        </h1>
        <ul class="topnav responsive" id="nav">
          <!-- <h1 id="header-title">
            <img src="logo.svg">
            <a href="#"> Test Northwest</a>
          </h1> -->
          <li><a href="#">Welcome</a></li>
          <li><a href="#">LD Screening</a></li>
          <li><a href="#">ADHD Screening</a></li>
          <li><a href="#">Appointments</a></li>
          <li><a href="#">About</a></li>
        </ul>

        <li class="icon">
          <a href="javascript:void(0)ow ;" onclick="myFunction()"></a>
        </li>
Also, h1's aren't meant to be wrappers for content
you should be using a div
Janina Pohorecki
@janepohorecka
@jdtdesigns Thank you for your response ;) Let me see what I can do now that you mention this.
CamperBot
@camperbot
janepohorecka sends brownie points to @jdtdesigns :sparkles: :thumbsup: :sparkles:
:cookie: 890 | @jdtdesigns |http://www.freecodecamp.com/jdtdesigns
Janina Pohorecki
@janepohorecka
I don't see my three tab navigation button when I place it inside the UL
@jdtdesigns
@jdtdesigns I think thats why I orginally must have placed it outside the UL
bstiles00
@bstiles00
I'm working on the "Build a Tribute Page" FCC challenge. I've finished my page, but I don't understand what this line in Quincy's example page actually does: <div class="col-xs-12">
I took the line out and reran the code and nothing I can see changes.
Janina Pohorecki
@janepohorecka
@jdtdesigns So I am experimenting with it. I updated the code so that the nav icon appeared within the UL and also outside of it. Take a look at how it appears twice: https://janepohorecka.github.io/Test-Northwest/
JD Tadlock
@jdtdesigns
@janepohorecka Here's an example of how to layout your header with just regular css using flexbox. http://jsbin.com/futuhec/edit?html,css,output