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
John Nunns
@johnnunns
an if statement like
if(i = "a") sum+1 ..... etc
Tyler Moeller
@TylerMoeller
A regular expression would be a little cleaner looking
John Nunns
@johnnunns
I'll show you what I have
function getCount(str) {
var sum=0
var i = str.split('');
for(var x=0; x<i.length; x++){
if (i === 'a' || 'e' || 'i' || 'o' || 'u'){
return sum + 1;
};
};

return sum

}
I'm sure you see what I'm trying to do, I see why it's only returning 1 because the loop is completed
I'm just not sure how to rework it
Tyler Moeller
@TylerMoeller
In your for() loop, what does i equal?
John Nunns
@johnnunns
str.split
Tyler Moeller
@TylerMoeller
Right, you want to compare against i[0], i1, i[2], etc..
Also, you will have to do if (i === 'a' || i === 'e' || etc...
John Nunns
@johnnunns
seems like an absolute ton of code :)
because I'm not using higher level function I'm presuming
but ok
Tyler Moeller
@TylerMoeller
The next problem is that return will stop the for loop - so you just want to add, not return inside the loop
Yes, and not using a regex :)
Melissa Guerrero
@Mmgfrog
Good evening. I am desperately seeking ideas as to why my Tweet This Quote button won't capture or tweet a quote from my Random Quote Machine. I have read the Twitter docs at length. I have tried Stack Overflow. I have asked at a Meetup. I'm out of ideas to try to get it to work. http://codepen.io/Mmgfrog/pen/egOxwq?editors=1010#0
John Nunns
@johnnunns
so there's no way to make it so that it can naturally go from I[0] to the end of i
if I'm not doing a higher lvl function
like if( i[0]-i[end of i] === a | e | i | o | u) sum + 1
Tyler Moeller
@TylerMoeller
I'm not sure, their may be other methods out there, but a higher order function would definitely make it cleaner
Melissa Guerrero
@Mmgfrog
What is happening is that I can generate a quote from my array, no problem. But once that's done, my Twitter button is un-clickable.
John Nunns
@johnnunns
gotch
Tyler Moeller
@TylerMoeller
Melissa Guerrero
@Mmgfrog
Or, on page refresh/load, I can get a Twitter window to open, but no quote inside.
Tyler Moeller
@TylerMoeller
@Mmgfrog Most people create a button with the same style as your twitter button and make it a hyperlink rather than using the Twitter widget code. The documentation can be confusing
Melissa Guerrero
@Mmgfrog
@TylerMoeller Would that strategy still capture the quote? Thanks for your input
CamperBot
@camperbot
mmgfrog sends brownie points to @tylermoeller :sparkles: :thumbsup: :sparkles:
:star2: 1389 | @tylermoeller |http://www.freecodecamp.com/tylermoeller
Ronit
@rfried99
Hello campers! I could really use your help. I can't seem to get a background image to rend. Here is the code: http://codepen.io/rfried99/pen/QGYyXy
Tyler Moeller
@TylerMoeller
@Mmgfrog Yes, it should - you are getting the quote text from the page, so there isn't a scope issue to worry about.
Melissa Guerrero
@Mmgfrog
@TylerMoeller OK I will redo that part without the widget. I appreciate it!
John Nunns
@johnnunns
@TylerMoeller semi cheating here, because I know the word is 'abracadabra' but to save time i wrote this
function getCount(str) {
var sum=0
var i = str.split('');
for(var x=0; x<i.length; x++){
if (i[0] === 'a'){
sum + 1;
} else if (i[3] === 'a'){
sum+1;
} else if (i[5] === 'a') {
sum + 1;
} else if (i[7] === 'a') {
sum + 1;
} else if (i[10] === 'a') { 
sum + 1;

};

};

return sum;

}
still returning zero though
Tyler Moeller
@TylerMoeller
@Mmgfrog Good luck - also, you will need to update your URL to use the web intent without the widget code:
https://twitter.com/intent/tweet?text=The text you want to tweet
Melissa Guerrero
@Mmgfrog
@rfried99 Is the image you're trying to render in your header? Or is it supposed to be in some other part of the page?
Tyler Moeller
@TylerMoeller
@johnnunns You'll need to add 1 to the existing sum variable: sum++ or sum = sum + 1
Melissa Guerrero
@Mmgfrog
@TylerMoeller OK. That line looks familiar. Pretty sure I read through that in the docs. LOL
John Nunns
@johnnunns
did the sum += 1
returned 11 :)
Tyler Moeller
@TylerMoeller
:)
Now to clean it up
At least you're adding to the original now
John Nunns
@johnnunns
Well shoot, it's not only testing me on abracadabra haha
first lets clean it up though, why would it return 11?
Ronit
@rfried99
@Mmgfrog thank you! It's supposed to be in the main
CamperBot
@camperbot
rfried99 sends brownie points to @mmgfrog :sparkles: :thumbsup: :sparkles:
:cookie: 277 | @mmgfrog |http://www.freecodecamp.com/mmgfrog
Matt Kieffer
@luna9
Ronit// take a look at your CSS / main / you are linking to a local asset. Try pushing it up and use http