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
detour26 sends brownie points to @armynational :sparkles: :thumbsup: :sparkles:
:warning: could not find receiver for armynational
Mois├ęs Man
@moigithub
This message was deleted
Mario Galindo
@mariogalindov
thanks @TylerMoeller I saw the posibble solutions but I think the best I can do for now is to change the image of the thumbnail, thanks to you too @asparism I tried the max height but I do want all of them to be the same size.
CamperBot
@camperbot
mariogalindov sends brownie points to @tylermoeller and @asparism :sparkles: :thumbsup: :sparkles:
:cookie: 304 | @asparism |http://www.freecodecamp.com/asparism
:star2: 1386 | @tylermoeller |http://www.freecodecamp.com/tylermoeller
Tyler Moeller
@TylerMoeller
@mrs-coder What you're looking for is called Scroll Spy. Here are the instructions: http://getbootstrap.com/javascript/#scrollspy
John Nunns
@johnnunns
hey guys just need a little help here:
function getCount(str) {
  var vowelsCount = 0;

  str.split(' ')
  switch (str){
    case "a": vowelsCount + 1;
    break;
    case "e": vowelsCount + 1;
    break;
    case "i": vowelsCount + 1;
    break;
    case "o": vowelsCount + 1;
    break;
    case "u": vowelsCount + 1;
    break;
    };

  return vowelsCount;
}
just need to return the vowel count in a given string
probably not using the split property correctly though
c0d0er
@c0d0er
could anybody help for the following 2 questions?
var arr = [              
    [0,0,0]
];
var x=[...arr, [1,1,1,]]
console.log(x)//[ [ 0, 0, 0 ], [ 1, 1, 1 ] ]
x[0][0]=1;
console.log(x)//[ [ 1, 0, 0 ], [ 1, 1, 1 ] ]
console.log(arr)//[ [ 1, 0, 0 ] ]---> why use spread operator, the arr element is still changed?
var arr = [              
    [0,0,0]
];
var x=arr.concat([[1,1,1]]);
console.log(x)//[ [ 0, 0, 0 ], [ 1, 1, 1 ] ]
x[0][0]=1;
console.log(x)//[ [ 1, 0, 0 ], [ 1, 1, 1 ] ]
console.log(arr)//[ [ 1, 0, 0 ] ]---> why use concat, the arr element is still changed?
Tyler Moeller
@TylerMoeller
@johnnunns Correct, .split(' ') will separate your string by spaces rather than characters. Use str.split('') instead. You could then to a str.split('').map to loop through the string and evaluate each character.
@c0d0er Not sure how to answer that question - I'd have to know the context.
c0d0er
@c0d0er
@TylerMoeller there is no other contexts, you can just run, it will comes the result
Tyler Moeller
@TylerMoeller
Are you asking which is better to use?
.concat() vs. spread operator for a case like that, I mean
@c0d0er Or are you asking why the original arr changes when you're only updating x?
c0d0er
@c0d0er
@TylerMoeller yes
@TylerMoeller i am asking why the original arr changes when you're only updating x?
Tyler Moeller
@TylerMoeller
In JavaScript arrays are objects and variables are references to objects. When you update the variable, you are also updating the object. To prevent it, you need to clone the array first.
@c0d0er
Ben Mayer Davis
@benmayerdavis
has anybody else run into problems with adding icons to your document? I'm trying to use Font Awesome but the icons just won't show up in my document
c0d0er
@c0d0er
@TylerMoeller thanks! how to clone? could you give me a simple pseudo code?
CamperBot
@camperbot
:star2: 1388 | @tylermoeller |http://www.freecodecamp.com/tylermoeller
c0d0er sends brownie points to @tylermoeller :sparkles: :thumbsup: :sparkles:
Tyler Moeller
@TylerMoeller
For a shallow copy, you can just do: var copyOfMyArray = myArray.slice(0);
John Nunns
@johnnunns
without going into high level functions yet @TylerMoeller could you tell me where I'm going wrong here?
function getCount(str) {
var sum=0
var i = str.split(");
switch (i){
case 'a': sum + 1;
break;
case 'e': sum +1;
break;
case 'i': sum + 1;
break;
case 'o': sum + 1;
break;
case 'u': sum + 1;
break;
};

return sum

}
c0d0er
@c0d0er
@TylerMoeller this is a really good one! thanks!
CamperBot
@camperbot
c0d0er sends brownie points to @tylermoeller :sparkles: :thumbsup: :sparkles:
:warning: c0d0er already gave tylermoeller points
John Nunns
@johnnunns
It's something wrong in my switch statement it looks to me
Tyler Moeller
@TylerMoeller
@johnnunns str.split('') needs to be two apostrophes, not a double quote, for starters :)
John Nunns
@johnnunns
I changed it back to str.split('') forgot to change before i copy pasted
Tyler Moeller
@TylerMoeller
But yes, your switch statement runs once against the array
John Nunns
@johnnunns
yeah ^ :)
Tyler Moeller
@TylerMoeller
For example, say str='hello world';
You are doing:
  switch (['h', 'e', 'l', 'l', 'o', ' ', 'w', 'o', 'r', 'l', 'd']){
  case 'a': sum + 1;
  break;
  case 'e': sum + 1;
  break;
  case 'i': sum + 1;
  break;
  case 'o': sum + 1;
  break;
  case 'u': sum + 1;
  break;
};
If you don't want to use higher order functions, you can use a simple for() loop and evaluate each element returned from str.split('')
John Nunns
@johnnunns
right
because case 'a' doesn't equal hello world split up
Tyler Moeller
@TylerMoeller
Long story short - don't use a switch
There are lots of options though and you could make it work with a switch statement if you have to, I just think it would be cleaner with a simple if it's a vowel, add 1 statement.
John Nunns
@johnnunns
function getCount(str) {
var sum=0
var i = str.split('');
for(var x=i; x<str.length; x++){


return sum

}
I'm just not sure how to say if one of those vowels inside the string equals a vowel
Tyler Moeller
@TylerMoeller
Start by trying to console.log each letter individually
Your for() loop needs to start at 0, then go to index 1, 2, 3 etc.
John Nunns
@johnnunns
how will I tie it into the split then if i don't set something equal to i?