These are chat archives for FreeCodeCamp/Help

23rd
Aug 2015
Lux3
@Lux3
Aug 23 2015 00:00
Right now it completes for strings with equal numbers of less than 4 short of the string
but not for shorter
Joris Labie
@labiej
Aug 23 2015 00:00
str.length > num I believe
Tod
@thermobee
Aug 23 2015 00:00
yeah why are you subtracting 3 from num?
Joris Labie
@labiej
Aug 23 2015 00:01
and less than ofcourse
Lux3
@Lux3
Aug 23 2015 00:01
if the string is only 11 as the example you are supposed to return "A-tisket..."
you need to accoutn for the ...
Tod
@thermobee
Aug 23 2015 00:01
you do, but not there
Lux3
@Lux3
Aug 23 2015 00:01
ooh, good point
Joris Labie
@labiej
Aug 23 2015 00:02
that's what you do when defining trunk
Tod
@thermobee
Aug 23 2015 00:02
trunk = str.slice(0, num - 3) + "...";
Joris Labie
@labiej
Aug 23 2015 00:02
But you're comparison is backwards. You just return the string when your string is too long
Lux3
@Lux3
Aug 23 2015 00:03
I have tried it 6 different ways lol
Tod
@thermobee
Aug 23 2015 00:03
yeah try and think through the comparisson of the if statement
Lux3
@Lux3
Aug 23 2015 00:05
should not truncate if string is < length: expected 'A-tisket a-tasket A green and yellow baske...' to equal 'A-tisket a-tasket A green and yellow basket'
I get this error with this code:
var trunk = null;
function truncate(str, num) {
  if(str.length === num) {
    return str;
  } else {
    trunk = str.slice(0, num - 3) + "...";
    return trunk;
  }

}

truncate('A-tisket a-tasket A green and yellow basket', 11);
Joris Labie
@labiej
Aug 23 2015 00:06
So when do you return the full string?
Lux3
@Lux3
Aug 23 2015 00:06
return full string if the number is = to string or if num is string -3
anywhere in that range
Joris Labie
@labiej
Aug 23 2015 00:07
You return the full string whenever it is shorter than num
Rex Schrader
@SaintPeter
Aug 23 2015 00:07
Less than or equal to num?
Rex Schrader
@SaintPeter
Aug 23 2015 00:07
bf truncate
CamperBot
@camperbot
Aug 23 2015 00:07

:fire:Bonfire: Truncate a string :link:

function truncate(str, num) {
  // Clear out that junk in your trunk
  return str;
}

truncate('A-tisket a-tasket A green and yellow basket', 11);

Truncate a string (first argument) if it is longer than the given maximum string length (second argument). Return the truncated string with a '...' ending.

more info:  bf details | bf links | hint

Joris Labie
@labiej
Aug 23 2015 00:07
hint
CamperBot
@camperbot
Aug 23 2015 00:07
:construction: Spoilers are only in the Bonfire's Custom Room :point_right:
Lux3
@Lux3
Aug 23 2015 00:08
hint
CamperBot
@camperbot
Aug 23 2015 00:08
:construction: Spoilers are only in the Bonfire's Custom Room :point_right:
Lux3
@Lux3
Aug 23 2015 00:09
dinnertime brb
tag me if you have a solution
Joris Labie
@labiej
Aug 23 2015 00:10
Good luck, I'm of to bed
Lux3
@Lux3
Aug 23 2015 00:13
bf truncate | hint
CamperBot
@camperbot
Aug 23 2015 00:13
Sorry, can't find a bonfire called truncate hint. [ Check the map? ]
Chad Kreutzer
@ChadKreutzer
Aug 23 2015 00:14
@Lux3 that was a quick dinner
Lux3
@Lux3
Aug 23 2015 00:14
It is pizza, I'm still eating just checking in lol
Chad Kreutzer
@ChadKreutzer
Aug 23 2015 00:16
first off. if you aren't doing anything to the str, do you think you need to tell it to just return it as is?
I didn't say that well: do you really need that first clause of your if then else?
it's funny: you don't actually say "then" but it's so hardwired into my thinking that I still call them that.
Chad Kreutzer
@ChadKreutzer
Aug 23 2015 00:23
And second: How do you handle if str.length is shorter than num?
Lux3
@Lux3
Aug 23 2015 00:31
ok I am back
I ended up going wiht the hint
apparently I was over-thinking it
N-kay
@N-kay
Aug 23 2015 00:33

Heyo, I got a question.
On my first zipline, the portfolio page, I have slight problem with my anchor points.
Since my navbar is fixed to the top, when I navigate to an anchor, it's slightly obstructed by the navbar.
Check the link below to see what I mean.
Link to my CodePen

Is there any elegant way to fix this, other than just making the anchor element bigger, so the navbar won't overlay the text?

Daniel
@Smokenham
Aug 23 2015 00:35
@N-kay Have you tried adding padding-top to your section?
N-kay
@N-kay
Aug 23 2015 00:38
@Smokenham I realise that's possible, but I don't really want to make my black .divider elements(wich are my anchors) any bigger :-/
Derek Frankel
@TuvyaYis
Aug 23 2015 00:39
Hey, why is it that the following code will only console.log up until the replace function? Only errors are reproduced after adding .reverse() and/or .join(""):
var result = string.replace(/\s+/g, "").reverse().join("");
var result = string.replace(/\s+/g, "").reverse().join("");
N-kay
@N-kay
Aug 23 2015 00:41
For example, I found this JS solution wich works, but creates a noticable jitter when navigating to anchors
var shiftWindow = function() { scrollBy(0, -50) };
if (location.hash) shiftWindow();
window.addEventListener("hashchange", shiftWindow);
Chad Kreutzer
@ChadKreutzer
Aug 23 2015 00:43
@TuvyaYis array.reverse(); and array.join(); are both array functions. you are trying to apply them to a string.
Derek Frankel
@TuvyaYis
Aug 23 2015 00:47
@ChadKreutzer what is .replace?
DTing
@dting
Aug 23 2015 00:47
@N-kay basically just give the anchor padding = to the height of your navbar
James Becker
@james-becker
Aug 23 2015 00:48
Having trouble using appendTo with jQuery
<script>
$(document).ready(function() {
$("#target1").css("color", "red");
$("#target1").prop("disabled", true);
$("#target4").remove();
$("#target2").appendTo("right-well");
});
</script>
Chad Kreutzer
@ChadKreutzer
Aug 23 2015 00:49
it's a string function. so that's good. but you will have to convert your string to an array before you can use the other two functions.
James Becker
@james-becker
Aug 23 2015 00:49
Is my syntax correct?
(also if anyone can tell me how to format code correctly for the chat room, that would be great!)
Chad Kreutzer
@ChadKreutzer
Aug 23 2015 00:51
@TuvyaYis also, a heads up: if you are doing the palindrome bonfire (and I'm pretty sure you are) your regexp is going to fail because all it looks for is spaces.
DTing
@dting
Aug 23 2015 00:51
your make sure your target is correct
Fuzz83
@Fuzz83
Aug 23 2015 00:51
having problem with Javascript way point 39. bring you r slot machine to life
DTing
@dting
Aug 23 2015 00:51
@Fuzz83 copy and paste the code in fuzz
Fuzz83
@Fuzz83
Aug 23 2015 00:51
ok
DTing
@dting
Aug 23 2015 00:51
the auto complete makes your browser go into a loop because of $($)
N-kay
@N-kay
Aug 23 2015 00:51
@dting Yeah, you're the 2nd person to mention that, and since I can't find another good solution, I guess I have to make my .divider's really large :( thanks though
CamperBot
@camperbot
Aug 23 2015 00:51
n-kay sends brownie points to @dting :sparkles: :thumbsup: :sparkles:
:star: 586 | @dting | http://www.freecodecamp.com/dting
Fuzz83
@Fuzz83
Aug 23 2015 00:51
<script>
function runSlots(){
var slotOne;
var slotTwo;
var slotThree;
var images = ["http://i.imgur.com/9H17QFk.png", "http://i.imgur.com/9RmpXTy.png", "http://i.imgur.com/VJnmtt5.png"];

slotOne = Math.floor(Math.random() * (3 - 1 + 1)) + 1;
slotTwo = Math.floor(Math.random() * (3 - 1 + 1)) + 1;
slotThree = Math.floor(Math.random() * (3 - 1 + 1)) + 1;

$(".logger").html("");
$(".logger").html("Not A Win")

// Only change code below this line.

$(".slot")

  $($(".slot")[0]).html(slotOne);
  $($(".slot")[0]).html(slotTwo);
  $($(".slot")[0]).html(slotThree);

// Only change code above this line.
DTing
@dting
Aug 23 2015 00:52
@Fuzz83 oh okay. remove that first $(".slot")
Fuzz83
@Fuzz83
Aug 23 2015 00:52
they want me use the .slot selector, but do i have to create the slot class
DTing
@dting
Aug 23 2015 00:52
@Fuzz83 and you need to change the numbers inside the []'s
Fuzz83
@Fuzz83
Aug 23 2015 00:52
ah
Derek Frankel
@TuvyaYis
Aug 23 2015 00:52
@ChadKreutzer so then .split('') is used for the array functions and .join('') to turn it back into an array?
James Becker
@james-becker
Aug 23 2015 00:53
thanks dting
CamperBot
@camperbot
Aug 23 2015 00:53
if you want to thank someone, put an @ before their name!
James Becker
@james-becker
Aug 23 2015 00:53
thanks @dting
CamperBot
@camperbot
Aug 23 2015 00:53
james-becker sends brownie points to @dting :sparkles: :thumbsup: :sparkles:
:star: 587 | @dting | http://www.freecodecamp.com/dting
DTing
@dting
Aug 23 2015 00:53
@N-kay how come?
Fuzz83
@Fuzz83
Aug 23 2015 00:53
@dting got it thanks.
CamperBot
@camperbot
Aug 23 2015 00:53
fuzz83 sends brownie points to @dting :sparkles: :thumbsup: :sparkles:
:star: 588 | @dting | http://www.freecodecamp.com/dting
JBGuthrie
@JBGuthrie
Aug 23 2015 00:55
I don't know if its correct to address here, but I'm having an issue with bootstrap waypoint 30
Rex Schrader
@SaintPeter
Aug 23 2015 00:55
This is the right place
JBGuthrie
@JBGuthrie
Aug 23 2015 00:55
It won't validate my answers and I know that they are right.
All I have to do is change the text inside of the elements
Rex Schrader
@SaintPeter
Aug 23 2015 00:56
And give them an ID
Humm, it looks like they have the ID
JBGuthrie
@JBGuthrie
Aug 23 2015 00:56
They already have the id
Chad Kreutzer
@ChadKreutzer
Aug 23 2015 00:57
@TuvyaYis exactly.
Rex Schrader
@SaintPeter
Aug 23 2015 00:57
@JBGuthrie So do you have green checkmarks?
N-kay
@N-kay
Aug 23 2015 00:57
@dting Well, my divider's must have at least 51px of padding-top for the text inside to NOT be obstucted by the navbar
See my codepen.
Huge padding right now
JBGuthrie
@JBGuthrie
Aug 23 2015 00:57
@SaintPeter no
Derek Frankel
@TuvyaYis
Aug 23 2015 00:57
@ChadKreutzer ... got'em to work after using .split('').reverse().join()... i was just practicing, learning in JSBin thx
CamperBot
@camperbot
Aug 23 2015 00:57
tuvyayis sends brownie points to @chadkreutzer :sparkles: :thumbsup: :sparkles:
:star: 305 | @chadkreutzer | http://www.freecodecamp.com/chadkreutzer
Rex Schrader
@SaintPeter
Aug 23 2015 00:58
@JBGuthrie Are you putting the text target1 or #target1?
Chad Kreutzer
@ChadKreutzer
Aug 23 2015 00:58
@TuvyaYis no prob
JBGuthrie
@JBGuthrie
Aug 23 2015 00:58
@SaintPeter #target1
co0lguy42
@co0lguy42
Aug 23 2015 00:58
can somebody help me with the last step of waypoint: uncomment html
DTing
@dting
Aug 23 2015 00:58
@N-kay that pen doesnt load for me
N-kay
@N-kay
Aug 23 2015 00:59
@dting do I have to set it to public or something? I don't have any prior experience with the website
Rex Schrader
@SaintPeter
Aug 23 2015 00:59
@JBGuthrie Try making a copy of your code, reloading the page, and pasting the code in. I'm trying it right now and it appears to be working fine. I get a green check as I go. You could also paste an example button here so we can see if you've got your text in the wrong place.
Sophanarith Sok
@sok213
Aug 23 2015 00:59
@co0lguy42 delete the ```
```
<!-- -->
^that
co0lguy42
@co0lguy42
Aug 23 2015 01:00
Ok ill try it @sok213
Rex Schrader
@SaintPeter
Aug 23 2015 01:00
@JBGuthrie The buttons should look like this:
<button class="btn btn-default target" id="target1">#target1</button>
co0lguy42
@co0lguy42
Aug 23 2015 01:01
Thanks so much @sok213 it worked I've been on that one forever
CamperBot
@camperbot
Aug 23 2015 01:01
co0lguy42 sends brownie points to @sok213 :sparkles: :thumbsup: :sparkles:
:star: 269 | @sok213 | http://www.freecodecamp.com/sok213
Sophanarith Sok
@sok213
Aug 23 2015 01:01
@co0lguy42 Glad to help. :)
JBGuthrie
@JBGuthrie
Aug 23 2015 01:03
@SaintPeter No Go ```<div class="container-fluid">
<h3 class="text-primary text-center">jQuery Playground</h3>
<div class="row">
<div class="col-xs-6">
<h4>#left-well</h4>
<div class="well" id="left-well">
<button class="btn btn-default target" id="target1">#target1</button>
<button class="btn btn-default target" id="target2">#target2</button>
<button class="btn btn-default target" id="target3">#target3</button>
</div>
</div>
<div class="col-xs-6">
<h4>#right-well</h4>
<div class="well" id="right-well">
<button class="btn btn-default target" id="target4">#target4</button>
<button class="btn btn-default target" id="target5">#target5</button>
<button class="btn btn-default target" id="target6">#target6</button>
</div>
</div>
</div>
</div>
``` Maybe I'm putting it in the wrong place.
Rex Schrader
@SaintPeter
Aug 23 2015 01:04
@JBGuthrie I cut and pasted your code into my browser window and immediatly got the completion flag.
@JBGuthrie The ``` must be on their own line. Use Shift Enter to get a newline without sending.
JBGuthrie
@JBGuthrie
Aug 23 2015 01:04
I guess its just a bug
Rex Schrader
@SaintPeter
Aug 23 2015 01:05
@JBGuthrie You on chrome?
JBGuthrie
@JBGuthrie
Aug 23 2015 01:05
@SaintPeter Firefox
Rex Schrader
@SaintPeter
Aug 23 2015 01:05
@JBGuthrie Try a Ctrl-Click-Refresh on the page
JBGuthrie
@JBGuthrie
Aug 23 2015 01:07
@SaintPeter still not working for me. Idk what it is, but the page is constantly loading. (wheel on the tab doesn't stop"
@SaintPeter I'll just complete it on a different browser
Rex Schrader
@SaintPeter
Aug 23 2015 01:08
@JBGuthrie It sounds like there is some sort of network connectivity issue. I'm afraid I don't have any other ideas. You could try Chome
@JBGuthrie That might work
DTing
@dting
Aug 23 2015 01:11
@JBGuthrie the labels shouldnt have #
they shoudl jsut be target1, target2 etc
the text inside the button tags
Rex Schrader
@SaintPeter
Aug 23 2015 01:12
@dting His code works perfectly - he's got a browser/connectivity issue
JBGuthrie
@JBGuthrie
Aug 23 2015 01:13
@SaintPeter Chrome works a lot nicer for this, thanks for the help.
CamperBot
@camperbot
Aug 23 2015 01:14
jbguthrie sends brownie points to @saintpeter :sparkles: :thumbsup: :sparkles:
:star: 275 | @saintpeter | http://www.freecodecamp.com/saintpeter
DTing
@dting
Aug 23 2015 01:14
oh sorry you are correct
ignore me
Rex Schrader
@SaintPeter
Aug 23 2015 01:14
Never!
PenggunaPHP
@penggunaphp
Aug 23 2015 01:22
i am stuck in Bonfire: Steamroller...Please help me...
Rex Schrader
@SaintPeter
Aug 23 2015 01:23
Sure
Can you share your code?
wiki format
CamperBot
@camperbot
Aug 23 2015 01:23

:point_right: code formatting [wiki]

Inline code

This an inline `<paste code here>` code formatting with a single backtick(`) at start and end around the code.

Code Block

``` ⇦ Type 3 backticks, then press [shift + enter ⏎]

<paste your code here>,
then press [shift + enter ⏎]

``` ⇦ Type 3 backticks, then press [enter ⏎]

See also: ☛ How to type Backticks | ☯ Compose Mode | ❄ Gitter Formatting Basics

:pencil: read more about code formatting on the FCC Wiki

JBGuthrie
@JBGuthrie
Aug 23 2015 01:46
@dting nice headshot
DTing
@dting
Aug 23 2015 01:47
@JBGuthrie thats not mine. i forked N-kay's
JBGuthrie
@JBGuthrie
Aug 23 2015 01:48
@dting either way, it's nice to see a top level guy like Snowden participating at CodeCamp
odera24
@odera24
Aug 23 2015 01:58
 $(".well:nth-child(2)").addClass("animated bounce");
This is not styling my second clhild on FreeCodeCamp
What can I do about this please?
DTing
@dting
Aug 23 2015 01:59
@odera24 you need a space between .well and :nth-child
DJ
@qualitymanifest
Aug 23 2015 02:09
I'm having a similar problem, first waypoint on Jquery:
$("button").addClass("animated bounce");
Tod
@thermobee
Aug 23 2015 02:11
anyone working on the random quote machine? im looking for someone to explain how the API works
Matt Yamamoto
@MattYamamoto
Aug 23 2015 02:17
@thermobee which api are you using?
Tod
@thermobee
Aug 23 2015 02:18
I think I have the JS file set up right but I am not sure how to use the method to get a quote.
Matt Yamamoto
@MattYamamoto
Aug 23 2015 02:20
I think you just have to invoke method=getQuote by adding that to the end of the url
so for example http://api.forismatic.com/api/1.0/?method=getQuote&lang=en
Tod
@thermobee
Aug 23 2015 02:20
Ill try it
Matt Yamamoto
@MattYamamoto
Aug 23 2015 02:21
actually, you probably need to a callback to get a JSONP response, so try http://api.forismatic.com/api/1.0/?method=getQuote&lang=en&callback=?
@thermobee
Tod
@thermobee
Aug 23 2015 02:21
you can ask for JSON with the format commadn
```
var xhr = new XMLHttpRequest();
xhr.open("GET","http://api.forismatic.com/api/1.0/?method=getQuote&key=457653&format=html&lang=en",false);
xhr.send()
this is what I have so far
Davis
@ajdavis56
Aug 23 2015 02:22
in bootstrap, how would one justify an image element to the right?
(or any element
)
Cristián Berríos
@crisberrios
Aug 23 2015 02:23
pull-right class
IllusionElements
@IllusionElements
Aug 23 2015 02:23
if I have a variable and I want to insert it before my span how would I go about doing that?
(HTML)
<p><span id="c">:</span></p>

(JS)

var sessionLength = 25;
lowtyde
@lowtyde
Aug 23 2015 02:23
so i know a bit about bootstrap, html5, css, php so on. im going to complete this 800 hour program, im just starting, and already have a bug.
Cristián Berríos
@crisberrios
Aug 23 2015 02:24
which one is the bug?
IllusionElements
@IllusionElements
Aug 23 2015 02:24
@lowtyde whats the bug?
shaun2006
@shaun2006
Aug 23 2015 02:24
how is it a bugg?
DJ
@qualitymanifest
Aug 23 2015 02:24
you need to change the color to red
lowtyde
@lowtyde
Aug 23 2015 02:24
it won't let me proceed.
shaun2006
@shaun2006
Aug 23 2015 02:24
you need to make the color red, not blue
haha its always safe to assume you're wrong, not the software
lowtyde
@lowtyde
Aug 23 2015 02:24
oh im an idiot.
IllusionElements
@IllusionElements
Aug 23 2015 02:24
"Your h2 element should be red"
Cristián Berríos
@crisberrios
Aug 23 2015 02:24
lol
shaun2006
@shaun2006
Aug 23 2015 02:24
yea man its confusing cos the insstructions give you an example
lowtyde
@lowtyde
Aug 23 2015 02:25
h2 is red and i was confused and yeah.
shaun2006
@shaun2006
Aug 23 2015 02:25
but the objective is different
lowtyde
@lowtyde
Aug 23 2015 02:25
shoud have read further before wasting your time :( sorry
shaun2006
@shaun2006
Aug 23 2015 02:25
so always look at the objective and assume you're wrong, not the software
its okay. we are all in this together :D
Matt Yamamoto
@MattYamamoto
Aug 23 2015 02:25
@thermobee I've just used jQuery's getJSON method
IllusionElements
@IllusionElements
Aug 23 2015 02:25
@lowtyde sometimes it helps to read through the instructions carefully, rather than skipping it because it's prior knowledge I knwo ive done that and made stupid mistakes
lowtyde
@lowtyde
Aug 23 2015 02:26
thanks, at least i learned how to use chat xdf
CamperBot
@camperbot
Aug 23 2015 02:26
if you want to thank someone, put an @ before their name!
lowtyde
@lowtyde
Aug 23 2015 02:26
ty @IllusionElements
IllusionElements
@IllusionElements
Aug 23 2015 02:27
This message was deleted
how do i do this so I can append the 25 before the colon? I know ,html will just replace it
(HTML)
<p><span id="c">:</span></p>

(JS)

var sessionLength = 25;
to get 

<p>25<span id="c>:</span></p>
Tod
@thermobee
Aug 23 2015 02:28
@MattYamamoto hmmmm that seems to be out of my league for now.
shaun2006
@shaun2006
Aug 23 2015 02:29
i used css before
but bootstrap is so awesome
Matt Yamamoto
@MattYamamoto
Aug 23 2015 02:29
@thermobee haha, I was going to say the same thing about the xhr way. Are you using jquery for that zipline?
IllusionElements
@IllusionElements
Aug 23 2015 02:29
@thermobee you can do
$.ajax{}
DJ
@qualitymanifest
Aug 23 2015 02:30
Maybe pasting the whole window would make my earlier question make more sense:
alt
Sloth
@GitSummm
Aug 23 2015 02:30
Can someone help me out with CSS? I don't see what it exactly does
DJ
@qualitymanifest
Aug 23 2015 02:30
I tried copying/pasting what was recommended, and tried adding a semicolon, not sure what I'm missing.. anybody? Thanks
CamperBot
@camperbot
Aug 23 2015 02:30
if you want to thank someone, put an @ before their name!
Sloth
@GitSummm
Aug 23 2015 02:32
How did you upload that image
IllusionElements
@IllusionElements
Aug 23 2015 02:32
@qualitymanifest
$(document).ready(function() { $("button").addClass("animated bounce"); }); This should work
Jordan Shackelford
@JordanShackelford
Aug 23 2015 02:32
@GitSummm You might want to try completing that waypoint in a different browser if you're on chrome. I think it's bugged
James Smith
@matthew02
Aug 23 2015 02:33
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa ```````````````;qq K AJJJJ
Sloth
@GitSummm
Aug 23 2015 02:33
Yeah perhaps, the "reset" doesn't work
Jordan Shackelford
@JordanShackelford
Aug 23 2015 02:35
Has anybody done the first zipline? It seems a little too complicated for me. I can't even get a background image to fit the screen properly
DJ
@qualitymanifest
Aug 23 2015 02:36
@IllusionElements Comparing that with what I had, I don't see the difference... Tried copying and pasting your code and still nothing. Thanks though
CamperBot
@camperbot
Aug 23 2015 02:36
qualitymanifest sends brownie points to @illusionelements :sparkles: :thumbsup: :sparkles:
:star: 233 | @illusionelements | http://www.freecodecamp.com/illusionelements
IllusionElements
@IllusionElements
Aug 23 2015 02:36
@qualitymanifest it works for me :S I think your browser may just be bugged
Matt Yamamoto
@MattYamamoto
Aug 23 2015 02:36
@thermobee the jquery getJSON method is pretty straight forward, and I can get that to work with that api. I was just trying to get the xhr method to work but I keep getting a CORS error (which I assume is your issue right now). I've gotta run, otherwise I'd love to help work it out, but if you search this forum for "forismatic" you should be able to find some answers I think as I remember somebody else using that api and having issues too. Good luck!
DJ
@qualitymanifest
Aug 23 2015 02:36
Yeah I'll try firefox
Tod
@thermobee
Aug 23 2015 02:37
@matthew02 yeah its JS way. I learned it from the codeacademy website where they teach you a whole bunch of APIs
@MattYamamoto thanks dude, Ill look it up. thanks for your help
CamperBot
@camperbot
Aug 23 2015 02:37
thermobee sends brownie points to @mattyamamoto :sparkles: :thumbsup: :sparkles:
:star: 302 | @mattyamamoto | http://www.freecodecamp.com/mattyamamoto
Sloth
@GitSummm
Aug 23 2015 02:37
Is any browser recommended or is it just chrome that's faulty?
IllusionElements
@IllusionElements
Aug 23 2015 02:38
@qualitymanifest try a different browser @JordanShackelford I have why
Jordan Shackelford
@JordanShackelford
Aug 23 2015 02:38
@IllusionElements I don't know where to begin
IllusionElements
@IllusionElements
Aug 23 2015 02:39
@thermobee give this method a try, I found it alot easier to work with
$.ajax({
      url: ,
      jsonp: ,
      dataType: ,
      data: {

      },
      success: function
DJ
@qualitymanifest
Aug 23 2015 02:40
@IllusionElements Funny, yeah it worked in Firefox. I just spent a half hour on that hahaha
IllusionElements
@IllusionElements
Aug 23 2015 02:40
@JordanShackelford look at the example given and just duplicate it from the first thing you see to the last, and take a look at bootstrap's documentation for some code snippets to help you out, for example bootstrap gives you a navbar
Diego Uriarte
@diegouriarte
Aug 23 2015 02:41

Hi, could someone help me with targeting HTML Elements with Selectors Using jQuery. My code looks like this:

<script>
  $(document).ready(function() {
    $("button").addClass("animated bounce");
  });
</script>

but it does nothing. However, when I put the script at the end without the ready function it works.

Jordan Shackelford
@JordanShackelford
Aug 23 2015 02:41
@IllusionElements How do you stack background images like this? http://codepen.io/ThiagoFerreir4/pen/eNMxEp
IllusionElements
@IllusionElements
Aug 23 2015 02:41
@JordanShackelford Those backgrounds are all individual divs that have been defined in HTML/CSS
Jordan Shackelford
@JordanShackelford
Aug 23 2015 02:42
When I scroll down the top images stays in place while the next image moves up. How do I do that?
Tod
@thermobee
Aug 23 2015 02:43
@IllusionElements yeah that's what im trying. What do I type for data?
IllusionElements
@IllusionElements
Aug 23 2015 02:43
@JordanShackelford code would look something like
<div id="bg1"></div>
<div id="bg2"></div 
<div id="bg..." ></div> and so on
@thermobee the data you need
from the forismatic api
Tod
@thermobee
Aug 23 2015 02:44
Hmmmm
IllusionElements
@IllusionElements
Aug 23 2015 02:44
so for instance, I need the data to be returned in english so i'd put lang: "en";
Jami Schwarzwalder
@jschwarzwalder
Aug 23 2015 02:44
I have a question about bootstrap
Tod
@thermobee
Aug 23 2015 02:44
@IllusionElements Let me try
Jami Schwarzwalder
@jschwarzwalder
Aug 23 2015 02:45
on the mobile device how do you make a list item fill the width of the screen
IllusionElements
@IllusionElements
Aug 23 2015 02:45
@thermobee if you look on the forismatic page it provides you with a list of data types, that you can use
@IllusionElements under Request parameters: , basically what ever in that data object will be sent to forismatic as a request
@JordanShackelford position:fixed;
DJ
@qualitymanifest
Aug 23 2015 02:47
@Eiseldora I think it should just be <div class ="col-xs-12">
Tod
@thermobee
Aug 23 2015 02:47
$.ajax({
  dataType: "json",
  url: http://api.forismatic.com/api/1.0/,
  data: {
    method=getQuote,
    format=json,
    lang=en
  },
  success: success
});
How's this?
@IllusionElements
Jami Schwarzwalder
@jschwarzwalder
Aug 23 2015 02:49
I tired that but the text is tiny when I go to the website on my phone
@qualitymanifest I tried adding the class col-xs-12 col-md-6 but when I to to the phone the text is very tiny
lowtyde
@lowtyde
Aug 23 2015 02:51
cant believe im confused again :(
IllusionElements
@IllusionElements
Aug 23 2015 02:52
@thermobee perfect except those need to be strings, the way your currently putting stuff after those javascript will interpret it as variables
Tod
@thermobee
Aug 23 2015 02:53
@IllusionElements on it. what does the success do?
IllusionElements
@IllusionElements
Aug 23 2015 02:53
@thermobee the success there is basically saying if api call is successful do this,
Joe
@reitmanj
Aug 23 2015 02:53
anybody know how to reload a page using javascript in a Codepen iFrame?
Jesse Rafael Dizon
@jesserafael
Aug 23 2015 02:53
How do I return the string with first letter of each word is capitalized? Please help..
function titleCase(str) {
  return str;
}

titleCase("I'm a little tea pot");
IllusionElements
@IllusionElements
Aug 23 2015 02:54
@thermobee for instance success: function(a){ console.log("Success")} will return success if the api call is successful
Tod
@thermobee
Aug 23 2015 02:54
@IllusionElements oh sweet. I was just gonna ask how to do that lol
Im gonna keep working on it
lowtyde
@lowtyde
Aug 23 2015 02:54

i'm failing somehow trying to make h2 red <style>

.red-text h2 {
color: red;
}
</style>

Joe
@reitmanj
Aug 23 2015 02:56
@Eiseldora instead of making 12 columns in xs, try making only one - col-xs-1
DJ
@qualitymanifest
Aug 23 2015 02:57
@lowtyde unless your h2 also has the red-text it's not going to work. try it again without .red-text in front
*also has the red-text class assigned to it
Joe
@reitmanj
Aug 23 2015 02:57
has anybody finished Pomodoro Clock?
lowtyde
@lowtyde
Aug 23 2015 02:57
k trying ty
Aaron Freidus
@shadowfool
Aug 23 2015 02:58
Can someone explain to me why my second api call to openweather map keeps failing?
$(document).ready(function() {
  var country = "";
  var zip = "";
  $.getJSON('http://freegeoip.net/json/', function(location) {
      zip = location.zip_code;  
      country = location.country_code;
      var uri = "api.openweathermap.org/data/2.5/weather?zip=";
      uri = uri + zip + "," + country;

      $.getJSON(uri, function(data){
         return data
      });
    });
$('.weather').text();
$('.location').text();
});
IllusionElements
@IllusionElements
Aug 23 2015 02:58
@thermobee maybe you can even put a function there that generates the quotes randomly who knows!
lowtyde
@lowtyde
Aug 23 2015 02:58
got it ty
Matt Everson
@matteverson
Aug 23 2015 02:59
@shadowfool No http://
IllusionElements
@IllusionElements
Aug 23 2015 02:59
@shadowfool first just going to say that HTML5 has a geolocation api that autodetects you long/latitude
vanityinsanity
@vanityinsanity
Aug 23 2015 03:00
I am stuck at this exercise of jquery 'Waypoint: Target a Specific Child of an Element Using jQuery' I need to make every second element of class 'well' bounce. Is my code incorrect ?
$(".well:nth-child(2)").addClass("animated bounce");
});
Jami Schwarzwalder
@jschwarzwalder
Aug 23 2015 03:00
@reitmanj that didn't work it squished everything... trying to see if media (min-width: 320px) and (max-width: 568px) helps
Tod
@thermobee
Aug 23 2015 03:00
@IllusionElements you can do with a key= var or just not use the key data and it'll give you a random one
vanityinsanity
@vanityinsanity
Aug 23 2015 03:00
Please help! I feel like im stuck here like forever
Aaron Freidus
@shadowfool
Aug 23 2015 03:01
@matteverson ah that works, @IllusionElements I wanted to use an api to gather that data, it also has lots of other useful data that I can use for the project. Thanks both of you.
CamperBot
@camperbot
Aug 23 2015 03:01
shadowfool sends brownie points to @matteverson and @illusionelements :sparkles: :thumbsup: :sparkles:
:star: 263 | @matteverson | http://www.freecodecamp.com/matteverson
:star: 234 | @illusionelements | http://www.freecodecamp.com/illusionelements
Joe
@reitmanj
Aug 23 2015 03:02
@Eiseldora Assuming your using Codepen, make sure to insert the <meta name="viewport" content="width=device-width, initial-scale=1"> in the headtag
shaun2006
@shaun2006
Aug 23 2015 03:02
how is this wrong?!
<script>
$(document).ready(function() {});</script>

Now we're ready to learn jQuery, the most popular JavaScript tool of all time. Don't worry about JavaScript itself - we will cover it soon.

Before we can start using jQuery, we need to add some things to our HTML.

First, add a script element at the top of your page. Be sure to close it on the following line.

Your browser will run any JavaScript inside a script element, including jQuery.

Inside your script element, add this code: $(document).ready(function() { to your script. Then close it on the following line (still inside your script element) with: });

vanityinsanity
@vanityinsanity
Aug 23 2015 03:03
@shaun2006 You need to give a 'enter' between curly brackets.
shaun2006
@shaun2006
Aug 23 2015 03:03
oh
Jami Schwarzwalder
@jschwarzwalder
Aug 23 2015 03:03
@reitmanj it worked! just adding the meta. ty
shaun2006
@shaun2006
Aug 23 2015 03:03
i see "on the FOLLOWING line"
Joe
@reitmanj
Aug 23 2015 03:03
@Eiseldora :)
Justin Crawford
@JCrawford1122
Aug 23 2015 03:04
@vanityinsanity Did you figure it out?
lowtyde
@lowtyde
Aug 23 2015 03:05
going fast now :)
vanityinsanity
@vanityinsanity
Aug 23 2015 03:06
@JCrawford1122 I am still struggling with that! Can't find a way. This is the exercise I'm stuck at: http://www.freecodecamp.com/challenges/waypoint-target-a-specific-child-of-an-element-using-jquery
lowtyde
@lowtyde
Aug 23 2015 03:06
i like how this site makes you think more than codeacademy. helps me understand it a LOT more.
Lux3
@Lux3
Aug 23 2015 03:06
bf chunky monkey
CamperBot
@camperbot
Aug 23 2015 03:06

:fire:Bonfire: Chunky Monkey :link:

function chunk(arr, size) {
  // Break it up.
  return arr;
}

chunk(['a', 'b', 'c', 'd'], 2);

Write a function that splits an array (first argument) into groups the length of size (second argument) and returns them as a multidimensional array.

more info:  bf details | bf links | hint

Jared Huffstutler
@jaredhuff
Aug 23 2015 03:06
im on the lesson "bonfire: chunky monkey" will somebody assist me please. il post specifics if replied to
Lux3
@Lux3
Aug 23 2015 03:06
hint
CamperBot
@camperbot
Aug 23 2015 03:06
:construction: Spoilers are only in the Bonfire's Custom Room :point_right:
Jared Huffstutler
@jaredhuff
Aug 23 2015 03:07
nm looks likeim not th only one
shaun2006
@shaun2006
Aug 23 2015 03:07
so jQuery is formatting sensitive?
Jared Huffstutler
@jaredhuff
Aug 23 2015 03:08

function chunk(arr, size) {
// Break it up.
var aryNew = [];
for(i1 = 0; i1 < (arr.length / size); i1++){
aryNew[i1]=[i1];
for(i2 = 0; i2 <= size ; i2++){
aryNew[i1][i2] = aryNew.push(arr[i2]);
}

}
return aryNew;
}

chunk(['a', 'b', 'c', 'd'], 2);

Justin Crawford
@JCrawford1122
Aug 23 2015 03:08
@vanityinsanity try $(".target:nth-child(2)").addClass("animated bounce")
Jared Huffstutler
@jaredhuff
Aug 23 2015 03:08
thats what i came up with
vanityinsanity
@vanityinsanity
Aug 23 2015 03:08
@shaun2006 No it isn't. Try doing this in another text editor you won't face this trouble.
Tod
@thermobee
Aug 23 2015 03:08
@jaredhuff use this
wikiformat
wiki format
CamperBot
@camperbot
Aug 23 2015 03:09

:point_right: code formatting [wiki]

Inline code

This an inline `<paste code here>` code formatting with a single backtick(`) at start and end around the code.

Code Block

``` ⇦ Type 3 backticks, then press [shift + enter ⏎]

<paste your code here>,
then press [shift + enter ⏎]

``` ⇦ Type 3 backticks, then press [enter ⏎]

See also: ☛ How to type Backticks | ☯ Compose Mode | ❄ Gitter Formatting Basics

:pencil: read more about code formatting on the FCC Wiki

Tod
@thermobee
Aug 23 2015 03:09
so we can see your code better
fyrfterjr
@fyrfterjr
Aug 23 2015 03:09
blob
vanityinsanity
@vanityinsanity
Aug 23 2015 03:10
@JCrawford1122 And magic happened :) Thanks man! But why did you use '.target' ? I was using '.well' since the instructions said I gotta make every second element of class '.well' bounce. I'll appreciate if you can get me out of this confusion.
CamperBot
@camperbot
Aug 23 2015 03:10
vanityinsanity sends brownie points to @jcrawford1122 :sparkles: :thumbsup: :sparkles:
:star: 139 | @jcrawford1122 | http://www.freecodecamp.com/jcrawford1122
fyrfterjr
@fyrfterjr
Aug 23 2015 03:10
What am I doing wrong?
Jared Huffstutler
@jaredhuff
Aug 23 2015 03:10
ok thank you
CamperBot
@camperbot
Aug 23 2015 03:10
if you want to thank someone, put an @ before their name!
Jared Huffstutler
@jaredhuff
Aug 23 2015 03:11
```
Justin Crawford
@JCrawford1122
Aug 23 2015 03:11
@vanityinsanity I didn't understand it either. I don't remember why I tried that. I thought it should have been '.well' also
vanityinsanity
@vanityinsanity
Aug 23 2015 03:12
@JCrawford1122 Thanks anyways!
CamperBot
@camperbot
Aug 23 2015 03:12
vanityinsanity sends brownie points to @jcrawford1122 :sparkles: :thumbsup: :sparkles:
:warning: vanityinsanity already gave jcrawford1122 points
shaun2006
@shaun2006
Aug 23 2015 03:12
@vanityinsanity yea it seems to really hate me when i used the in-browser text editor. ill start using my own and pasting it in
vanityinsanity
@vanityinsanity
Aug 23 2015 03:13
@camperbot What is this brownie points? How do I send them? I am new here hence isn't much familiar with rules here.
fyrfterjr
@fyrfterjr
Aug 23 2015 03:13
blob
Where am I messing this up?
vanityinsanity
@vanityinsanity
Aug 23 2015 03:13
@shaun2006 That's a great move I would say! You'll learn much faster then. Good Luck!
Jared Huffstutler
@jaredhuff
Aug 23 2015 03:14
the code from chunky monkey. its totally wrong but its the best i could come up with
function chunk(arr, size) {
  // Break it up.
  var aryNew = [];
  for(i1 = 0; i1 < (arr.length / size); i1++){
    aryNew[i1]=[i1];
    for(i2 = 0; i2 <= size ; i2++){
      aryNew[i1][i2] = aryNew.push(arr[i2]);
    }

  }
  return aryNew;
}

chunk(['a', 'b', 'c', 'd'], 2);
Justin Crawford
@JCrawford1122
Aug 23 2015 03:14
@vanityinsanity Oh I see now though. We were trying to target the second element in the '.well' . The '.target' is the element that inside the '.well'. if that makes any sense
vanityinsanity
@vanityinsanity
Aug 23 2015 03:17
May be! But in that case it shouldn't be '.target' ( which connotes a class) instead it should be 'target'. What do you think? [I am just trying to have brainstorming with you]
IllusionElements
@IllusionElements
Aug 23 2015 03:18
Anyone have tips for the pomodoro zip line
Joe
@reitmanj
Aug 23 2015 03:22
@IllusionElements
What kind of info are you looking for. I'm almost done with it but ran into a problem with the reset function.
Robert
@rc242
Aug 23 2015 03:23
heyo.
Justin Crawford
@JCrawford1122
Aug 23 2015 03:27
bonfire Title Case
CamperBot
@camperbot
Aug 23 2015 03:27

:fire:Bonfire: Title Case a Sentence :link:

function titleCase(str) {
  return str;
}

titleCase("I'm a little tea pot");

Return the provided string with the first letter of each word capitalized.

more info:  bf details | bf links | hint

Justin Crawford
@JCrawford1122
Aug 23 2015 03:28
hint
CamperBot
@camperbot
Aug 23 2015 03:28
:construction: Spoilers are only in the Bonfire's Custom Room :point_right:
Raymond Ou
@hangway
Aug 23 2015 03:29
Does anyone has issue with Waypoint: Use Conditional Logic with IfElse Statements?
````
if ( myFunction() === "heads" || myFunction() === "tails"){
return(true);
}   
else {
return(false);
lowtyde
@lowtyde
Aug 23 2015 03:33
well it took me about 10 mins to realize <img class="smaller-image thick-green-border" shouldnt be "smaller-image" "thick-green-border"
DJ
@qualitymanifest
Aug 23 2015 03:33
@hangway your if / else statement needs to deal with the results of flip
tinako97
@tinako97
Aug 23 2015 03:36
@IllusionElements I finished it a few days ago. What are you stuck on?
lowtyde
@lowtyde
Aug 23 2015 03:37
ya boi im going somewhere now. http://belowtyde.ddns.net/test/cat.html
i find copying what i do locally and modifying helps.
tinako97
@tinako97
Aug 23 2015 03:38
@lowtyde It took me longer than that to see there shouldn't be a "." in the class=
lowtyde
@lowtyde
Aug 23 2015 03:44
heh
lowtyde
@lowtyde
Aug 23 2015 03:50
this beginners cat page is cracking me up.
Chad Kreutzer
@ChadKreutzer
Aug 23 2015 03:55
@hangway your function will always return true as written.
John Irle
@JohnIrle
Aug 23 2015 03:57
Could someone look at this and tell me what might be wrong?
It's for Waypoint : change the css of an element using jquery
<script>
  $(document).ready(function() {
   $("#target1").css("color", "red");
  });
</script>

<!-- You shouldn't need to modify code below this line -->

<div class="container-fluid">
  <h3 class="text-primary text-center">jQuery Playground</h3>
  <div class="row">
    <div class="col-xs-6">
      <h4>#left-well</h4>
      <div class="well" id="left-well">
        <button class="btn btn-default target" id="target1">#target1</button>
        <button class="btn btn-default target" id="target2">#target2</button>
        <button class="btn btn-default target" id="target3">#target3</button>
      </div>
    </div>
    <div class="col-xs-6">
      <h4>#right-well</h4>
      <div class="well" id="right-well">
        <button class="btn btn-default target" id="target4">#target4</button>
        <button class="btn btn-default target" id="target5">#target5</button>
        <button class="btn btn-default target" id="target6">#target6</button>
      </div>
    </div>
  </div>
</div>
and every time I refresh it crashes the website
DJ
@qualitymanifest
Aug 23 2015 04:05
@doudeman That looks exactly like mine which worked. Try a different browser?
John Irle
@JohnIrle
Aug 23 2015 04:07
Chrome should work right?
Chad Kreutzer
@ChadKreutzer
Aug 23 2015 04:07
It looks identical to my sucessful solving of it:
<script>
  $(document).ready(function() {
    $("#target1").css("color", "red");
  });
</script>

<!-- You shouldn't need to modify code below this line -->

<div class="container-fluid">
  <h3 class="text-primary text-center">jQuery Playground</h3>
  <div class="row">
    <div class="col-xs-6">
      <h4>#left-well</h4>
      <div class="well" id="left-well">
        <button class="btn btn-default target" id="target1">#target1</button>
        <button class="btn btn-default target" id="target2">#target2</button>
        <button class="btn btn-default target" id="target3">#target3</button>
      </div>
    </div>
    <div class="col-xs-6">
      <h4>#right-well</h4>
      <div class="well" id="right-well">
        <button class="btn btn-default target" id="target4">#target4</button>
        <button class="btn btn-default target" id="target5">#target5</button>
        <button class="btn btn-default target" id="target6">#target6</button>
      </div>
    </div>
  </div>
</div>
DJ
@qualitymanifest
Aug 23 2015 04:08
As soon as I started jQuery I had problems with chrome, so switched to firefox
Chad Kreutzer
@ChadKreutzer
Aug 23 2015 04:09
I haven't had any issues with Chrome, but edge doesn't want to do anything when I click that I'm done on a challenge.
Justin Crawford
@JCrawford1122
Aug 23 2015 04:13
edge doesn't work with the JavaScript waypoints
John Irle
@JohnIrle
Aug 23 2015 04:14
What is edge?
Justin Crawford
@JCrawford1122
Aug 23 2015 04:14
Microsoft's new browser
Chad Kreutzer
@ChadKreutzer
Aug 23 2015 04:16
It's a shame too. cause as much as I hate to admit it, I kinda like it.
Justin Crawford
@JCrawford1122
Aug 23 2015 04:17
I like it too, but they have some things to fix yet.
Chad Kreutzer
@ChadKreutzer
Aug 23 2015 04:18
True. my biggest headache so far is the lack of a mass select option in the new Outlook client.
And I don't find myself using Cortana. Maybe cause I'm not used to it?
Justin Crawford
@JCrawford1122
Aug 23 2015 04:24
I use Cortana a bit. It does take some getting used to.
Chad Kreutzer
@ChadKreutzer
Aug 23 2015 04:26
What sort of things are you finding her useful for vs. older methods?
Jared Huffstutler
@jaredhuff
Aug 23 2015 04:27
Bonfire: Falsey Bouncer
CamperBot
@camperbot
Aug 23 2015 04:27

:fire:Bonfire: Falsey Bouncer :link:

function bouncer(arr) {
  // Don't show a false ID to this bouncer.
  return arr;
}

bouncer([7, 'ate', '', false, 9]);

Remove all falsey values from an array.

more info:  bf details | bf links | hint

Jared Huffstutler
@jaredhuff
Aug 23 2015 04:29
hint
CamperBot
@camperbot
Aug 23 2015 04:29
:construction: Spoilers are only in the Bonfire's Custom Room :point_right:
Chad Kreutzer
@ChadKreutzer
Aug 23 2015 04:31
@jaredhuff array.filter(); is your friend.
Jared Huffstutler
@jaredhuff
Aug 23 2015 04:32
@ChadKreutzer im trying to understand it as best i can through the help file
Chad Kreutzer
@ChadKreutzer
Aug 23 2015 04:33
no worries.
Jared Huffstutler
@jaredhuff
Aug 23 2015 04:35
im not understanding how to use it i guess
Chad Kreutzer
@ChadKreutzer
Aug 23 2015 04:37
@jaredhuff what do you have so far?
Jared Huffstutler
@jaredhuff
Aug 23 2015 04:41
@ChadKreutzer nothing, im unable to <array.filter();> to execute. it keeps saying the callback isnt a function.
i wrote a function, triend using the boolean object, idk maybe i been thinking too long lol
Chad Kreutzer
@ChadKreutzer
Aug 23 2015 04:42
now you know that when you actually use filter, your replace the "array" with the name of the array you are wanting to filter, right? e.g. arr.filter(...);
Jared Huffstutler
@jaredhuff
Aug 23 2015 04:43
lol yes
Chad Kreutzer
@ChadKreutzer
Aug 23 2015 04:43
and you put the function you want to use inside the parens.
(just making sure)
Jared Huffstutler
@jaredhuff
Aug 23 2015 04:43
yes, but what function?
Chad Kreutzer
@ChadKreutzer
Aug 23 2015 04:44
one you create that returns either true or false. if it returns true for the element you are passing it, it will add it to the new array.
my standard format for a filter is array.filter(function(elem){...put your code in here...});
Jared Huffstutler
@jaredhuff
Aug 23 2015 04:45
function bouncer(arr) {
  // Don't show a false ID to this bouncer.
  function isTrue(value){
    if(Boolean(value)){
      return true;
    }
    else{
      return false;
    }
  }

  for(i = 0; i < arr.length; i++){
  arr = arr.filter(isTrue(arr[i]));  
  }

  return arr;
}

bouncer([7, 'ate', '', false, 9]);
Chad Kreutzer
@ChadKreutzer
Aug 23 2015 04:46
where elem is going to be each element of the array.
you don't need the for loop. that's the beauty of functions like filter. it iterates through the array for your.
Fuzz83
@Fuzz83
Aug 23 2015 04:48
on the reverse a string bootcamp, doesn't make any sense
deaninous
@deaninous
Aug 23 2015 04:48
A block is a set of statements wrapped in curly braces. Unlike many other languages,
blocks in JavaScript do not create a new scope, so variables should be defined at the
top of the function, not in blocks.
anyone knows what that is trying to say?
Chad Kreutzer
@ChadKreutzer
Aug 23 2015 04:49
so ditch the loop and change the arr[i] inside your filter to some other name (heck, value will work again).
@jaredhuff I hope that was helpful. I gotta log for now cause I need to head home.
Jared Huffstutler
@jaredhuff
Aug 23 2015 04:50
still says true is not a function.
function bouncer(arr) {
  // Don't show a false ID to this bouncer.
  function isTrue(value){
    if(Boolean(value)){
      return true;
    }
    else{
      return false;
    }
  }

   arr.filter(isTrue(arr));  

  return arr;
}

bouncer([7, 'ate', '', false, 9]);
@ChadKreutzer i do appreciate your assisantce, thank you
CamperBot
@camperbot
Aug 23 2015 04:50
jaredhuff sends brownie points to @chadkreutzer :sparkles: :thumbsup: :sparkles:
:star: 307 | @chadkreutzer | http://www.freecodecamp.com/chadkreutzer
Tod
@thermobee
Aug 23 2015 04:55
anyone working on the random quote generator?
Davis
@ajdavis56
Aug 23 2015 04:57
anyone working on the Ziplines?
Aaron Freidus
@shadowfool
Aug 23 2015 04:57
@ajdavis56 yup
Derek Frankel
@TuvyaYis
Aug 23 2015 05:07
anyone able to log on jsbin.com? its the only site i can't get to at the moment.
its as if my infinite loop broke my ability to get on to the site(.)
IllusionElements
@IllusionElements
Aug 23 2015 05:13
@thermobee messaged you back
Lux3
@Lux3
Aug 23 2015 05:19
var newArray = [];
function chunk(arr, size) {
  for (var i = 0; i < arr.length; i += size) {
    newArray.push(arr.slice(i, i + size)); 
  }
  return newArray;
}

chunk(['a', 'b', 'c', 'd'], 2);
what is wrong, I get the right results but still get all the red X's
bf chunky monkey
CamperBot
@camperbot
Aug 23 2015 05:19

:fire:Bonfire: Chunky Monkey :link:

function chunk(arr, size) {
  // Break it up.
  return arr;
}

chunk(['a', 'b', 'c', 'd'], 2);

Write a function that splits an array (first argument) into groups the length of size (second argument) and returns them as a multidimensional array.

more info:  bf details | bf links | hint

Lux3
@Lux3
Aug 23 2015 05:20
only thing I can figure is it returns "a","b" instead of 'a','b'
Logan Tegman
@ltegman
Aug 23 2015 05:33
@Lux3 You should be declaring the newArray variable inside of the function that is using it. I don’t know why that changes the results of the test, but it’s the best practice anyways.
Barbara H Harris
@california674
Aug 23 2015 05:34
@Lux3 try this: for(var i = 0; i < arr.length; i++) { newArr.push(arr.splice(0, size)); } if(arr.length) { newArr.push(arr); } return newArr; } chunk(['a', 'b', 'c', 'd'], 2);
IllusionElements
@IllusionElements
Aug 23 2015 05:34
@jaredhuff you're getting that because true isn't a function. when you run the isTrue function on the array it's returning true or false, hence you're trying to pass true into the arr.filter which doesn't recognize it as a function
Logan Tegman
@ltegman
Aug 23 2015 05:34
Oh, I think that matters because if it’s global then every test run is pushing to the same variable.
Barbara H Harris
@california674
Aug 23 2015 05:39

@lux3 - it should look like this: function chunk(arr, size) {
var newArr = [];
for(var i = 0; i < arr.length; i++){
newArr.push(arr.splice(0, size));
}

if (arr.length){
newArr.push(arr);
}
return newArr;
}

chunk(['a', 'b', 'c', 'd'], 2);

Robert
@rc242
Aug 23 2015 05:39
heyo.
Logan Tegman
@ltegman
Aug 23 2015 05:40
wiki format
CamperBot
@camperbot
Aug 23 2015 05:40

:point_right: code formatting [wiki]

Inline code

This an inline `<paste code here>` code formatting with a single backtick(`) at start and end around the code.

Code Block

``` ⇦ Type 3 backticks, then press [shift + enter ⏎]

<paste your code here>,
then press [shift + enter ⏎]

``` ⇦ Type 3 backticks, then press [enter ⏎]

See also: ☛ How to type Backticks | ☯ Compose Mode | ❄ Gitter Formatting Basics

:pencil: read more about code formatting on the FCC Wiki

Rabin Shrestha
@jyapujuju
Aug 23 2015 05:40
function reverseString(str) {
  str.reverse();
  return str;
}
reverseString('hello');
what to do here?? Bonfire: Reverse a String
Chad Kreutzer
@ChadKreutzer
Aug 23 2015 05:41
bf reverse a string
Robert
@rc242
Aug 23 2015 05:42
@jyapujuju strings are immutable. So, you'll need to return the reversed string.
Chad Kreutzer
@ChadKreutzer
Aug 23 2015 05:42
bf reverse
CamperBot
@camperbot
Aug 23 2015 05:42

:fire:Bonfire: Reverse a String :link:

function reverseString(str) {
  return str;
}

reverseString('hello');

Reverse the provided string.

more info:  bf details | bf links | hint

vanityinsanity
@vanityinsanity
Aug 23 2015 05:42
How do I unshift values in javascript ? I think I am not getting the correct syntax
Maor Levy
@Atixx
Aug 23 2015 05:42
@jyapujuju return that function call
Robert
@rc242
Aug 23 2015 05:42
@jyapujuju when you do str.reverse();, you're generating a string, but it's assigned to nothing.
Maor Levy
@Atixx
Aug 23 2015 05:43
@vanityinsanity what do you mean by unshift? as in .unshift()?
Barbara H Harris
@california674
Aug 23 2015 05:43
@jyapujuju
function reverseString(str) {
return str.split("").reverse().join ("");
}
reverseString('hello');
CamperBot
@camperbot
Aug 23 2015 05:43
:bulb: to format code use backticks! ``` more info
vanityinsanity
@vanityinsanity
Aug 23 2015 05:44
@Atixx Yes.please check this. I am unable to do this: http://www.freecodecamp.com/challenges/waypoint-manipulate-arrays-with-unshift
Robert
@rc242
Aug 23 2015 05:45
@jyapujuju and as @california674 hints, there's no reverse method on the String object. You can review that object and its methods @ https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String
Jami Schwarzwalder
@jschwarzwalder
Aug 23 2015 05:45
I need help with Target the same element with multiple jQuery Selectors
I don't know how to select multiple things in one line
mohamed khemaissia
@coder08
Aug 23 2015 05:46
some can help with the Reverse string ? :/
Maor Levy
@Atixx
Aug 23 2015 05:46
@vanityinsanity did you read the unshift documentation? it takes an argument that you want to put in the beginning of the array
Robert
@rc242
Aug 23 2015 05:46
@Eiseldora What do you currently have?
Jami Schwarzwalder
@jschwarzwalder
Aug 23 2015 05:46
I tried $("button" ".btn" "#target1").addClass("animated shake btn-primary");
Robert
@rc242
Aug 23 2015 05:46
@coder08 What do you currently have?
vanityinsanity
@vanityinsanity
Aug 23 2015 05:46
link please
Jami Schwarzwalder
@jschwarzwalder
Aug 23 2015 05:46
and $("button .btn #target1").addClass("animated shake btn-primary");
mohamed khemaissia
@coder08
Aug 23 2015 05:46

@rc242 function reverseString(str) {

splitString=reverseString.split("");
splitString.reverse();

var finalString=splitString[0];

document.write(finalString) ;

return str;
}

reverseString('hello');

Maor Levy
@Atixx
Aug 23 2015 05:46
@Eiseldora you can't select 3 things at a time, try the same with only one selector for each
IE: $("button").addClass()
and so on
mohamed khemaissia
@coder08
Aug 23 2015 05:47
its in Basic Algorithm Scripting 2.Bonfire: Reverse a String
Robert
@rc242
Aug 23 2015 05:48
@coder08 Your array splitString generates a reversed array, but assigns it to nothing. Perhaps you want to assign it to something.
Chad Kreutzer
@ChadKreutzer
Aug 23 2015 05:48
@california674 's code should work.
Jami Schwarzwalder
@jschwarzwalder
Aug 23 2015 05:48
I have now tried $(document).ready(function() {
$("button").addClass("animated shake btn-primary");
});
$(".btn").addClass("animated shake btn-primary");
});
$("#target1").addClass("animated shake btn-primary");
});
Not completing: Your #target1 element should have the classes animated‚ shake and btn-primary.
Robert
@rc242
Aug 23 2015 05:49
@Atixx @california674 per jquery, you can assign multiple classes using a space as a delimiter for each class.
@Atixx @california674 https://api.jquery.com/addclass/
Maor Levy
@Atixx
Aug 23 2015 05:50
@rc242 what I was talking about is that you can't have multiple jQuery selectors for one line
not the assignment
Robert
@rc242
Aug 23 2015 05:50
@Atixx ..uh, what?
Leon Feng
@leonfeng
Aug 23 2015 05:50
@Eiseldora you need to remove the animated classes before adding them to the same target or else they won't animate a second time
Robert
@rc242
Aug 23 2015 05:50
@Eiseldora If you're trying to add it to the target1 id, just use #target1
Owen
@owencampbell
Aug 23 2015 05:50

@Eiseldora You put 1 class in per call e.g.

$(#btn1”).addClass(“animated”);
$(#target2”).addClass(“shake”);

etc

Chad Kreutzer
@ChadKreutzer
Aug 23 2015 05:51
@coder08 and @jyapujuju think about it this way: you need to 1. change your string into an array (cause you can't easily flip a string) 2. flip it and 3. change it back into a string.
Barbara H Harris
@california674
Aug 23 2015 05:51
@coder08 this worked for me: function reverseString(str) {
return str.split("").reverse().join ("");
}
reverseString('hello');
Logan Tegman
@ltegman
Aug 23 2015 05:51
@california674 Please use markdown to format your code in the chat.
Robert
@rc242
Aug 23 2015 05:51
@Eiseldora What are you exactly trying to do?
@Atixx You can put multiple selectors. So, I'm not sure what you're trying to say.
Chad Kreutzer
@ChadKreutzer
Aug 23 2015 05:52
Yes, @california674 that does work. but "give a man a fish..."
mohamed khemaissia
@coder08
Aug 23 2015 05:53
@california674 thanks sister
CamperBot
@camperbot
Aug 23 2015 05:53
coder08 sends brownie points to @california674 :sparkles: :thumbsup: :sparkles:
:star: 223 | @california674 | http://www.freecodecamp.com/california674
Maor Levy
@Atixx
Aug 23 2015 05:53
@rc242 yes youre right, sorry
mohamed khemaissia
@coder08
Aug 23 2015 05:54
@ChadKreutzer i got it i didnt do the last step changing into string
Chad Kreutzer
@ChadKreutzer
Aug 23 2015 05:54
@coder08 cool.
Maor Levy
@Atixx
Aug 23 2015 05:54
but make sure to use a comma to separate them within the same ""
Robert
@rc242
Aug 23 2015 05:54
@ChadKreutzer True words. Wish more people would follow them.
Jami Schwarzwalder
@jschwarzwalder
Aug 23 2015 05:54
@rc242 ty
Robert
@rc242
Aug 23 2015 05:56
@Eiseldora I don't want to point you in the wrong direction, so if you give me the link to the waypoint, I can see if that's what they're going for. You can also review https://api.jquery.com/category/selectors to better understand how to select the element(s).
Barbara H Harris
@california674
Aug 23 2015 05:58
@coder08 you're welcome! :smile:
Robert
@rc242
Aug 23 2015 05:59
@Eiseldora ah, yes. The multiple selectors fits your needs. Good luck.
Maor Levy
@Atixx
Aug 23 2015 06:00
@Eiseldora @rc242's multiple selector is more elegant and useful, but also try to put them in 3 separate lines first, to see if it's working, then combining them for a cleaner finish
Owen
@owencampbell
Aug 23 2015 06:01
@Eiseldora @rc242 Can you please read the text prior to firing off advice.. Using multiple selectors is what you’d do in real life but the waypoint clearly states to add 1 class per JQuery call… See my above code example
Derek Frankel
@TuvyaYis
Aug 23 2015 06:01
since jsbin.com is down i can't figure out how to run code in either CodePen or JSfiddle... its so f'n ridiculous
javascript specifically that is
Chad Kreutzer
@ChadKreutzer
Aug 23 2015 06:03
@Eiseldora @rc242 I tabbed out for a while, but if that's the waypoint I think it is, I think also part of the point of having the camper put one selector in each line is to show how things can stack.
Robert
@rc242
Aug 23 2015 06:03
@Eiseldora er, wait, no. You probably only want one button. However, if you were to read the descriptions of the requirements, you'll see "Only add one class with each of your three selectors."
@owencampbell mutliple selectors has nothing to do with addClass.
Chad Kreutzer
@ChadKreutzer
Aug 23 2015 06:06
sorry: classes.
Barbara H Harris
@california674
Aug 23 2015 06:07
@Eiseldora the waypoint is telling you to add the different selector on your <script> below the $(document).ready(function() {
for example: $("button")
Maor Levy
@Atixx
Aug 23 2015 06:07
@california674 please format code when pasting
Owen
@owencampbell
Aug 23 2015 06:07
@rc242 I know but the advice you were giving was incorrect. If she wanted to target mulple elements on the page and then call addClass then she’d be able to (item1, item2, item3).addClass(className) however the waypoint is only asking her to target 1 element on the 3 page, 3 different ways but then call addClass and give it a different class per call
Robert
@rc242
Aug 23 2015 06:08
@Eiseldora additionally, the use of multiple selectors will add them to all selectors, not restricted to #target1.
Maor Levy
@Atixx
Aug 23 2015 06:08
and i'd also say dont give solutions away, otherwise there's no learing..
Robert
@rc242
Aug 23 2015 06:09
@Atixx I'm pretty sure I forwarded her to the jQuery page to review.
Maor Levy
@Atixx
Aug 23 2015 06:10
@rc242 yeah you did, was refering to @california674, my msg split in 2 :smile:
Jesse
@jctm30
Aug 23 2015 06:12
hey guys! im working on the title case a sentence. Could you take a look at my code? I feel like im missing alot of stuff...
function titleCase(str) {
var newstr = str.split(" ");
for (i=0;i<newstr.length;i++) {
if (newstr[i].charAt[0].toUpperCase()) {
newstr.join(', ');
}
}
}
Robert
@rc242
Aug 23 2015 06:12
@owencampbell Well, I did ask for the weblink, and at first glance, I thought I read it correctly, but at alas, I did not. Perhaps, you should follow your own advice and read the entire conversation I had with her.
explain format
CamperBot
@camperbot
Aug 23 2015 06:16

:point_right: code formatting [wiki]

Inline code

This an inline `<paste code here>` code formatting with a single backtick(`) at start and end around the code.

Code Block

``` ⇦ Type 3 backticks, then press [shift + enter ⏎]

<paste your code here>,
then press [shift + enter ⏎]

``` ⇦ Type 3 backticks, then press [enter ⏎]

See also: ☛ How to type Backticks | ☯ Compose Mode | ❄ Gitter Formatting Basics

:pencil: read more about code formatting on the FCC Wiki

Leon Feng
@leonfeng
Aug 23 2015 06:17
@jctm30 The tests expect your function to return the new string. You're not returning anything
@jctm30 there's a few things wrong with your function, like @leonfeng pointed out - you're not returning a value.
Justin Martin
@jmrt39
Aug 23 2015 06:29
this is line is not making the target6 id green and Ive checked its right syntax:
$('#right-well').children().css({'color', 'green'});
solved it thank you
CamperBot
@camperbot
Aug 23 2015 06:31
if you want to thank someone, put an @ before their name!
Rabin Shrestha
@jyapujuju
Aug 23 2015 06:37
function factorialize(num) {
  var sum=num;
  while (num!==0){
    sum=sum*num;
    num--;
  }
  return sum;
}
factorialize(5);
whats wrong here??
factorial
Robert
@rc242
Aug 23 2015 06:38
@jyapujuju I would recommend using a console.log(sum) to see how you're manipulating that value.
@jyapujuju Make sure you bring up the js console to see the logs. Do you know how to do that?
mohamed khemaissia
@coder08
Aug 23 2015 06:39
im getting confused in the factorialize problem me too

'function factorialize(num) {

while (num===0){
num=1; }
for(var i=1;i<=num;i++)
{
fact=1;
fact=fact*i;
num=fact;
}

return num;
}

factorialize(5);'

Logan Tegman
@ltegman
Aug 23 2015 06:41
@coder08 Please format your code using markdown
wiki format
CamperBot
@camperbot
Aug 23 2015 06:41

:point_right: code formatting [wiki]

Inline code

This an inline `<paste code here>` code formatting with a single backtick(`) at start and end around the code.

Code Block

``` ⇦ Type 3 backticks, then press [shift + enter ⏎]

<paste your code here>,
then press [shift + enter ⏎]

``` ⇦ Type 3 backticks, then press [enter ⏎]

See also: ☛ How to type Backticks | ☯ Compose Mode | ❄ Gitter Formatting Basics

:pencil: read more about code formatting on the FCC Wiki

mohamed khemaissia
@coder08
Aug 23 2015 06:42
sorry dont know how to do it
wait a minute
<function factorialize(num) { while (num===0){ num=1; } for(var i=1;i<=num;i++) { fact=1; fact=fact*i; num=fact; } return num; } factorialize(5); >
i tried shift+enter nothing happend
Binny Kim
@removed~BinnyK
Aug 23 2015 06:44
type ``` on the line before
mohamed khemaissia
@coder08
Aug 23 2015 06:44
'''
CamperBot
@camperbot
Aug 23 2015 06:44
:bulb: to format code use backticks! ``` more info
Binny Kim
@removed~BinnyK
Aug 23 2015 06:45
like this i think
the number on the left of the 1
i mean the key on the left of the 1
mohamed khemaissia
@coder08
Aug 23 2015 06:46

'''
function factorialize(num) {

while (num===0){
num=1; }
for(var i=1;i<=num;i++)
{
fact=1;
fact=fact*i;
num=fact;
}

return num;
}

factorialize(5);

CamperBot
@camperbot
Aug 23 2015 06:47
:bulb: to format code use backticks! ``` more info
Yihan Wang
@yihanwang91
Aug 23 2015 06:48
@coder08 Not sure why you're using 2 loops
@coder08 Don't think the while loop is necessary
mohamed khemaissia
@coder08
Aug 23 2015 06:49
@yihanwang91 since fact of zero =1 i think while loop is necessary
'''
<code>
'''
CamperBot
@camperbot
Aug 23 2015 06:50
:bulb: to format code use backticks! ``` more info
Binny Kim
@removed~BinnyK
Aug 23 2015 06:51
use backticks
which is on the left of the number 1 key
you are using apostrophes
Yihan Wang
@yihanwang91
Aug 23 2015 06:51
It's the same key as tilde ~
Binny Kim
@removed~BinnyK
Aug 23 2015 06:52
` copy past that little accent key at the start of this sentence 3 times
Rabin Shrestha
@jyapujuju
Aug 23 2015 06:53
function factorialize(num) {
    for(i=0;i<num;i++){
      num=num*i;
    }
  return num;
}
factorialize(5);
mohamed khemaissia
@coder08
Aug 23 2015 06:53
<code>
Rabin Shrestha
@jyapujuju
Aug 23 2015 06:53
error again
Yihan Wang
@yihanwang91
Aug 23 2015 06:54
@jyapujuju What's does it return?
mohamed khemaissia
@coder08
Aug 23 2015 06:54
<function factorialize(num) {

  while (num===0){
    num=1; }
  for(var i=1;i<=num;i++)
    {
    fact=1;
  fact=fact*i;
  num=fact;
    } 

  return num;
}

factorialize(5);
>
Yihan Wang
@yihanwang91
Aug 23 2015 06:56
@coder08 What does the factorialize(5) return when you call it?
Binny Kim
@removed~BinnyK
Aug 23 2015 06:56

@jyapujuju I think theres a couple things I can see...

First. If i = 0... your end result will be a 0 because you are multiplying everything with 0... So i think i should be 1 to start.
Second. i should be less than or equal to num because you want to include the 5

otherwise it will stop when i = 4
mohamed khemaissia
@coder08
Aug 23 2015 06:58
@yihanwang91 theresult is equal to
1
Binny Kim
@removed~BinnyK
Aug 23 2015 06:58
@coder08 I don't think the while loop is necessary
@coder08 try remove the while loop and keep everything else
Nnxoxo
@Nnxoxo
Aug 23 2015 06:59
@coder08 if num will be 0 u'll have endless loop
Yihan Wang
@yihanwang91
Aug 23 2015 07:00
@coder08 Trying declaring fact outside of the loop
mohamed khemaissia
@coder08
Aug 23 2015 07:00
i removed the while loop nothing changed
zac247
@zac247
Aug 23 2015 07:00
@coder08 u have to take fact = 1 out of the loop
mohamed khemaissia
@coder08
Aug 23 2015 07:00
@Nnutthowze no if num =0 it will only return 1
Yihan Wang
@yihanwang91
Aug 23 2015 07:00
@coder08 In your code every time the for loop runs fact gets reset to 1
mohamed khemaissia
@coder08
Aug 23 2015 07:01
@zac247 ive putted fact=1 above for loop nothing changed :/
Binny Kim
@removed~BinnyK
Aug 23 2015 07:01
try var fact = 1
then return fact
Nnxoxo
@Nnxoxo
Aug 23 2015 07:02
@coder08 while is a loop, so if num === 0 while will be looping endless
Binny Kim
@removed~BinnyK
Aug 23 2015 07:02
get rid of num = fact
mohamed khemaissia
@coder08
Aug 23 2015 07:03
@BinnyK how come the program is gonna return num in the end
maybe i d make it return fact
Binny Kim
@removed~BinnyK
Aug 23 2015 07:04
@coder08 yes you need to return fact
mohamed khemaissia
@coder08
Aug 23 2015 07:05
@BinnyK it passed finally thanks @BinnyK @Nnutthowze @yihanwang91
CamperBot
@camperbot
Aug 23 2015 07:05
coder08 sends brownie points to @binnyk and @binnyk and @nnutthowze and @yihanwang91 :sparkles: :thumbsup: :sparkles:
:star: 214 | @yihanwang91 | http://www.freecodecamp.com/yihanwang91
:star: 79 | @binnyk | http://www.freecodecamp.com/binnyk
:star: 79 | @binnyk | http://www.freecodecamp.com/binnyk
:star: 273 | @nnutthowze | http://www.freecodecamp.com/nnutthowze
Binny Kim
@removed~BinnyK
Aug 23 2015 07:05
function factorialize(num) {

    // declare fact as a variable and set to 1
    var fact = 1;

  for(var i = 1; i <= num; i++) {

      fact = fact * i;
  }
  return fact;
}

factorialize(5);
@coder08 good job
lowtyde
@lowtyde
Aug 23 2015 07:05
well i got the first 3 sections done tonight. html5 css bootstrap and jquery
jscript tmr. nite.
mohamed khemaissia
@coder08
Aug 23 2015 07:06
@BinnyK this bonfire section makes my mind blow up lol
Binny Kim
@removed~BinnyK
Aug 23 2015 07:07

Can anyone help me with the pomodoro clock challenge...
Finding a couple bits tricky...

1) my timer keeps running through continuously
2) Need to trigger the next clock to run once the first timer is finished

http://codepen.io/testingtestingtest/pen/zGVOvX?editors=001

@coder08 I'm only a few challenges ahead of where you are. I agree that its really tricky
mohamed khemaissia
@coder08
Aug 23 2015 07:08
@BinnyK yes it is
Luxan Suthaharan
@luxan14
Aug 23 2015 07:17
This message was deleted
CamperBot
@camperbot
Aug 23 2015 07:17
type bonfire name to get some info on that bonfire. And check HelpBonfires chatroom
Luxan Suthaharan
@luxan14
Aug 23 2015 07:18

function palindrome(str) {
    if(str == str.replace('').toLowerCase()) {
      return true;
    } else {
      return false;
    }
}


palindrome("eye");
need help guys!
@luxan14 Make sure to give .replace the correct parameters
Chad Kreutzer
@ChadKreutzer
Aug 23 2015 07:19
@luxan14 yes, you do. @yihanwang91 beat me to it with the first issue.
Luxan Suthaharan
@luxan14
Aug 23 2015 07:20
@yihanwang91 Thanks! :+1:
CamperBot
@camperbot
Aug 23 2015 07:20
luxan14 sends brownie points to @yihanwang91 :sparkles: :thumbsup: :sparkles:
:star: 215 | @yihanwang91 | http://www.freecodecamp.com/yihanwang91
Luxan Suthaharan
@luxan14
Aug 23 2015 07:20
@ChadKreutzer Yeah!
Chad Kreutzer
@ChadKreutzer
Aug 23 2015 07:20
when you do get the right parameters going on, I always point people to www.regexr.com and just tell them to play around with it. that's the best way to learn how regexp work.
Yihan Wang
@yihanwang91
Aug 23 2015 07:21
@ChadKreutzer Thanks for sharing!
CamperBot
@camperbot
Aug 23 2015 07:21
yihanwang91 sends brownie points to @chadkreutzer :sparkles: :thumbsup: :sparkles:
:star: 308 | @chadkreutzer | http://www.freecodecamp.com/chadkreutzer
thefacilitator
@thefacilitator
Aug 23 2015 07:21
ey people. I'm on the "Waypoint: Line up Form Elements Responsively with Bootstrap" and don't really understand what I'm supposed to be doing.
Luxan Suthaharan
@luxan14
Aug 23 2015 07:21
@ChadKreutzer Thanks :smile:
CamperBot
@camperbot
Aug 23 2015 07:21
luxan14 sends brownie points to @chadkreutzer :sparkles: :thumbsup: :sparkles:
:star: 309 | @chadkreutzer | http://www.freecodecamp.com/chadkreutzer
Yihan Wang
@yihanwang91
Aug 23 2015 07:22
thefacilitator
@thefacilitator
Aug 23 2015 07:22
The three requirements are "Nest your form submission button and text input in a div with class row", "Nest your form text input in a div with the class col-xs-7" and "Nest your form submission button in a div with the class col-xs-5".
Does that mean I'm making something up like <div class="row"><form action="/submit-cat-photo"></div>
Luxan Suthaharan
@luxan14
Aug 23 2015 07:23
@yihanwang91 yeah! it's more simple and readable :smile:
Derek Frankel
@TuvyaYis
Aug 23 2015 07:36
I found the following solution online and my question is, "what purpose and how is the null used in the following?" However I see... its used as a place holder```
function findLongestWord(str) {
    var longestStr = 0;
    for (var x=0;x<str.split(' ').length;x++){
        if (longestStr < str.split(' ')[x].length){
            longestStr = str.split(' ')[x].length;
        }
    }
    return longestStr;
}
I meant this actually: ```
function findLongestWord(str) {

  var string = str.split(' ');
  var longest = 0;
  var word = null;

  string.forEach(function(string) {

  if (longest < string.length) {

      longest = string.length;

      word = string;

  }
});

  return word.length;
}

findLongestWord('The quick brown fox jumped over the lazy dog');
PenggunaPHP
@penggunaphp
Aug 23 2015 07:37
What this means?? --> expect(bob.getFirstName()).to.eql('Happy');
expected 'Bob' to deeply equal 'Happy'
in Bonfire: Make a Person
Derek Frankel
@TuvyaYis
Aug 23 2015 07:38
tho i understand null is being used as a place holder variable
Sloth
@GitSummm
Aug 23 2015 07:39
Screenshot 2015-08-23 at 12.37.15 AM.png
What is my error trying to make the border class?
Whoa thats small
Kevin Gilpin
@KevinGilpin
Aug 23 2015 07:47
Need help with Waypoint: Target a Specific Child of an Element Using jQuery
$(".well:nth-child(2)").addClass("animated bounce");
believe that should be correct, but it's failing the first requirement of "The second element in each of your well elements should bounce."
the entire wells appear to be bouncing tho, not the button children
Ah just figured it out, i should be targeting the buttons with the nth-child selector not the parent of the buttons...
Todd Johnson
@TJohnson93
Aug 23 2015 08:05
@KevinGilpin
$(‘.target:nth-child(2)’).addClass(‘animated bounce’);
DTing
@dting
Aug 23 2015 08:17
@KevinGilpin you can put a space between .well and :nth-child
thefacilitator
@thefacilitator
Aug 23 2015 08:20
Hey, up to "Waypoint: Target the Children of an Element Using jQuery" now, and can't seem to get the code right
Brian Daub
@briandaub
Aug 23 2015 08:20
Anyone able to help with Seek and Destroy?
can you paste your code @thefacilitator
thefacilitator
@thefacilitator
Aug 23 2015 08:20
  $(document).ready(function() {
    $("#target1").css("color", "red");
    $("#target1").prop("disabled", true);
    $("#target4").remove();
    $("#target2").appendTo("#right-well");
    $("#target5").clone().appendTo("#left-well");
    $("#target1").parent().css("background-color", "red");
    $("#right-well").children().css("text-color", "green");
  });
</script>
Brian Daub
@briandaub
Aug 23 2015 08:20
what is it asking you to do?
thefacilitator
@thefacilitator
Aug 23 2015 08:20
trying to get #target6 to have green text
using the children element
Brian Daub
@briandaub
Aug 23 2015 08:21
just use 'color' instead of 'text-color'
thefacilitator
@thefacilitator
Aug 23 2015 08:21
@codeJunkie01 ha, it's always something simple! Thanks :)
CamperBot
@camperbot
Aug 23 2015 08:21
thefacilitator sends brownie points to @codejunkie01 :sparkles: :thumbsup: :sparkles:
:warning: could not find receiver for codejunkie01
Brian Daub
@briandaub
Aug 23 2015 08:21
np
Brian Daub
@briandaub
Aug 23 2015 08:35
No help on the Seek and Destroy bonfire?
CamperBot
@camperbot
Aug 23 2015 08:35
type bonfire name to get some info on that bonfire. And check HelpBonfires chatroom
Lucas Vorsteveld
@Lucashv
Aug 23 2015 08:44
hey @codeJunkie01 i finished the seek and destroy one, so I can try to help
what do you have so far?
Brian Daub
@briandaub
Aug 23 2015 08:45
RIght now I am confused about how touse the .filter() method
function destroyer(arr) {
  // Remove all the values
  var newArr = arr.filter(function(val){
  });
  return arr;
}

destroyer([1, 2, 3, 1, 2, 3], 2, 3);
Lucas Vorsteveld
@Lucashv
Aug 23 2015 08:48
ok, I didn't use the filter function to do it b/c i didn't really understand it either
I used .indexOf() and .splice() to do it and its probably not as elegant as it could be but it works
thefacilitator
@thefacilitator
Aug 23 2015 08:52
Hi again, doing javascript basics now. I need to "Use the .length property to count the number of characters in the lastName variable."
Am I doing this? lastNameLength = lastName;
sorry, lastNameLength.length = lastName;
DTing
@dting
Aug 23 2015 08:53
@thefacilitator you need to use length on the other variable
@codeJunkie01 the tricky part is using the arguments object
bf seek
CamperBot
@camperbot
Aug 23 2015 08:53

:fire:Bonfire: Seek and Destroy :link:

function destroyer(arr) {
  // Remove all the values
  return arr;
}

destroyer([1, 2, 3, 1, 2, 3], 2, 3);

You will be provided with an initial array (the first argument in the destroyer function), followed by one or more arguments. Remove all elements from the initial array that are of the same value as these arguments.

more info:  bf details | bf links | hint

DTing
@dting
Aug 23 2015 08:53
bf links
CamperBot
@camperbot
Aug 23 2015 08:53
thefacilitator
@thefacilitator
Aug 23 2015 08:54
@dting Like this? lastNameLength = lastName.length;
DTing
@dting
Aug 23 2015 08:54
@thefacilitator ya
thefacilitator
@thefacilitator
Aug 23 2015 08:55
@dting Hmm, that hasn't worked
@dting No wait, it has. Thanks!
CamperBot
@camperbot
Aug 23 2015 08:56
thefacilitator sends brownie points to @dting :sparkles: :thumbsup: :sparkles:
:star: 589 | @dting | http://www.freecodecamp.com/dting
DTing
@dting
Aug 23 2015 08:56
@thefacilitator which waypoint is this again?
ahh okay.
Brian Daub
@briandaub
Aug 23 2015 08:59
@dting I agree. I am confused as to how to put all of this together using the .filter() method and arguments object
DTing
@dting
Aug 23 2015 09:00
@codeJunkie01 you can either iterate over the elements in array and for each of those iterate over the arguments starting at index 1 or the other way around removing elements that are == to the arguments
or create an array of arguments and use indexOf to filter
Anwaar Ansari
@anwaaramjad
Aug 23 2015 09:03
can anyone help me?
Brian Daub
@briandaub
Aug 23 2015 09:04
Is this any closer to what I should be doing?
function destroyer(arr) {
  // Remove all the values
  var newArr = arr.filter(function(val, index, array){
    if(val !== arguments){
      return true;
    }else{
      return false;
    }
  });
  return arr;
}

destroyer([1, 2, 3, 1, 2, 3], 2, 3);
@anwaaramjad can you post your code?
Anwaar Ansari
@anwaaramjad
Aug 23 2015 09:06
This message was deleted

'code'

<link href="http://fonts.googleapis.com/css?family=Lobster" rel="stylesheet" type="text/css">

<style>
.red-text {
color: red;
}

h2 {
font-family: Lobster, Monospace;
}

p {
font-size: 16px;
font-family: Monospace;
}

.smaller-image {
width: 100px;
}

.thick-green-border {
border-width: 10px;
border-style: solid;
border-color: green;
}
</style>

<h2 class="red-text">CatPhotoApp</h2>

<img class="smaller-image" class="thick-green-border" src="https://bit.ly/fcc-relaxing-cat">

<p class="red-text">Kitty ipsum dolor sit amet, shed everywhere shed everywhere stretching attack your ankles chase the red dot, hairball run catnip eat the grass sniff.</p>
<p class="red-text">Purr jump eat the grass rip the couch scratched sunbathe, shed everywhere rip the couch sleep in the sink fluffy fur catnip scratched.</p>

Brian Daub
@briandaub
Aug 23 2015 09:08
use the <code> format

Anwaar Ansari
@anwaaramjad
Aug 23 2015 09:08
This message was deleted
This message was deleted
Brian Daub
@briandaub
Aug 23 2015 09:08
```
``` the shift+enter then paste code then ctrl+enter to send the message
Anwaar Ansari
@anwaaramjad
Aug 23 2015 09:09
<link href="http://fonts.googleapis.com/css?family=Lobster" rel="stylesheet" type="text/css">

<style>
  .red-text {
    color: red;
  }

  h2 {
    font-family: Lobster, Monospace;
  }

  p {
    font-size: 16px;
    font-family: Monospace;
  }

  .smaller-image {
    width: 100px;
  }

  .thick-green-border {
    border-width: 10px;
    border-style: solid;
    border-color: green;
  }
</style>

<h2 class="red-text">CatPhotoApp</h2>

<img  class="smaller-image" class="thick-green-border" src="https://bit.ly/fcc-relaxing-cat">

<p class="red-text">Kitty ipsum dolor sit amet, shed everywhere shed everywhere stretching attack your ankles chase the red dot, hairball run catnip eat the grass sniff.</p>
<p class="red-text">Purr jump eat the grass rip the couch scratched sunbathe, shed everywhere rip the couch sleep in the sink fluffy fur catnip scratched.</p>
thanks so much
CamperBot
@camperbot
Aug 23 2015 09:09
if you want to thank someone, put an @ before their name!
Brian Daub
@briandaub
Aug 23 2015 09:09
Awesome
Anwaar Ansari
@anwaaramjad
Aug 23 2015 09:10
Can't understand what the problem is
Brian Daub
@briandaub
Aug 23 2015 09:10
try using the shorthand version instead of writing out each property
Anwaar Ansari
@anwaaramjad
Aug 23 2015 09:10
?
Lucas Vorsteveld
@Lucashv
Aug 23 2015 09:11
@anwaaramjad you can just type ```
border: solid green 10px;
Anwaar Ansari
@anwaaramjad
Aug 23 2015 09:12
ohh..
lemme try that
Brian Daub
@briandaub
Aug 23 2015 09:13
you also don't need to specify two class="" things in the html tag
only use one with both classes inside of it seperated by a space
Anwaar Ansari
@anwaaramjad
Aug 23 2015 09:13
@codeJunkie01 Thanks! That did the trick!
CamperBot
@camperbot
Aug 23 2015 09:13
anwaaramjad sends brownie points to @codejunkie01 :sparkles: :thumbsup: :sparkles:
:star: 223 | @codejunkie01 | http://www.freecodecamp.com/codejunkie01
Brian Daub
@briandaub
Aug 23 2015 09:13
ie class="thick-green-border smaller=image"
Anwaar Ansari
@anwaaramjad
Aug 23 2015 09:13
@Lucashv Thanks too
CamperBot
@camperbot
Aug 23 2015 09:13
anwaaramjad sends brownie points to @lucashv :sparkles: :thumbsup: :sparkles:
:star: 224 | @lucashv | http://www.freecodecamp.com/lucashv
Brian Daub
@briandaub
Aug 23 2015 09:13
awesome
Lucas Vorsteveld
@Lucashv
Aug 23 2015 09:15
np
Brian Daub
@briandaub
Aug 23 2015 09:15
Alright so on the Seek and Destroy this is where I am at. It adds 1 to my array but won't do it for both instances.
function destroyer(arr) {
  // Remove all the values
  var newArr = arr.filter(function(val, index, array){
    if(val === arguments[index]){
      return true;
    }else{
      return false;
    }
  });
  arr = newArr;
  return arr;
}

destroyer([1, 2, 3, 1, 2, 3], 2, 3);
Lucas Vorsteveld
@Lucashv
Aug 23 2015 09:17
I think you need to use a for loop to go through the whole array
i don't think filter does it automatically
Shouvik Roy
@royshouvik
Aug 23 2015 09:18
@codeJunkie01 index is the current index of the array
@Lucashv filter iterates through an array automatically, thats the whole point of filter
Lucas Vorsteveld
@Lucashv
Aug 23 2015 09:19
oh wow, sorry @codeJunkie01 for the bad info, thanks @royshouvik for the correction
CamperBot
@camperbot
Aug 23 2015 09:19
lucashv sends brownie points to @codejunkie01 and @royshouvik :sparkles: :thumbsup: :sparkles:
:star: 183 | @royshouvik | http://www.freecodecamp.com/royshouvik
:star: 224 | @codejunkie01 | http://www.freecodecamp.com/codejunkie01
Shouvik Roy
@royshouvik
Aug 23 2015 09:20
@codeJunkie01 you want to remove the values passed in arguments , so you would return false for them
@codeJunkie01
function destroyer(arr) {
  // Remove all the values
  var destroy = arguments[1];
  var newArr = arr.filter(function(val, index, array){
    if(val === destroy){
      return false;
    }else{
      return true;
    }
  });
  arr = newArr;
  return arr;
}
// > undefined

destroyer([1, 2, 3, 1, 2, 3], 2, 3);
// > [ 1, 3, 1, 3 ]
so I just picked up one parameter, but you need to make it so that it can additional params
Brian Daub
@briandaub
Aug 23 2015 09:26
Yeah because that gives me [1,3,1,3}
DTing
@dting
Aug 23 2015 09:37
make a for loop that iterates over arguments
for (var i = 1; i < arguments.length; i++) {
   // do stuff here
}
Brian Daub
@briandaub
Aug 23 2015 09:41
Doesnt work
function destroyer(arr) {
  // Remove all the values
  var newArr = arr.filter(function(val, index, array){
    for(var i = 1; i < arguments.length; i++){
      if(val !== arguments[i]){
        return false;
      }else{
        return true;
      }
    }
  });
  console.log(newArr);
  arr = newArr;
  return arr;
}

destroyer([1, 2, 3, 1, 2, 3], 2, 3);
I also did arguments[i]+1
Shouvik Roy
@royshouvik
Aug 23 2015 09:42
use the for loop before filter
and store all arguments in an array
can you do that?
DTing
@dting
Aug 23 2015 09:43
thats not necessary
Brian Daub
@briandaub
Aug 23 2015 09:43
I dont see why you would do that
DTing
@dting
Aug 23 2015 09:43
but ya put the filter inside the for rather than the for inside the filter
or dont return if true
until after the for loop
vanityinsanity
@vanityinsanity
Aug 23 2015 09:43
how to find factorial of a number in javascript ?
DTing
@dting
Aug 23 2015 09:44
@codeJunkie01 right now you will never reach the second argument because you always either return true or false during the first iteration
@vanityinsanity you can do it recursively or with a for or while loop.
vanityinsanity
@vanityinsanity
Aug 23 2015 09:44
someone help me
Shouvik Roy
@royshouvik
Aug 23 2015 09:45
@codeJunkie01 arguments is different than what you think inside the filter
vanityinsanity
@vanityinsanity
Aug 23 2015 09:45
but how? any example?
DTing
@dting
Aug 23 2015 09:45
@codeJunkie01 oh ya you need to alias the arguments object to a var for nice catch @royshouvik
Brian Daub
@briandaub
Aug 23 2015 09:46
I cant do a function inside of a loop
DTing
@dting
Aug 23 2015 09:47
@vanityinsanity pseudo code for a loop version
var result = 1;
for i = 2 to n:
   result *=i
return result
Shouvik Roy
@royshouvik
Aug 23 2015 09:47
@vanityinsanity
function fact(n){

 var result = n > 1 ?  n * fact(n-1) :  1;
 return result;
}


fact(5);
Brian Daub
@briandaub
Aug 23 2015 09:50
Ok but I dont get how you are using both parameters for the arguments object in a var
That was never explained.
You also said do the function in a for loop and I cant
So I am even MORE lost
Shouvik Roy
@royshouvik
Aug 23 2015 09:51
@codeJunkie01 before doing the filter, can you do a for a loop and store all the arguements in an array?
Brian Daub
@briandaub
Aug 23 2015 09:51
what does that do?
Shouvik Roy
@royshouvik
Aug 23 2015 09:51
because you will need it inside the filter
Brian Daub
@briandaub
Aug 23 2015 09:51
That gives me [[1, 2, 3, 1, 2, 3] 2, 3]
Shouvik Roy
@royshouvik
Aug 23 2015 09:52
right, can you make it so that it doesn't store the first element?
you want something like [2,3]
Brian Daub
@briandaub
Aug 23 2015 09:52
Ah I see so for var i = 1
Shouvik Roy
@royshouvik
Aug 23 2015 09:53
yes :)
then inside the filter , you just want to check if element is present in this array you created
DTing
@dting
Aug 23 2015 09:53
@codeJunkie01 you dont even need to iterate over arguments to make it available:
function destroyer(arr) {
  var args = arguments; // This is needed because the callback function for filter has it's own arguments object
  var newArr = arr.filter(function(val, index, array){
    for(var i = 1; i < args.length; i++){
      // something here
    }
  });
  console.log(newArr);
  arr = newArr;
  return arr;
}
Shouvik Roy
@royshouvik
Aug 23 2015 09:54
@dting but then you are iterating on it inside the filter
DTing
@dting
Aug 23 2015 09:55
how would you check if an element is present in the array inside?
you could create a hash object.
Shouvik Roy
@royshouvik
Aug 23 2015 09:55
array.indexOf(element)
DTing
@dting
Aug 23 2015 09:55
that iterates over array anyways
Deepanshu Kaushik
@daksh844
Aug 23 2015 09:55
@dting I'm having trouble with #144 chapter, here is the screenshot :
blob
Shouvik Roy
@royshouvik
Aug 23 2015 09:57
@dting after we got our array of additional params, we can just check using indexOf inside filter
@codeJunkie01 :) but do you follow what's needed?
DTing
@dting
Aug 23 2015 09:57
indexOf is O(n) time complexity it basically iterates the array you would want to make an object like this:
function destroyer(arr) {
  var hash = Object.create(null);
  for (var i = 0; i < arguments.length; i++) {
    hash[arguments[i]] = true;
  }
  return arr.filter(function(val){
    return val in hash;
  });
}
@daksh844 put the }); on it's own line
Shouvik Roy
@royshouvik
Aug 23 2015 09:58
@dting my concern was not about computational complexity but about making the solution less complex and easy to understand for @codeJunkie01
DTing
@dting
Aug 23 2015 10:00
@royshouvik i'd argue that indexOf is a more advanced concept than a for loop but i guess its debatable.
Brian Daub
@briandaub
Aug 23 2015 10:01
I am not sure what you are doing in your example @dting
zngit
@zngit
Aug 23 2015 10:02
everything works fine until the part Basic JavaScript, nothing happens when i click the button Run Code??? Tried on different browsers but nothing changed.
DTing
@dting
Aug 23 2015 10:02
@codeJunkie01 ignore that example for now
you are really close to your solution
duub qnnp
@duub
Aug 23 2015 10:02
@zngit neither the black box on the left side?
there you should see the values updated to the changes you made
DTing
@dting
Aug 23 2015 10:03
@zngit did you try a non edge non ie browser?
zngit
@zngit
Aug 23 2015 10:04
tried on edge and firefox, windows 10. http://i.imgur.com/EY9Px59.png
i guess for this challenge, i only need to make javascript comments with 2 styles of comment, then click run code, right?
Brian Daub
@briandaub
Aug 23 2015 10:05
Yeah I just dont think I will ever understand JavaScript
This doesn't make any sense to me
DTing
@dting
Aug 23 2015 10:06
@codeJunkie01 haha javascript is confusing at first but you are really close to your answer. It has really weird parts, but also includes pretty sane parts
Brian Daub
@briandaub
Aug 23 2015 10:07
function destroyer(arr) {
  // Remove all the values
  var destroy = [];
  for(var i = 1; i < arguments.length; i++){
    destroy.push(arguments[i]);
  }
  console.log(destroy);
  var newArr = arr.filter(function(val, index, array){
      if(val !== destroy){
         return true;
      }else{
         return false;
      }
  });
  console.log(newArr);
  arr = newArr;
  return arr;
}

destroyer([1, 2, 3, 1, 2, 3], 2, 3);
duub qnnp
@duub
Aug 23 2015 10:07
@zngit yes, but when I tried your code It didn’t work to me
@zngit Try to remove the last * of the second line
then it worked to me
@zngit or add a /
and complete the comment
vanityinsanity
@vanityinsanity
Aug 23 2015 10:08
can somebody explain me the 5th line of code?
function factorialize(num) {
if(num == 0) {
return 1
} else {
return num * factorialize(num - 1);
}
}
factorialize(5);
factorialize(10);
factorialize(20);
DTing
@dting
Aug 23 2015 10:08
@codeJunkie01
function destroyer(arr) {
  // Remove all the values
  var destroy = [];
  for(var i = 1; i < arguments.length; i++){
    destroy.push(arguments[i]);
  }
  console.log(destroy);
  var newArr = arr.filter(function(val, index, array){
// This code needs to be changed
      if(val !== destroy){
         return true;
      }else{
         return false;
      }
// stop
  });
  console.log(newArr);
  arr = newArr;
  return arr;
}
Brian Daub
@briandaub
Aug 23 2015 10:09
I have changed that code to everything I can think to change it to and nothing woirks
vanityinsanity
@vanityinsanity
Aug 23 2015 10:09
how is iteration of numbers taking place in this code to find the factorial
Brian Daub
@briandaub
Aug 23 2015 10:09
so I dont get what I need to do
DTing
@dting
Aug 23 2015 10:09
you can use indexOf like @royshouvik suggested
right now you are comparing a number value to an array which is always false.
you can either use indexOf or iterate over your destroy array and check if that value is in there
zngit
@zngit
Aug 23 2015 10:10
@dting could you please give me a screenshot of a code that works for the challenge http://www.freecodecamp.com/challenges/waypoint-comment-your-javascript-code ? maybe there're something wrong with my browsers.
duub qnnp
@duub
Aug 23 2015 10:11
@vanityinsanity the code moves to the line 9: factorialize(5);
and enters the factorialize function
Brian Daub
@briandaub
Aug 23 2015 10:11
I have already trie if(val !== destroy[index]) and that doesnt work
DTing
@dting
Aug 23 2015 10:11
// This is a comment.
/* This is also a comment */
@codeJunkie01 thats not how indexOf works
duub qnnp
@duub
Aug 23 2015 10:11
executes all the code and when reaches the return line then calls again the factorialize funcion but now with the value 4 (5-1)
Bastien Lemaire
@blemaire
Aug 23 2015 10:11
@dting you were close earlier...
function destroyer(arr) {
  var hash = [];

  for (var i = 1; i < arguments.length ; i++ ) {
    hash.push(arguments[i]);
  }

  return arr.filter(function(value) {
    return hash.indexOf(value) === -1;
  });
 }

destroyer([1, 2, 3, 1, 2, 3], 2, 3);
zngit
@zngit
Aug 23 2015 10:11
it's not working!!!
DTing
@dting
Aug 23 2015 10:12
@blemaire thats an array again
Bastien Lemaire
@blemaire
Aug 23 2015 10:12
do you not want to use an array?
duub qnnp
@duub
Aug 23 2015 10:13
@vanityinsanity then repeat this process till reaches the value 0 then returns 1 (the other return)
DTing
@dting
Aug 23 2015 10:13
That code snippet was using a hash object as a set.
zngit
@zngit
Aug 23 2015 10:14
my code is running fine in things like notepad++, or other editor, and browser but somehow the included editor in freecodecamp is not working now, hmm ... maybe i'll try again after a few days
DTing
@dting
Aug 23 2015 10:15
@zngit did you try chrome?
Brian Daub
@briandaub
Aug 23 2015 10:15
FINALLY!
That was awful
duub qnnp
@duub
Aug 23 2015 10:16
and when you get the 1 you get that factorialize(0)=1, factorialize(1)= 1factorialize(0)… til factorialize(5) = 5factorialize(4)factorialize(3)factorialize(2)factorialize(1)factorialize(0)
ouch… the * where replaced by italic...
@vanityinsanity and just have to replace each factorialize(n) by its result
@vanityinsanity did I explained in a way you could understand?
zngit
@zngit
Aug 23 2015 10:18
@dting chrome WORKS !!! that's strange, thank you anyway.
CamperBot
@camperbot
Aug 23 2015 10:18
zngit sends brownie points to @dting :sparkles: :thumbsup: :sparkles:
:star: 591 | @dting | http://www.freecodecamp.com/dting
zngit
@zngit
Aug 23 2015 10:19
must be something incompatible with edge and firefox 40, i guess ... hmm ...
DTing
@dting
Aug 23 2015 10:20
i know edge doesnt work with the javascript one i didnt know about firefox
Shouvik Roy
@royshouvik
Aug 23 2015 10:20
@codeJunkie01 :clap:
here is one more way to do the same thing
function destroyer(arr) {
    // Remove all the values
    var args = Array.prototype.slice.call(arguments);
    var destroy = args.filter(function(element) {
        if (Array.isArray(element))
            return false;
        else
            return true;
    });

    var newArr = arr.filter(function(val, index, array) {

        if (destroy.indexOf(val) < 0) {
            return true;
        } else {
            return false;
        }
    });
    return newArr;
}
// > undefined

destroyer([1, 2, 3, 1, 2, 3], 2, 3);
// > [ 1, 1 ]
Brian Daub
@briandaub
Aug 23 2015 10:21
I dont know why I cant understand it
Maybe I am just not a programmer
Shouvik Roy
@royshouvik
Aug 23 2015 10:21
@codeJunkie01 the first line simply converts the arguments object to an array
then we filter the args array, to remove any element which is of type array
DTing
@dting
Aug 23 2015 10:22
function destroyer(arr) {
  var args = arguments; // This is needed because the callback function for filter has it's own arguments object
  return arr.filter(function(val){
    for(var i = 1; i < args.length; i++){
      if (args[i] === val) {
        return false;
      }
    }
    return true;
  });
}
@codeJunkie01 thats your solution with the missing code between those lines
duub qnnp
@duub
Aug 23 2015 10:23
@zngit I have a plugin that make js crash with ffx, but now I’m using it (with the extension disabled) and it’s working fine with the js exercices
Shouvik Roy
@royshouvik
Aug 23 2015 10:23
Thats much more simpler and elegant @dting
but I thought it would mess up his mind trying to understand loop inside filter
Bastien Lemaire
@blemaire
Aug 23 2015 10:24
@dting you shouldn't have the return true; statement at the end, it will never get hit
Brian Daub
@briandaub
Aug 23 2015 10:25
function destroyer(arr) {
  // Remove all the values
  var destroy = [];
  for(var i = 1; i < arguments.length; i++){
    destroy.push(arguments[i]);
  }
  console.log(destroy);
  var newArr = arr.filter(function(val, index, array){
      if(destroy.indexOf(val) !== -1){
         return false;
      }else{
         return true;
      }
  });
  console.log(newArr);
  arr = newArr;
  return arr;
}

destroyer([1, 2, 3, 1, 2, 3], 2, 3);
thats what solved it
DTing
@dting
Aug 23 2015 10:25
@blemaire it will get hit if all the arguemnts are iterated and none of them are === val which is what i want
zngit
@zngit
Aug 23 2015 10:25
@duub thanks, i guess i understand the situation more.
CamperBot
@camperbot
Aug 23 2015 10:25
zngit sends brownie points to @duub :sparkles: :thumbsup: :sparkles:
:star: 145 | @duub | http://www.freecodecamp.com/duub
Bastien Lemaire
@blemaire
Aug 23 2015 10:26
@dting can you send me what you're passing to the function to hit that line?
Shouvik Roy
@royshouvik
Aug 23 2015 10:27
@blemaire destroyer([1, 2, 3, 1, 2, 3], 2, 3); should hit the last return twice
Bastien Lemaire
@blemaire
Aug 23 2015 10:28
@dting apologies, I thought the return statement was outside the filter method ...
i'm used to 4 spaces identation gotta get used to reading with only 2...
DTing
@dting
Aug 23 2015 10:29
heh
@codeJunkie01 :thumbsup:
Fabricio Leal
@pharaohlxvi
Aug 23 2015 10:53
Hi there! Anyone could help me with a bonfire, please?
Never mind. Sorted! Kinda funny, over an hour looking for a solution and it comes a few seconds after I ask for help :)
Ji Hoon Sherk
@jhsherk1995
Aug 23 2015 11:17
Hi, need some help for Bonfire when reversing a string. Should I create a For loop for it?
Lucas Vorsteveld
@Lucashv
Aug 23 2015 11:20
@jhsherk1995 I believe you want to put the individual letters into an array and then reverse the array so I don't think you need a for loop but i could be wrong, which bonfire is it?
DTing
@dting
Aug 23 2015 11:20
bf reverse
CamperBot
@camperbot
Aug 23 2015 11:20

:fire:Bonfire: Reverse a String :link:

function reverseString(str) {
  return str;
}

reverseString('hello');

Reverse the provided string.

more info:  bf details | bf links | hint

DTing
@dting
Aug 23 2015 11:20
bf links
Lucas Vorsteveld
@Lucashv
Aug 23 2015 11:21
oh and then you take the letters back out of the array and put them into a string
DTing
@dting
Aug 23 2015 11:21
@jhsherk1995 check out those MDN links
KieronDowie
@KieronDowie
Aug 23 2015 11:21

Hey could someone help me out with a problem I'm having in a side project? :) I'm obviously misunderstanding how = works in javascript.

var a = [1, 2];
var b = a;
b.splice(0,1);
console.log(a);

The above outputs [2], when I'd expect it to output [1,2], why is this?

Lucas Vorsteveld
@Lucashv
Aug 23 2015 11:23
@KieronDowie yeah that is strange, I think I had a similar problem to that before and I couldn't figure it out
KieronDowie
@KieronDowie
Aug 23 2015 11:24
@Lucashv Yeah, I think it has something to do with how = and splice work, but I don't understand it.
DTing
@dting
Aug 23 2015 11:24
@KieronDowie you arent making a copy when you do var b = a;
KieronDowie
@KieronDowie
Aug 23 2015 11:25
@dting So = is actually assigning it so that all operations I do on b happen to a too?
DTing
@dting
Aug 23 2015 11:25
@KieronDowie you just create another variable that points to the same array that var a does in memory
KieronDowie
@KieronDowie
Aug 23 2015 11:25
Okay then, thanks. What is the correct way to make a copy in js?
CamperBot
@camperbot
Aug 23 2015 11:25
if you want to thank someone, put an @ before their name!
KieronDowie
@KieronDowie
Aug 23 2015 11:25
@camperbot Thanks. :P
DTing
@dting
Aug 23 2015 11:26
shallow copy can be made with slice
KieronDowie
@KieronDowie
Aug 23 2015 11:26
So, var b=a.slice( 0 , a.length); ?
Is that the normal way?
DTing
@dting
Aug 23 2015 11:27
var b = a.slice();
KieronDowie
@KieronDowie
Aug 23 2015 11:28
Oh, nice, thanks
CamperBot
@camperbot
Aug 23 2015 11:28
if you want to thank someone, put an @ before their name!
KieronDowie
@KieronDowie
Aug 23 2015 11:28

@dting Thank you.
CamperBot
@camperbot
Aug 23 2015 11:28
kierondowie sends brownie points to @dting :sparkles: :thumbsup: :sparkles:
:star: 593 | @dting | http://www.freecodecamp.com/dting
Lucas Vorsteveld
@Lucashv
Aug 23 2015 11:28
@dting thanks that is good to know
DTing
@dting
Aug 23 2015 11:28
bunch of different ways and it depends on what kind of copy you need http://stackoverflow.com/questions/7486085/copying-array-by-value-in-javascript
jb299
@jb299
Aug 23 2015 11:30
b.splice[a];
Deepanshu Kaushik
@daksh844
Aug 23 2015 11:47
can somebody please guide me if I need to take the javascript course first on codeacademy rather than on FCC - as I'm trying on FCC and not able to figure out anything.
DTing
@dting
Aug 23 2015 11:51
@daksh844 what are you working on?
Deepanshu Kaushik
@daksh844
Aug 23 2015 11:52
@dting just started with JavaScript
DTing
@dting
Aug 23 2015 11:53
what's got you stuck?
Deepanshu Kaushik
@daksh844
Aug 23 2015 11:53
@dting But not able to figure out as steps are more complex than jQuery and more over less explanation is provided
Why are we using these functions assert statement and the rest provided in 2-5 chapter of JavaScript
DTing
@dting
Aug 23 2015 11:55
im not sure i understand what you mean? what assert statements
Ammar Ali Shah
@AmmarAliShah
Aug 23 2015 11:57
Need some help
DTing
@dting
Aug 23 2015 12:00
Screen Shot 2015-08-23 at 4.59.38 AM.png
@daksh844 read the directions above the green run box
the assert statements let you know if you have completed the challenge
Ammar Ali Shah
@AmmarAliShah
Aug 23 2015 12:01
Need help with Bonfire: Title Case a Sentence
CamperBot
@camperbot
Aug 23 2015 12:01
type bonfire name to get some info on that bonfire. And check HelpBonfires chatroom
Ammar Ali Shah
@AmmarAliShah
Aug 23 2015 12:02
Bonfire: Title Case a Sentence
CamperBot
@camperbot
Aug 23 2015 12:02

:fire:Bonfire: Title Case a Sentence :link:

function titleCase(str) {
  return str;
}

titleCase("I'm a little tea pot");

Return the provided string with the first letter of each word capitalized.

more info:  bf details | bf links | hint

Ammar Ali Shah
@AmmarAliShah
Aug 23 2015 12:02
hint
CamperBot
@camperbot
Aug 23 2015 12:02
:construction: Spoilers are only in the Bonfire's Custom Room :point_right:
dablar
@dablar
Aug 23 2015 12:02

I guys!
I am doing a voting app using angular fullstack (used yeoman).
I created an end point /api/polls (yo angular-fullstack:endpoint poll) to get all polls
I want to restrict this endpoint only for auth users so I did:

// server/api/poll/index.js
...
router.get('/', auth.isAuthenticated(),controller.index);
...

But everytime I go to /api/polls url I get this error message: UnauthorizedError: No authorization token was found
at middleware ....bla bla bla

Anybody knows hot to fix that?? where is the problem???

Thnxxx a lot!!!

CamperBot
@camperbot
Aug 23 2015 12:02
:trollface: troll problems? notify admins here
DTing
@dting
Aug 23 2015 12:08
@dablar are you logged in?
Deepanshu Kaushik
@daksh844
Aug 23 2015 12:09
blob
@dting I'm writing this code:welcomeToBooleans()===true; - and below is my screenshot can you let me know what exactly I'm getting wrong:
DTing
@dting
Aug 23 2015 12:11
@daksh844 that line of code will never be evaluated
@daksh844 it is below a non condition return statement
@daksh844 follow to instruction above the green run button
@daksh844 it wants you to make the function return true instead of false.
Deepanshu Kaushik
@daksh844
Aug 23 2015 12:12
ohh was it this simple got it. thanka @dting
dablar
@dablar
Aug 23 2015 12:17
@dting yeah :)
DTing
@dting
Aug 23 2015 12:20
@dablar you got a link to your git repo?
Michael Bomholt
@bomholtm
Aug 23 2015 12:31
does anyone got advice for resources on sass and foundation? really would enjoy a mini course or something like that to get more into it
Soumya Rauth
@soumyaRauth
Aug 23 2015 12:42
How can I post a tweet from my website... Do I need to use twitter api.
?
Anna Presnyakova
@chiffenok
Aug 23 2015 12:43
This message was deleted
Hi guys I need to make bonfire with odd numbers in Fibonacci sequence and I have a question, I want to do it with map function just to practice
function sumFibs(num) {
    var fibs = [0, 1];
    var sumOddFibs = 0;
    for (var i = 2; i <= num; i++) {
        fibs[i] = fibs[i-1] + fibs[i-2]
    };
    console.log(fibs);
    sumOddFibs = fibs.map(function(val){
        return val%2 === 1 ? sumOddFibs +=val : sumOddFibs;
    });
    var lenSumOddFibs = sumOddFibs.length;
  return sumOddFibs[lenSumOddFibs-1];
}
It works but the question is how to in map function return only last sumOddFibs ? coz it gives me the whole array , that's why I put
var lenSumOddFibs = sumOddFibs.length;
  return sumOddFibs[lenSumOddFibs-1];
but it seems for me that should be shorter solution to return last element in map function, how can I do this??
DTing
@dting
Aug 23 2015 12:49
@chiffenok does that give you the sum?
doesn't that just give you the last one?
you probably just want to use filter there instead of map
Anna Presnyakova
@chiffenok
Aug 23 2015 12:52
yes, but map function returns array of calculation sum on each step of array, the last one is the answer
DTing
@dting
Aug 23 2015 12:52
oh i see what you are doing
Anna Presnyakova
@chiffenok
Aug 23 2015 12:52
I wanted to practice map that's why I used it)
the code is working I just want to make it better )
DTing
@dting
Aug 23 2015 12:54
you cant get map to just return the last value. you have to do it the way you are doing it now.
map creates another array with an element for each value in your array.
Anna Presnyakova
@chiffenok
Aug 23 2015 12:55
Maybe I am wrong, but for me it's seems like there should be solution to return sum in map function without using 2 last string, but I don't know how
DTing
@dting
Aug 23 2015 12:55
you would use reduce
Anna Presnyakova
@chiffenok
Aug 23 2015 12:56
ok I'll try it now
DTing
@dting
Aug 23 2015 13:03
bf fib
CamperBot
@camperbot
Aug 23 2015 13:03

:fire:Bonfire: Sum All Odd Fibonacci Numbers :link:

function sumFibs(num) {
  return num;
}

sumFibs(4);

Return the sum of all odd Fibonacci numbers up to and including the passed number if it is a Fibonacci number.

more info:  bf details | bf links | hint

DTing
@dting
Aug 23 2015 13:04
@chiffenok looks like you are generating num fib terms rather than fib terms up to num
Anna Presnyakova
@chiffenok
Aug 23 2015 13:08
what do u mean ? I can get it, I made it with reduce but it returns wrong numbers, the small ones I checked everything seems to be fine , but wrong on big numbers
DTing
@dting
Aug 23 2015 13:08
it probably overflows the number
Aaron Freidus
@shadowfool
Aug 23 2015 13:08
Can you post a pic of it failing with a large number?
That way we can do the math backwards and see where it's failing
DTing
@dting
Aug 23 2015 13:08
the bonfire wants sum of fib turns up to num. you are generating num terms
Anna Presnyakova
@chiffenok
Aug 23 2015 13:10
I can get what you mean by that, can u reformulate this please ?
DTing
@dting
Aug 23 2015 13:10
so if num is 10. you generate: Array [0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55] when really you should only be generating [0,1,1,2,3,4,8]
Anna Presnyakova
@chiffenok
Aug 23 2015 13:11
ok...
DTing
@dting
Aug 23 2015 13:12

if num is 20 you generate:

0: 0
1: 1
2: 1
3: 2
4: 3
5: 5
6: 8
7: 13
8: 21
9: 34
10: 55
11: 89
12: 144
13: 233
14: 377
15: 610
16: 987
17: 1597
18: 2584
19: 4181
20: 6765

when you should have:
[0, 1, 1, 2, 3, 5, 8, 13]

Anna Presnyakova
@chiffenok
Aug 23 2015 13:15
yes now I got it I'm fixing it)
Soumya Rauth
@soumyaRauth
Aug 23 2015 13:21
I want to post a auto generated tweet from my website. I used web intent for this but cannot pass a tweet returned from a javascript function... How can I do that? I am postint the jQuery function below.
$('#tweet').click(function(){
  window.open("https://twitter.com/intent/tweet?text=generator();");
generator is my function.
DTing
@dting
Aug 23 2015 13:22
@soumyaRauth you want to concat the result of generator() with the url not put it in the string
$('#tweet').click(function(){
  window.open("https://twitter.com/intent/tweet?text=" + generator());
});
Anna Presnyakova
@chiffenok
Aug 23 2015 13:29
@dting thank you
CamperBot
@camperbot
Aug 23 2015 13:29
chiffenok sends brownie points to @dting :sparkles: :thumbsup: :sparkles:
:star: 598 | @dting | http://www.freecodecamp.com/dting
Anna Presnyakova
@chiffenok
Aug 23 2015 13:30
I did it like this :
function sumFibs(num) {
    var fibs = [0, 1];
    var sumOddFibs = 0;
    for (var i = 2; i <= num; i++) {
        var currF = fibs[i-1] + fibs[i-2];
        if (currF<=num) fibs[i] = currF;
    }
    return sumOddFibs = fibs.reduce(function(prev, curr){
        return curr%2 === 1 ? sumOddFibs +=curr : sumOddFibs;
    });
}
Rabin Shrestha
@jyapujuju
Aug 23 2015 13:31
function factorialize(num) {
  for(i=1;i<num;i++){
      num=num*i;
    }
  return num;
}
factorialize(5);
sorry but i still got error
Anna Presnyakova
@chiffenok
Aug 23 2015 13:32
@dting is there a way to do the same in the second argument of for loop ??
DTing
@dting
Aug 23 2015 13:33
@jyapujuju you want another variable to store your result or your num keeps growing
@chiffenok ya
DTing
@dting
Aug 23 2015 13:39
    var fibs = [0,1];
    for (var next = fibs[fibs.length-1]+fibs[fibs.length-2]; next <= num; next=fibs[fibs.length-1]+fibs[fibs.length-2]) {
        fibs.push(next);
    }
Soumya Rauth
@soumyaRauth
Aug 23 2015 13:43
@dting not working.... The generator function returns a string.
Mayank Jain
@MayankJ30
Aug 23 2015 13:45
Guys, doesn't the first Zipline seem too much of a jump from the Bonfires?
Moisés Man
@moigithub
Aug 23 2015 13:45
@soumyaRauth if u do window.open("hello"); it pops anything ?
and areu doin on codepen ?? cuz i think codepen blocks that
cfilus
@cfilus
Aug 23 2015 13:45
Can anyone recommend me some resources/sites to read to bridge the gap between the basic javascript stuff and the first bonfires/basic algorithm stuff? I'm at that point and I pretty much can't do any of them and don't know what my next step should be.
DTing
@dting
Aug 23 2015 13:46
@moigithub ahh yea forgot about that
@MayankJ30 which one are you on?
Mayank Jain
@MayankJ30
Aug 23 2015 13:47
@dting Just started the first one. The reverse engineering thing.
DTing
@dting
Aug 23 2015 13:47
which one is that?
the portfolio?
or tic tac toe?
Mayank Jain
@MayankJ30
Aug 23 2015 13:47
Portfolio
Soumya Rauth
@soumyaRauth
Aug 23 2015 13:47
@moigithub window.open() popped. But, it did not work for generator() function which returns a string. Yes I am doing it on codepen.
Rabin Shrestha
@jyapujuju
Aug 23 2015 13:48
function factorialize(num) {
  for(i=num-1;i>0;i--){
      num=num*i;
    }
  return num;
}
factorialize(5);
DTing
@dting
Aug 23 2015 13:48
@soumyaRauth it will work in the editor but the full screen window.open is blocked i believe
Rabin Shrestha
@jyapujuju
Aug 23 2015 13:48
worked for me <3 @dting @cfilus @chiffenok
Soumya Rauth
@soumyaRauth
Aug 23 2015 13:48
Oh I get it... Then what can I do???
DTing
@dting
Aug 23 2015 13:50
the function is blocked but you can have javascript write an a element on your page with the href with the url and it still works if i remember correctly
i think they just clobber the javascript window.open function
@jyapujuju nice
@MayankJ30 hmm ya its a bit of a jump. try to keep it kinda simple when you start out. then add to it.
Anna Presnyakova
@chiffenok
Aug 23 2015 13:53
@jyapujuju I did nothing)
Da Cheezy Mobsta
@mobesa
Aug 23 2015 13:57
Good day everyone!!
I need help...
I've nearly completed the Quote Generator Zipline..
But, I have a small problem.
First of all, here's a link to my solution.
The problem is that I want the "Tweet" link on the right side of the page to direct to a Twitter webpage with a tweet auto-populated with the quote's text...
I've tried so many times and checked the docs.. but it doesn't work..
DTing
@dting
Aug 23 2015 14:03
@mobesa put the part where you set the tweet inside the response callback
if (quote.indexOf("God") === -1 && quote.length<=140) {
            $(".quote-text").text(quote);
            $(".quote-cite").text(  
            var tweet = "https://twitter.com/intent/tweet?text=" + encodeURI(quote);
            $(".twitter-share-button").attr("href", tweet);
Da Cheezy Mobsta
@mobesa
Aug 23 2015 14:04
alright... i'll try..
still doesn't work...
Da Cheezy Mobsta
@mobesa
Aug 23 2015 14:08
Thanks @dting now it works!!!!
CamperBot
@camperbot
Aug 23 2015 14:08
mobesa sends brownie points to @dting :sparkles: :thumbsup: :sparkles:
:star: 599 | @dting | http://www.freecodecamp.com/dting
Da Cheezy Mobsta
@mobesa
Aug 23 2015 14:10
@dting mind if I ask, but why doesn't it work outside the callback?
DTing
@dting
Aug 23 2015 14:12
the request doesnt resolve right away and isnt blocking
so if your code is outside that function it will run before you have the quote
Da Cheezy Mobsta
@mobesa
Aug 23 2015 14:13
I understand, so quote isn't defined only after the callback, right?
Soumya Rauth
@soumyaRauth
Aug 23 2015 14:13
http://codepen.io/soumya_rauth/full/doxydZ/ Can't help myself with the tweeter button to tweet a Quote....
Terry
@tmosoff
Aug 23 2015 14:15
Hey guys, how do I report a bug with one of the Waypoints? My code crashes my browser every time I try to reopen the page and I cant reset the code
DTing
@dting
Aug 23 2015 14:16
@tmosoff clear your browser cache
Terry
@tmosoff
Aug 23 2015 14:19
yes sir it is @dting
DTing
@dting
Aug 23 2015 14:20
@tmosoff paste the code in typing $($) puts your browser into a loop
Terry
@tmosoff
Aug 23 2015 14:20
yea i kinda figured it was an infinite loop
Clayton
@cjg040103
Aug 23 2015 14:21
anyone no wat im doing wrong?
function mutation(arr) {
  var b = arr;
  for(var i = 0; i < arr[1].length; i++) {
    var c = arr[i].toUpperCase();
    if (arr[1].toUpperCase().indexOf(b) === -1) {
      return true;
    } else {
      return false;
    }
  }
}

mutation(['hello', 'hey']);
Terry
@tmosoff
Aug 23 2015 14:22
@dting Clearing the cache worked, I appreciate the help
Clayton
@cjg040103
Aug 23 2015 14:22
This message was deleted
This message was deleted
Terry
@tmosoff
Aug 23 2015 14:22
@dting i will have to type my code in differently, not start at the beginning of the expression
DTing
@dting
Aug 23 2015 14:23
@cjg040103 you will never reach the second iteration of your loop because you always return when i == 0
Clayton
@cjg040103
Aug 23 2015 14:24
how can i fix that?
DTing
@dting
Aug 23 2015 14:24
you only want to return true after you have tested all the letters
also seems like your return logic is reversed
and also your b is == to arr?
i don't think thats what you want
Rajendra kadam
@raju249
Aug 23 2015 14:26
'''
CamperBot
@camperbot
Aug 23 2015 14:26
:bulb: to format code use backticks! ``` more info
Clayton
@cjg040103
Aug 23 2015 14:26
what do i need 2 do 2 fix it?
here's what i got now.
function mutation(arr) {
  for(var i = 0; i < arr[1].length; i++) {
    var c = arr[i].toUpperCase();
    if (arr[i].toUpperCase().indexOf(c) === -1) {
      return true;
    } else {
      return false;
    }
  }
}

mutation(['hello', 'hey']);
Rajendra kadam
@raju249
Aug 23 2015 14:27

var Person = function(firstAndLast) {
name = firstAndLast;
fullName = name.split(" ");
firstName = fullName[0];
lastName = fullName[1];

this.getFullName = function(){
return (fullName.join(" "));
};

this.setFirstName = function(first){
firstName = first;
};
this.setLastName = function(last){
lastName = last;
};
this.setFullName = function(firstAndLast){
name = firstAndLast;
};

this.getLastName = function(){
return lastName;
}
this.getFirstName = function(){
return firstname;
};

};

var bob = new Person('Bob Ross');
bob.getFullName();

What Am i doing wrong? please help?

'''
CamperBot
@camperbot
Aug 23 2015 14:27
:bulb: to format code use backticks! ``` more info
DTing
@dting
Aug 23 2015 14:28
@cjg040103 arr is an array with always 2 elements. you want to iterate over the letters of arr[1] and check if all of them are in arr[0]
Clayton
@cjg040103
Aug 23 2015 14:28
u mean this?
var Person = function(firstAndLast) {
name = firstAndLast;
fullName = name.split(" ");
firstName = fullName[0];
lastName = fullName[1];
this.getFullName = function(){
return (fullName.join(" "));
};
this.setFirstName = function(first){
firstName = first;
};
this.setLastName = function(last){
lastName = last;
};
this.setFullName = function(firstAndLast){
name = firstAndLast;
};
this.getLastName = function(){
return lastName;
}
this.getFirstName = function(){
return firstname;
};
};
var bob = new Person('Bob Ross');
bob.getFullName();
@raju249
@dting like this?
function mutation(arr) {
  for(var i = 0; i < arr[1].length; i++) {
    var c = arr[i].toUpperCase();
    if (arr[1].toUpperCase().indexOf(c) === -1) {
      return true;
    } else {
      return false;
    }
  }
}

mutation(['hello', 'hey']);
Rajendra kadam
@raju249
Aug 23 2015 14:31
yes @cjg040103
Faisal Al-Khalidi
@fkalkhalidi
Aug 23 2015 14:31
Anyone having problems with the jQuery challenges not recognizing that you've entered the correct code? I have the right code, and yet it's not telling me the waypoint is complete.
Clayton
@cjg040103
Aug 23 2015 14:32
@raju249 dont use ''', use ```, they are on the same key as ~
CamperBot
@camperbot
Aug 23 2015 14:32
:bulb: to format code use backticks! ``` more info
Clayton
@cjg040103
Aug 23 2015 14:32
:wink:
Rajendra kadam
@raju249
Aug 23 2015 14:32
Yes I got it after reading markdown basics :) @cjg040103
Clayton
@cjg040103
Aug 23 2015 14:32
:D
Rajendra kadam
@raju249
Aug 23 2015 14:33
PLease can you help me wtih my code @cjg040103
Clayton
@cjg040103
Aug 23 2015 14:33
@raju249 sure, what waypoint?
Omar
@oab00
Aug 23 2015 14:33

@raju249 put this at the end of your code

var bob = new Person('Bob Ross');
var george = new Person('George Carlin');
console.log(bob.getFullName());

notice something wrong ?

Rajendra kadam
@raju249
Aug 23 2015 14:33
I amtrying @oab00
Omar
@oab00
Aug 23 2015 14:33
what do u get in the console
Clayton
@cjg040103
Aug 23 2015 14:34
@oab00 oh hi! havent seen u in a while! :smile:
Omar
@oab00
Aug 23 2015 14:34
press F12 to see open the console
hello @cjg040103 ^^
Rajendra kadam
@raju249
Aug 23 2015 14:35
@oab00 I am getting George Carlin
Omar
@oab00
Aug 23 2015 14:35
strange isn't it .. shouldn't it be Bob Ross ?
Rajendra kadam
@raju249
Aug 23 2015 14:35
Oh yess :worried: @oab00
Omar
@oab00
Aug 23 2015 14:36
hint: var inside a function makes a variable local scope to that function
CamperBot
@camperbot
Aug 23 2015 14:36
:construction: Spoilers are only in the Bonfire's Custom Room :point_right:
Rajendra kadam
@raju249
Aug 23 2015 14:39
I am not getting How do i use this hint :smile:
@oab00
Omar
@oab00
Aug 23 2015 14:40
function foo() {
    var bar = 1;
}
console.log(bar) // bar is undefined
meanwhile
function foo() {
    bar = 1;
}
console.log(bar) // bar equals 1
Clayton
@cjg040103
Aug 23 2015 14:41
This message was deleted
Rajendra kadam
@raju249
Aug 23 2015 14:41
ohkk
Omar
@oab00
Aug 23 2015 14:41
first one is the correct use for local variables
Rajendra kadam
@raju249
Aug 23 2015 14:42
But I have no local vars in my code @oab00
Omar
@oab00
Aug 23 2015 14:43
and that is the problem .. everytime you call Person(<name>) it changes the variables globally
Rajendra kadam
@raju249
Aug 23 2015 14:43
I see .... @oab00
Omar
@oab00
Aug 23 2015 14:44
your variables: name, fullName, firstName, and lastName should all be local not global
so just add var to each of them and that should fix it ^^
Rajendra kadam
@raju249
Aug 23 2015 14:45
Ok I am trying @oab00
:)
It didn't work @oab00
var Person = function(firstAndLast) {
   var name = firstAndLast;
   var fullName = name.split(" ");
   var firstName = fullName[0];
   var lastName = fullName[1];

  this.getFullName = function(){
    return firstAndLast;
  };

  this.setFirstName = function(first){
    firstName = first;
  };
  this.setLastName = function(last){
    lastName = last;
  };
  this.setFullName = function(firstAndLast){
    name = firstAndLast;
  };
  this.getLastName = function(){
    return lastName;
  };
  this.getFirstName = function(){
    return firstname;
  };

};

var bob = new Person('Bob Ross');
bob.getFullName();
Rex Schrader
@SaintPeter
Aug 23 2015 14:50
@raju249
this.getFullName = function(){
    return firstAndLast;
  };
You don't have a local variable named firstAndLast
You need to build it: return firstName + ' ' lastName;<