These are chat archives for FreeCodeCamp/Help

28th
Sep 2015
Jason
@Jauble
Sep 28 2015 00:00
Thanks @KingHippo, gonna check out that crossword too @abhisekp
CamperBot
@camperbot
Sep 28 2015 00:00
jauble sends brownie points to @kinghippo and @abhisekp :sparkles: :thumbsup: :sparkles:
:warning: jauble already gave abhisekp points
:star: 193 | @kinghippo | http://www.freecodecamp.com/kinghippo
Danielle Soto
@purplewuzzles
Sep 28 2015 00:00
@alanbuchanan - AH! Thank you so much! I can't believe (but of course, I really can) that I overlooked something so basic & simple... Thank you. :)
CamperBot
@camperbot
Sep 28 2015 00:00
purplewuzzles sends brownie points to @alanbuchanan :sparkles: :thumbsup: :sparkles:
:star: 380 | @alanbuchanan | http://www.freecodecamp.com/alanbuchanan
Rory Smith
@alanbuchanan
Sep 28 2015 00:00
:thumbsup:
Abhisek Pattnaik
@abhisekp
Sep 28 2015 00:01
@Jauble it doesn't work for that bonfire. You need to figure out how to solve it after reading some more tuts about regex
@Jauble @KingHippo @alanbuchanan In the mean time, you might wanna check my gameplay! :P
https://www.youtube.com/playlist?list=PLg1oO1hCh37cQ1sXz5P6u6yvrH7gEWwd_
Jason
@Jauble
Sep 28 2015 00:03
@abhisekp all right, all right lol
Devon Jones
@jones-codes
Sep 28 2015 00:03
I guess I should go back and do some reg ex stuff, seems like the trend lol
Jason
@Jauble
Sep 28 2015 00:04
@jones-codes lol join the club
Devon Jones
@jones-codes
Sep 28 2015 00:05
lol I went back to Factorialize today and ended up spending all day trying to figure out recursive functions
Jason
@Jauble
Sep 28 2015 00:07
Ya, those are tough to get your head around. I learned a little about them when I was learning C a while back
Don Price
@KingHippo
Sep 28 2015 00:07
I'm going to get some grub and take a break for few. Happy coding everyone and good luck!
Jason
@Jauble
Sep 28 2015 00:07
see ya @KingHippo
Devon Jones
@jones-codes
Sep 28 2015 00:09
Yea I'm still lost, but I think I'll be in better shape next time they come up at least
the Codecademy on them is pretty good
Abhisek Pattnaik
@abhisekp
Sep 28 2015 00:11
This message was deleted
ninjatron
@ninjatron
Sep 28 2015 00:12
can anyone help me with an angular issue?
Rory Smith
@alanbuchanan
Sep 28 2015 00:12
@abhisekp 'nice' as in 'not nice at all'?
Devon Jones
@jones-codes
Sep 28 2015 00:12
huh?? what is it?
Abhisek Pattnaik
@abhisekp
Sep 28 2015 00:12
:P
Alexander Griswold
@AlexGriswold
Sep 28 2015 00:12
hehehe
Abhisek Pattnaik
@abhisekp
Sep 28 2015 00:13
@jones-codes hover your hands over it (if using Chrome).
@alanbuchanan i guess others have not yet recovered. :P
Rory Smith
@alanbuchanan
Sep 28 2015 00:14
@ninjatron what's the issue?
Jason
@Jauble
Sep 28 2015 00:14
Ya, they're pretty interesting. I remember spending a lot of time on them, 'cause I really wanted to get it.
Devon Jones
@jones-codes
Sep 28 2015 00:14
All i see is a url to stanford that doesn't work? Lol I'm lost
Abhisek Pattnaik
@abhisekp
Sep 28 2015 00:15
@jones-codes are you /(?!Chrome)/g (not on chrome)?
Devon Jones
@jones-codes
Sep 28 2015 00:15
Chrome4lyf
Unless I need to test something I'm on Chrome lol
Abhisek Pattnaik
@abhisekp
Sep 28 2015 00:16
@jones-codes didn't it crash your chrome?
Devon Jones
@jones-codes
Sep 28 2015 00:16
No not at all lol
Alexander Griswold
@AlexGriswold
Sep 28 2015 00:16
Chrome is kindof 'the man'-y but it's darn fast
Rory Smith
@alanbuchanan
Sep 28 2015 00:16
@abhisekp camperbot should shame you for that :stuck_out_tongue_winking_eye:
Abhisek Pattnaik
@abhisekp
Sep 28 2015 00:16
@alanbuchanan lolz :D
Did it crash yours?
Rory Smith
@alanbuchanan
Sep 28 2015 00:16
it crashed the page yeah
Alexander Griswold
@AlexGriswold
Sep 28 2015 00:17
just the tab
Abhisek Pattnaik
@abhisekp
Sep 28 2015 00:17
@alanbuchanan yesterday, it crashed mine. But today, it is not. I guess chrome has updated. Probably, they've fixed the bug.
ninjatron
@ninjatron
Sep 28 2015 00:18
@alanbuchanan sent you the issue through private message
Abhisek Pattnaik
@abhisekp
Sep 28 2015 00:19
@AlexGriswold @alanbuchanan Here is the demo https://github.com/szhu/3030
Google has fixed the bug. :(
Rory Smith
@alanbuchanan
Sep 28 2015 00:19
@abhisekp that is literally worse than being rickrolled
Abhisek Pattnaik
@abhisekp
Sep 28 2015 00:20
@alanbuchanan pls update your chrome. :P
Rory Smith
@alanbuchanan
Sep 28 2015 00:20
@abhisekp pls dont post such stuff in a chat designed to help people
Abhisek Pattnaik
@abhisekp
Sep 28 2015 00:20
@alanbuchanan yeah! I know. But just for sm fun... :P :D
@alanbuchanan i've deleted that Evil Pines tho
DJ
@qualitymanifest
Sep 28 2015 00:21
i wonder if tanks has been fixed yet
CamperBot
@camperbot
Sep 28 2015 00:21
if you want to thank someone, put an @ before their name!
DJ
@qualitymanifest
Sep 28 2015 00:21
nope
yeah hovering over that link crashed me. updating browser now...
Abhisek Pattnaik
@abhisekp
Sep 28 2015 00:22
@qualitymanifest nope! I've not yet created the Ultimate thanks regex. But you could help. dcsan/gitterbot#142
CamperBot
@camperbot
Sep 28 2015 00:22
abhisekp sends brownie points to @qualitymanifest :sparkles: :thumbsup: :sparkles:
:star: 231 | @qualitymanifest | http://www.freecodecamp.com/qualitymanifest
DJ
@qualitymanifest
Sep 28 2015 00:23
@abhisekp i wish i was on that level, if so i would. not there yet. struggling big time with the weather zipline right now.
Jason
@Jauble
Sep 28 2015 00:25
So I guess I had this right for the hyphens and underscores var rem = /[\s.,_-]/g; but I didn't realize that the parens were getting tuned around. So now I gotta figure out how to remove them lol. 00(:/:)00 vs 00):/:(00
Abhisek Pattnaik
@abhisekp
Sep 28 2015 00:25
@qualitymanifest weather zipline is way ahead of regex. You've already completed regex if you're in ziplines, i guess.
@Jauble don't blame me for that last test case! :P
explain git blame
CamperBot
@camperbot
Sep 28 2015 00:26

:point_right: git blame [wiki]

Shows what revision and author last modified each line of a file and blame them.

:point_right: :no_good: — :see_no_evil: :hear_no_evil: :speak_no_evil:

Reference: https://git-scm.com/docs/git-blame

:pencil: read more about git blame on the FCC Wiki

DJ
@qualitymanifest
Sep 28 2015 00:26
@abhisekp well yes, i do have a basic understanding of regex. i just figure, if YOU are having trouble figuring out the fix to that... i'm probably not going to be any help
Jason
@Jauble
Sep 28 2015 00:28
@abhisekp lol
Abhisek Pattnaik
@abhisekp
Sep 28 2015 00:28
@qualitymanifest lolz :P
Your mind != My mind.
Your thinking != My thinking.
Your solution != My solution.
Result: You solved.
I become jealous :rage:
ribas14
@ribas14
Sep 28 2015 00:28
hey guys, can anyone help me with this "$($('.slot')[0]).html('<img src = "' + images[slotOne-1] + '">'); " why do i have to put "slotOne -1 " ? why the -1 is there?
DJ
@qualitymanifest
Sep 28 2015 00:29
@abhisekp well can you share with me what you have for it currently? i could use a distraction from this zipline anyway
Abhisek Pattnaik
@abhisekp
Sep 28 2015 00:30
@qualitymanifest pls go thru the comments dcsan/gitterbot#142
hover over the link too
ribas14
@ribas14
Sep 28 2015 00:37
anyone?
DJ
@qualitymanifest
Sep 28 2015 00:37
@abhisekp so it looks like you've taken care of tanks, you just haven't gotten @thanks yet?
CamperBot
@camperbot
Sep 28 2015 00:37
qualitymanifest sends brownie points to @abhisekp and @thanks :sparkles: :thumbsup: :sparkles:
:warning: could not find receiver for thanks
:star: 498 | @abhisekp | http://www.freecodecamp.com/abhisekp
DJ
@qualitymanifest
Sep 28 2015 00:38
(at least in the current version, 21)
err, not current, but newest
Abhisek Pattnaik
@abhisekp
Sep 28 2015 00:39
@qualitymanifest no tanks
CamperBot
@camperbot
Sep 28 2015 00:39
abhisekp sends brownie points to @qualitymanifest :sparkles: :thumbsup: :sparkles:
:warning: abhisekp already gave qualitymanifest points
Abhisek Pattnaik
@abhisekp
Sep 28 2015 00:40
@qualitymanifest actually, the proposed regex is partially correct. I want to solve it for once and all. :P
DJ
@qualitymanifest
Sep 28 2015 00:41
i'm confused. tanks doesn't show up highlighted, so isn't that solved? just need to get rid of @thanks?
CamperBot
@camperbot
Sep 28 2015 00:41
qualitymanifest sends brownie points to @thanks :sparkles: :thumbsup: :sparkles:
:warning: could not find receiver for thanks
DJ
@qualitymanifest
Sep 28 2015 00:43
oh and the ones between backticks
Abhisek Pattnaik
@abhisekp
Sep 28 2015 00:49
@qualitymanifest if one gets solved, the other one creates a problem. So it's always partially correct. I guess some tricks can be applied using lookahead http://www.regular-expressions.info/lookaround.html
DJ
@qualitymanifest
Sep 28 2015 00:53
ah, okay
Paul Calabrese
@pacalabre
Sep 28 2015 00:58
could I get some feedback please? This is for the quote generator - i did it a bit differently than the example, which I know is okay since it works... but is the way I did it not as good or efficient? should I try to restructure this? http://codepen.io/pacalabre/pen/xwVYWV
1234Matt
@1234Matt
Sep 28 2015 01:00
Hi, is there any free site for free site with design, like background images, sample images, etc. ... ? Well, i know there are sites, like this, is any of this recommanded, like stack over flow for questions? :D
I wrote it wrong, but idea is to get free background and sample images... :D
Abhisek Pattnaik
@abhisekp
Sep 28 2015 01:05
@1234Matt http://webfieldmanual.com
This all in one soln.
1234Matt
@1234Matt
Sep 28 2015 01:08
@abhisekp thanks!, this site looks cool :D It is all on the net, just know right url... :D
CamperBot
@camperbot
Sep 28 2015 01:08
1234matt sends brownie points to @abhisekp :sparkles: :thumbsup: :sparkles:
:star: 500 | @abhisekp | http://www.freecodecamp.com/abhisekp
DJ
@qualitymanifest
Sep 28 2015 01:13

@abhisekp i'm probably missing something but:

[^@`]\bt(?:(?:ha?n?[xk]s?)|[qy])\b

gets rid of @thanks and thanks

CamperBot
@camperbot
Sep 28 2015 01:13
qualitymanifest sends brownie points to @abhisekp and @thanks :sparkles: :thumbsup: :sparkles:
:warning: qualitymanifest already gave abhisekp points
:warning: could not find receiver for thanks
RobotEyes
@Roboteyes
Sep 28 2015 01:15
i need help!! with this code "Your p element should have the class red-text"
R. Loayza
@CasaDeLoayza
Sep 28 2015 01:15
Hey Guys, sorry to bug everyone again...I'm having a problem with this challenge: http://freecodecamp.com/challenges/waypoint-give-your-javascript-slot-machine-some-stylish-images
This is what I have: $($('.slot')[0]).html('<img src="' + images[slotOne-1] +'">');
$($('.slot')[1]).html('<img src="' + images [slotTwo-1] + '">');

$($('.slot')[2]).html('<img src="' + images [slotThree-1] + '">');
oops:
$($('.slot')[0]).html('<img src="' + images[slotOne-1] +'">');
$($('.slot')[1]).html('<img src="' + images [slotTwo-1] + '">');

$($('.slot')[2]).html('<img src="' + images [slotThree-1] + '">');
Abhisek Pattnaik
@abhisekp
Sep 28 2015 01:17

@qualitymanifest i'm playing this awesome game rt. now. :P http://www.freeriderhd.com/t/57528/c
Just hit Ctrl+S to save your new regex. I'll look into it later.

NOTE: Use the proposed link provided in the repo.

R. Loayza
@CasaDeLoayza
Sep 28 2015 01:18
@Roboteyes what are you working on I may be able to help
RobotEyes
@Roboteyes
Sep 28 2015 01:18
Waypoint: Style Multiple Elements with a CSS Class @CasaDeLoayza
R. Loayza
@CasaDeLoayza
Sep 28 2015 01:19
can you copy the link
Abhisek Pattnaik
@abhisekp
Sep 28 2015 01:19
@pacalabre you should store the quotes in an array for ease of maintainability.
DJ
@qualitymanifest
Sep 28 2015 01:20
@abhisekp saved. please let me know when you get a chance to look at it
Abhisek Pattnaik
@abhisekp
Sep 28 2015 01:21
@qualitymanifest pls add more changes and save them after some good change. I'll look into all of them.
Paul Calabrese
@pacalabre
Sep 28 2015 01:21
@abhisekp thanks - that makes sense
CamperBot
@camperbot
Sep 28 2015 01:21
pacalabre sends brownie points to @abhisekp :sparkles: :thumbsup: :sparkles:
:star: 501 | @abhisekp | http://www.freecodecamp.com/abhisekp
R. Loayza
@CasaDeLoayza
Sep 28 2015 01:21
@Roboteyes I pulled it up. what do you have so far?

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

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

<h2 class="red-text"><p>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></h2> @CasaDeLoayza

R. Loayza
@CasaDeLoayza
Sep 28 2015 01:24
is there a reason you have the kitty ipsum within a <h2> element?
Colton Ehrman
@coltonehrman
Sep 28 2015 01:24
get rid of h2 element around p tag and give the p the .red-text
R. Loayza
@CasaDeLoayza
Sep 28 2015 01:25
you can assign a class to the <p> element
RobotEyes
@Roboteyes
Sep 28 2015 01:25
no, just learning @CasaDeLoayza
Can you show me an example please @CasaDeLoayza
R. Loayza
@CasaDeLoayza
Sep 28 2015 01:26
Okay cool! So a <p> tag is all you need there. <h2> will make it a heading. <p> is just for a paragraph of text
sure!
so the same way you did the <h2 class="red-text"> , you can do that with a tag of any element. so if you wanted to add a class of "red-text" to an <h3> element it would be <h3 class="red-text">
so to add it to the p tag follows that same structure. <p class="red-text">
remember that when you add classes, you always do it to the opening tag, so all those tags still need their closing tag
so </h3> or </p> depending on what the element is
does that make sense?
RobotEyes
@Roboteyes
Sep 28 2015 01:29
Yes! You're so awesome!! Thanks
CamperBot
@camperbot
Sep 28 2015 01:29
if you want to thank someone, put an @ before their name!
RobotEyes
@Roboteyes
Sep 28 2015 01:30
Yes! You're so awesome!! THanks @CasaDeLoayza
CamperBot
@camperbot
Sep 28 2015 01:30
roboteyes sends brownie points to @casadeloayza :sparkles: :thumbsup: :sparkles:
:star: 158 | @casadeloayza | http://www.freecodecamp.com/casadeloayza
Don Price
@KingHippo
Sep 28 2015 01:31
@CasaDeLoayza are you still having trouble with the slot machine?\
R. Loayza
@CasaDeLoayza
Sep 28 2015 01:32
no problem @Roboteyes ! happy to be able to help! especially since I keep hitting walls with java. ask any other questions you like :)
renren89
@renren89
Sep 28 2015 01:32
does return; imply return nothing?
Colton Ehrman
@coltonehrman
Sep 28 2015 01:33
yes @renren89
renren89
@renren89
Sep 28 2015 01:33
thank you for the confirmation
CamperBot
@camperbot
Sep 28 2015 01:33
if you want to thank someone, put an @ before their name!
Colton Ehrman
@coltonehrman
Sep 28 2015 01:33
np
R. Loayza
@CasaDeLoayza
Sep 28 2015 01:35
@KingHippo no i just got past it
Thanks though!
CamperBot
@camperbot
Sep 28 2015 01:35
if you want to thank someone, put an @ before their name!
Aaron Freidus
@shadowfool
Sep 28 2015 01:36
bonfire pairwise
CamperBot
@camperbot
Sep 28 2015 01:36

:fire:Bonfire: Pairwise :link:

function pairwise(arr, arg) {
  return arg;
}

pairwise([1,4,2,3,0,5], 7);

Return the sum of all indices of elements of 'arr' that can be paired with one other element to form a sum that equals the value in the second argument 'arg'. If multiple sums are possible, return the smallest sum. Once an element has been used, it cannot be reused to pair with another.

more info:  bf details | bf links | hint

Aaron Freidus
@shadowfool
Sep 28 2015 01:36
bonfire pairwise hint
CamperBot
@camperbot
Sep 28 2015 01:36
Sorry, can't find a bonfire called pairwise hint. [ Check the map? ]
Aaron Freidus
@shadowfool
Sep 28 2015 01:36
pairwise hint
Don Price
@KingHippo
Sep 28 2015 01:36
@CasaDeLoayza cool!
Aaron Freidus
@shadowfool
Sep 28 2015 01:36
hint
CamperBot
@camperbot
Sep 28 2015 01:36
:construction: Spoilers are only in the Bonfire's Custom Room :point_right:
Devon Jones
@jones-codes
Sep 28 2015 02:22
can anyone help me understand truncate a string?
DJ
@qualitymanifest
Sep 28 2015 02:30
@abhisekp if you're around... i got it to accept more good ones. still can't get it to ignore the one in triple backticks or accept tx
CamperBot
@camperbot
Sep 28 2015 02:30
qualitymanifest sends brownie points to @abhisekp :sparkles: :thumbsup: :sparkles:
:star: 502 | @abhisekp | http://www.freecodecamp.com/abhisekp
Mengsreang
@Mengsreang
Sep 28 2015 02:44
how do i delete all trailing comment tags, i.e. -->.
Jose E. Pimentel
@jedpimentel
Sep 28 2015 02:48
@Mengsreang in notepad++ in the ctrl+f menu you can replace "-->" with "",
Abhisek Pattnaik
@abhisekp
Sep 28 2015 02:51
@qualitymanifest see tx gives thanks too. But in that proposed one, it doesn't work. :(
CamperBot
@camperbot
Sep 28 2015 02:51
abhisekp sends brownie points to @qualitymanifest :sparkles: :thumbsup: :sparkles:
:star: 232 | @qualitymanifest | http://www.freecodecamp.com/qualitymanifest
Mengsreang
@Mengsreang
Sep 28 2015 02:51
ok thanks Jed
DJ
@qualitymanifest
Sep 28 2015 02:56
@abhisekp yeah i see it works currently. do you know if you can use lookbehind in JS? from what i'm reading you can't, but i don't know if that's changed?
DJ
@qualitymanifest
Sep 28 2015 03:23
nevermind. you can't. that's too bad
DJ
@qualitymanifest
Sep 28 2015 03:42
@abhisekp i got tx back without accepting txs/tanks/taks
CamperBot
@camperbot
Sep 28 2015 03:42
qualitymanifest sends brownie points to @abhisekp :sparkles: :thumbsup: :sparkles:
:star: 503 | @abhisekp | http://www.freecodecamp.com/abhisekp
Paul Simon Ongpin
@mochiii
Sep 28 2015 03:44

i wonder what is the difference between loadWeather(position.coords.latitude+','+position.coords.longitude);

and

loadWeather(position.coords.latitude, position.coords.longitude);

Jose E. Pimentel
@jedpimentel
Sep 28 2015 03:47
in the first example it's a function that takes a single string, in the second example it's a function that's taking two different values, it should be possible to write a function that's work in both cases. are you referring to a specific loadWeather()?
Paul Simon Ongpin
@mochiii
Sep 28 2015 03:58
@jedpimentel i was trying to analyze a code snippet given to me. so the 1st one takes only 1 parameter which is a concatenated lat and lon. and the 2nd takes two parameters am i right?
Jose E. Pimentel
@jedpimentel
Sep 28 2015 03:59
yes, first is a string, I assume the secend takes a pair of numbers
Paul Simon Ongpin
@mochiii
Sep 28 2015 03:59
@jedpimentel i understand it now thanks. awesome man!
CamperBot
@camperbot
Sep 28 2015 03:59
mochiii sends brownie points to @jedpimentel :sparkles: :thumbsup: :sparkles:
:star: 320 | @jedpimentel | http://www.freecodecamp.com/jedpimentel
R. Loayza
@CasaDeLoayza
Sep 28 2015 04:10
I'm so lost
I feel like I don't understand what's going on with that...if anyone wants to explain that would be really cool of you!!
Cristián Berríos
@crisberrios
Sep 28 2015 04:12
sure
@CasaDeLoayza if you declare a normal variable like var someNumber = 1; on the constructor function, you can still access that variable from the methods (this.someFunction = ...) but you can't access that variable as a property of the object. It's only remembered by inner functions and objects, thus creating a closure.
R. Loayza
@CasaDeLoayza
Sep 28 2015 04:16
what is the constructor function exactly?
Jose E. Pimentel
@jedpimentel
Sep 28 2015 04:17
actually, I think var someNumer = 1 would be the private one, with this.comeNumber = 1 being public (can access externally)
R. Loayza
@CasaDeLoayza
Sep 28 2015 04:17

var Bike = function() {
// Only change code below this line.
this.speed = 100;
function addUnit(value) {
return value + "KM/H";
}

getSpeed = function () {
return addUnit(speed);
};

};

var Bike = function is the variable declaration, right? and then the whole thing is the object?
I've been having some trouble understanding the structure, which I think is what's also hindering my understanding of how to think about the properties and methods of the object
Cristián Berríos
@crisberrios
Sep 28 2015 04:20
Bike is the constructor function, it's executed in the context of the object you're creating when you use the new word. in that case it's kind of tricky because getSpeed is neither being declared as a variable or as a method of the object (you should either use var or this.). For this case, we want to use this. as it's a public method
R. Loayza
@CasaDeLoayza
Sep 28 2015 04:23
OH because it's the name of the function that we're constructing...okay...and it's executed in the context of the object that is created below it? so this.speed function and getSpeed are both parts of that object being created? and they are properties of it?
Aaron Markle
@aaronmarkle
Sep 28 2015 04:24
yes in the sense that any "Bike" that is created will have the function getSpeed and the property speed inherently
Jose E. Pimentel
@jedpimentel
Sep 28 2015 04:24
yes, but as-is we'd be able to access "speed" from outside the object, the objective is to make it so we could instead call "getSpeed" from outside the object (as a method), and the "speed" variable itself just be something private to the object
Aaron Markle
@aaronmarkle
Sep 28 2015 04:25
so if you create var huffy = new Bike(); you know that huffy.speed will = 100 right off the bat
R. Loayza
@CasaDeLoayza
Sep 28 2015 04:26
right, @jedpimentel , I get the objective of the challenge, but I really dont understand the structure of things
I think I do now though! and so all i'd have to do is apply this to one of those properties within the object in order to make it public, and remove it to make it private
@crisberrios thank you!!!
CamperBot
@camperbot
Sep 28 2015 04:27
casadeloayza sends brownie points to @crisberrios :sparkles: :thumbsup: :sparkles:
:star: 166 | @crisberrios | http://www.freecodecamp.com/crisberrios
R. Loayza
@CasaDeLoayza
Sep 28 2015 04:27
@jedpimentel thank you!!
@aaronmarkle I don't think I understood you, could you explain it one more time?
@aaronmarkle OH NO nevermind I get what you're saying now
Cristián Berríos
@crisberrios
Sep 28 2015 04:28
you're welcome. I'm leaving now but I'm sure you'll get it soon :)
Aaron Markle
@aaronmarkle
Sep 28 2015 04:28
ok cool lol, i was going to say i dont know if i addressed the question you were asking exactly
but it sounds like you got a grasp of what you were trying to work through
R. Loayza
@CasaDeLoayza
Sep 28 2015 04:29
@crisberrios yup I passed the challenge now, but I think I really needed that clarification of what was going on!! thanks!!
CamperBot
@camperbot
Sep 28 2015 04:29
casadeloayza sends brownie points to @crisberrios :sparkles: :thumbsup: :sparkles:
:warning: casadeloayza already gave crisberrios points
pwdd
@pwdd
Sep 28 2015 04:30
I'm working on zipline 'show the local weather' and I have absolutely everything working but the floating point of the temperatures. I'm trying to use toFixed(1) as I did earlier on the same place, but it is not working. Here it is the conversion methods:
convertFtoC = function() {
    var changeTxt = $('#temp');
    var fTemp = parseFloat(changeTxt.text());
    fTemp = fTemp.toFixed(1);
    var cTemp = ((fTemp - 32) * 5) / 9;
    changeTxt.html(cTemp.toString());
    $('#toC').prop("disabled", true);
    $('#toF').prop("disabled", false);
  };

  convertCtoF = function() {
    var changeTxt = $('#temp');
    var cTemp = parseFloat(changeTxt.text());
    cTemp = cTemp.toFixed(1);
    var fTemp = ((cTemp * 9) /5) + 32;
    changeTxt.html(fTemp.toString());
    $('#toC').prop("disabled", false);
    $('#toF').prop("disabled", true);
  };
Can anyone help find what I'm doing wrong, please?
R. Loayza
@CasaDeLoayza
Sep 28 2015 04:31
@aaronmarkle you're saying that when i define a variable and i define public properties to it, those will transfer whenever I use that function again in defining a variable?
Jose E. Pimentel
@jedpimentel
Sep 28 2015 04:34
@CasaDeLoayza yes, anything inside the contructor will be copied into the next objects called with it. It's basically just a way to avoid repeating yourself when you work with a lot of objects
R. Loayza
@CasaDeLoayza
Sep 28 2015 04:36
but the only ones copied are this. right?
not the private ones
Jose E. Pimentel
@jedpimentel
Sep 28 2015 04:37
the private ones are also copied,
R. Loayza
@CasaDeLoayza
Sep 28 2015 04:38
so why make some private and some public?
Cristián Berríos
@crisberrios
Sep 28 2015 04:39
@pwdd toFixed returns a string, use toFixed on the very last step when you want to display data. For other uses like getting an integer, use round, floor, ceil, etc.
ok good night!
Jose E. Pimentel
@jedpimentel
Sep 28 2015 04:40
it's so that when the object is made, you could have control over what would be available from outside of the object. In the excercize, accessing the "speed" wold just give you a number, but you'd have no way of knowing if it where in miles or kilometers, by forcing it so you could only get that number via "getSpeed" you would give it some context
Cristián Berríos
@crisberrios
Sep 28 2015 04:40
@CasaDeLoayza there are many explanations, one of them is security (like preventing a malicious script from hooking into your routines)
Jose E. Pimentel
@jedpimentel
Sep 28 2015 04:41
yeah, security is a big one
R. Loayza
@CasaDeLoayza
Sep 28 2015 04:41
ooooohhhh
so objects will always copy over when we recall their constructor function
and making them public vs. private has to do with security...okay cool
thanks @crisberrios :)
CamperBot
@camperbot
Sep 28 2015 04:42
casadeloayza sends brownie points to @crisberrios :sparkles: :thumbsup: :sparkles:
:warning: casadeloayza already gave crisberrios points
R. Loayza
@CasaDeLoayza
Sep 28 2015 04:42
@jedpimentel thanks!!
CamperBot
@camperbot
Sep 28 2015 04:42
casadeloayza sends brownie points to @jedpimentel :sparkles: :thumbsup: :sparkles:
:star: 321 | @jedpimentel | http://www.freecodecamp.com/jedpimentel
pwdd
@pwdd
Sep 28 2015 04:43
@crisberrios thanks! got it working now!
Carol Chung
@cch5ng
Sep 28 2015 04:48
hi, can anyone help me troubleshoot starting mongodb on cloud9? it starts from the terminal but not when run from a *.js file
jjb1990
@jjb1990
Sep 28 2015 05:04
for bonfire:title case a sentence is an array or replace() recommended?
Rex Schrader
@SaintPeter
Sep 28 2015 05:12
@cch5ng My advice is to use a local development environment. While it is technically possible to use c9, it's a bit rough, especially with the latest version of angular-fullstack
@cch5ng Also, I've added you to the HelpBasejumps channel.
@jjb1990 You can actually use both. You can definitely do it with replace and the right Regex, but it may be easier to do it as an array.
Hans van Riet
@hansinla
Sep 28 2015 05:23
@SaintPeter it's a bit rough is an understatement.
jjb1990
@jjb1990
Sep 28 2015 05:27
function titleCase(str) {
//converts strint to lowercase letter array spit by a space.     
  str = str.toLowerCase().split(' ');

  return str;
}

titleCase("I'm a little tea pot", "");
I think the next step would be to run a for loop that will capitalize the first letter in every item in the array
at this point i have all the input converted into an array
Aaron Markle
@aaronmarkle
Sep 28 2015 05:34
i'm pretty sure you are correct @jjb1990 keep going!
DJ
@qualitymanifest
Sep 28 2015 05:37
This message was deleted
This message was deleted
azaleas
@azaleas
Sep 28 2015 05:53
@catapixel thanks mate for the answer. but as @tva10 already mentioned, i've completed the task;)
Don Price
@KingHippo
Sep 28 2015 06:00
hint Falsy Bouncer
CamperBot
@camperbot
Sep 28 2015 06:00
:construction: Spoilers are only in the Bonfire's Custom Room :point_right:
ProLC
@ProLC
Sep 28 2015 06:03
working on the title case bonfire.
ProLC
@ProLC
Sep 28 2015 06:11

I keep getting a "missing ) after argument list" error; code:
'''
function titleCase(str) {
var array = str.toLowerCase().split([' ']);
for (var i = 0; i < array.length; i++) {
var temp = array[i];
temp.replace(/./{1}, temp.charAt(0).toUpperCase());
}
var newStr = array.join([' ']);
return newStr;
}

titleCase("I'm a little tea pot", "");
'''
What am I doing wrong here?

CamperBot
@camperbot
Sep 28 2015 06:11
:bulb: to format code use backticks! ``` more info
Abhisek Pattnaik
@abhisekp
Sep 28 2015 06:11
explain format
CamperBot
@camperbot
Sep 28 2015 06:11

: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

```js ⇦ Type 3 backticks, then type js or html and 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

Abhisek Pattnaik
@abhisekp
Sep 28 2015 06:11
@ProLC :point_up: September 28, 2015 11:41 AM
ProLC
@ProLC
Sep 28 2015 06:13
function titleCase(str) {
  var array = str.toLowerCase().split([' ']);
  for (var i = 0; i < array.length; i++) {
    var temp = array[i];
    temp.replace(/./{1}, temp.charAt(0).toUpperCase());
  }
  var newStr = array.join([' ']);
  return newStr;
}

titleCase("I'm a little tea pot", "");
hope this works. still new
DTing
@dting
Sep 28 2015 06:14
@ProLC strings are immutable
wiki immutable
CamperBot
@camperbot
Sep 28 2015 06:14

:point_right: js immutable [wiki]

Immutable means unchangeable i.e. you can't change.

Javascript has lots of immutable types e.g. string primitive type. Try this in your console.

s = "red";
console.log(s[1]); //→ "e"
s[1] = "x";
console.log(s) //→ "red"

the s didn't change! WAT!

:pencil: read more about js immutable on the FCC Wiki

DTing
@dting
Sep 28 2015 06:14
calling temp.replace wont change the string "temp"
it will return the result of the replacement
ProLC
@ProLC
Sep 28 2015 06:15
@dting thanks. I'll try that.
CamperBot
@camperbot
Sep 28 2015 06:15
prolc sends brownie points to @dting :sparkles: :thumbsup: :sparkles:
:star: 1267 | @dting | http://www.freecodecamp.com/dting
DTing
@dting
Sep 28 2015 06:16

that being said:

    temp.replace(/./{1}, temp.charAt(0).toUpperCase());

is equivalent to:

temp.charAt(0).toUpperCase()
Devon Jones
@jones-codes
Sep 28 2015 06:16
just rant into this too, finally getting what immutable means a little bit
a variable modified by methods like that changes if it's an array, but not if it's a string, right?
you'd have to assign the statement to the string to get it to change?
DJ
@qualitymanifest
Sep 28 2015 06:19
@jones-codes did you read that link i sent you yesterday? i found another relevant one in the comments
Devon Jones
@jones-codes
Sep 28 2015 06:19
the one about making loops faster/more efficient?
DJ
@qualitymanifest
Sep 28 2015 06:21
yeah. but the other link im talking about argues in favor of for/in loops
Devon Jones
@jones-codes
Sep 28 2015 06:22
what do you mean??
DJ
@qualitymanifest
Sep 28 2015 06:22
have you used a for/in loop before? they're fairly new to me, this link wasn't the first time i heard about them but it was interesting
Devon Jones
@jones-codes
Sep 28 2015 06:23
errr, I thought you made a typo lol
DJ
@qualitymanifest
Sep 28 2015 06:23
haha yeah i just hit enter too early
Devon Jones
@jones-codes
Sep 28 2015 06:24
noo I mean the for/in part...as in I've never heard of it lol
Abhisek Pattnaik
@abhisekp
Sep 28 2015 06:26
@qualitymanifest check the PM
DJ
@qualitymanifest
Sep 28 2015 06:26
i've used for/in loops a couple times and while i still don't fully understand their advantages and disadvantages.. they are pretty convenient
@abhisekp will do
Devon Jones
@jones-codes
Sep 28 2015 06:28
ahhh I remember seeing that and running for the hills
Thanks though, gonna read that in a sec. @qualitymanifest
CamperBot
@camperbot
Sep 28 2015 06:29
jones-codes sends brownie points to @qualitymanifest :sparkles: :thumbsup: :sparkles:
:star: 234 | @qualitymanifest | http://www.freecodecamp.com/qualitymanifest
DTing
@dting
Sep 28 2015 06:32
im not sure i agree with that blog post
seems like the exception suggesting to use for in rather than "arithmetic for"
for iterating arrays
abhisheks420
@abhisheks420
Sep 28 2015 06:47
hi i need some help in javascript
query is :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.
function destroyer(arr) {
// Remove all the values
}
destroyer([1, 2, 3, 1, 2, 3], 2, 3, "");
how to resolve it
??
Devon Jones
@jones-codes
Sep 28 2015 06:53
bf destroyer
CamperBot
@camperbot
Sep 28 2015 06:53
Sorry, can't find a bonfire called destroyer. [ Check the map? ]
Devon Jones
@jones-codes
Sep 28 2015 06:54
bf destroy
CamperBot
@camperbot
Sep 28 2015 06:54

: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

Devon Jones
@jones-codes
Sep 28 2015 06:54
hint
CamperBot
@camperbot
Sep 28 2015 06:54
:construction: Spoilers are only in the Bonfire's Custom Room :point_right:
Devon Jones
@jones-codes
Sep 28 2015 06:54
hit that link @abhisheks420
abhisheks420
@abhisheks420
Sep 28 2015 06:55
thanks @jones-codes && @camperbot
CamperBot
@camperbot
Sep 28 2015 06:55
abhisheks420 sends brownie points to @jones-codes and @camperbot :sparkles: :thumbsup: :sparkles:
:star: 267 | @camperbot | http://www.freecodecamp.com/camperbot
:star: 192 | @jones-codes | http://www.freecodecamp.com/jones-codes
abhisheks420
@abhisheks420
Sep 28 2015 06:55
can i do it directly with value checking
without using slice
Alexander
@teichopsia-
Sep 28 2015 06:57
@Jauble It
@Jauble it's good to see I'm not the only one that struggled with that problem half asleep. Damn regex and Javascript syntax!
Abhisek Pattnaik
@abhisekp
Sep 28 2015 06:58
@abhisheks420 have you stolen smthng? Any thefts of any kind?
abhisheks420
@abhisheks420
Sep 28 2015 06:58
why @abhisekp
Abhisek Pattnaik
@abhisekp
Sep 28 2015 06:58
@abhisheks420 why 420? :P
abhisheks420
@abhisheks420
Sep 28 2015 06:59
@abhisekp actually that was easy to remember
:P
Abhisek Pattnaik
@abhisekp
Sep 28 2015 06:59
@abhisheks420 you didn't get anything else other 420 ???
LOLz :D
Alexander
@teichopsia-
Sep 28 2015 07:00
@abhisekp I know you love your regex... just ignore me, it's my coping mechanism with frustration :smile:
abhisheks420
@abhisheks420
Sep 28 2015 07:00
@abhisekp you should be unique ;) so i think that it would be great
Abhisek Pattnaik
@abhisekp
Sep 28 2015 07:00
@teichopsia- sry! I didn't get you? :no_mouth:
Alexander
@teichopsia-
Sep 28 2015 07:02
better @abhisekp - don't worry about it... it's late, I'm off to sleep. Once again, thanks for all the help you gave the other night.
CamperBot
@camperbot
Sep 28 2015 07:02
teichopsia- sends brownie points to @abhisekp :sparkles: :thumbsup: :sparkles:
:star: 505 | @abhisekp | http://www.freecodecamp.com/abhisekp
ProLC
@ProLC
Sep 28 2015 07:03
I finally finished the bonfire Title Case a Sentence! Thanks everyone!
Devon Jones
@jones-codes
Sep 28 2015 07:06
how does @camperbot have only 267 points? lol
Abhisek Pattnaik
@abhisekp
Sep 28 2015 07:06
@jones-codes due to generous ppl
thanks @camperbot
CamperBot
@camperbot
Sep 28 2015 07:06
abhisekp sends brownie points to @camperbot :sparkles: :thumbsup: :sparkles:
:star: 268 | @camperbot | http://www.freecodecamp.com/camperbot
Abhisek Pattnaik
@abhisekp
Sep 28 2015 07:07
thanks @abhisekp
CamperBot
@camperbot
Sep 28 2015 07:07
sorry abhisekp, you can't send brownie points to yourself! :sparkles: :sparkles:
Devon Jones
@jones-codes
Sep 28 2015 07:07
congrats, that one was a beast for me. just took another look at it to try to grasp it
yeah! thanks @camperbot You don't get enough credit
CamperBot
@camperbot
Sep 28 2015 07:07
jones-codes sends brownie points to @camperbot :sparkles: :thumbsup: :sparkles:
:star: 269 | @camperbot | http://www.freecodecamp.com/camperbot
x34passenger
@x34passenger
Sep 28 2015 07:56
I do not know how to property flatten an array within an array within an array:
function steamroller(arr) 
{
  var flattened = arr.reduce(function(a, b)
  {
    return a.concat(b);
  });

  return flattened;
}
kasu207
@kasu207
Sep 28 2015 08:11
Hi there, could anybode help me?

function myFunction() {
// Change the 0 to Math.random().
// Only change code below this line.
return Math.random();

// Only change code above this line.
}

Mateja Trifunovski
@Matko95
Sep 28 2015 08:16
@kasu207 what is the name of the waypoint?
@kasu207 it seems to be good, try a different browser or incognito mode
or wiki storage
wiki storage
CamperBot
@camperbot
Sep 28 2015 08:18

:point_right: clear your browser's local storage [wiki]

Removing all your locally stored challenges will solve many problems related to the browser crashing on FreeCodeCamp

In Chrome:

  • On 'freecodecamp.com' open your console
    • Windows: Ctrl + Shift + J
    • Mac OS: Cmd + Opt + J
  • Go to resources tab(chrome).
    • There click on the localStorage link in the nav bar on the right.
  • Delete all the entries on the right side.
  • See if this solves your issue

Alternatively, if you are having issues with a specific challenge freezing your browser, find the name of that challenge in local storage and delete just that one.
:pencil: read more about clear your browsers local storage on the FCC Wiki

kasu207
@kasu207
Sep 28 2015 08:20
@Matko95 Generate Random number.
I m using Firefox, no icognito mode
Mateja Trifunovski
@Matko95
Sep 28 2015 08:20
@kasu207 well you have a private mode
kasu207
@kasu207
Sep 28 2015 08:27
@Matko95 I restarted the browser - now its works. Thank you
CamperBot
@camperbot
Sep 28 2015 08:27
kasu207 sends brownie points to @matko95 :sparkles: :thumbsup: :sparkles:
:star: 393 | @matko95 | http://www.freecodecamp.com/matko95
Katie
@Katie-S
Sep 28 2015 08:35
Can someone please give me a clue what I am missing? This is the basic coin toss and it's not working?
var flip = Math.floor(Math.random() * (1 - 0 + 1)) + 0;
function myFunction(){
  // Create an if-else statement here to return "heads" if flip is 0. Otherwise return "tails".

  // Only change code below this line.

if flip === 0{

  return "heads";

}  else {

      return "tails";
  }


  // Only change code above this line.

}
I think it's because I need to actually tell it to "flip" the coin but not sure?
Mateja Trifunovski
@Matko95
Sep 28 2015 08:38
@Katie-S flip===0 should be inside parentheses (flip ===0)
Katie
@Katie-S
Sep 28 2015 08:39
Thanks @Matko95 I knew I had to missing something simple :blush:
CamperBot
@camperbot
Sep 28 2015 08:39
katie-s sends brownie points to @matko95 :sparkles: :thumbsup: :sparkles:
:star: 394 | @matko95 | http://www.freecodecamp.com/matko95
Mateja Trifunovski
@Matko95
Sep 28 2015 08:39
@Katie-S no prob :) it's always the simple things
Aayush Kapoor
@xeoneux
Sep 28 2015 08:45
@Katie-S Here's a tip: You can write one line if and else statements without creating a block, like
if (flip === 0) return "heads";
else return "tails";
Katie
@Katie-S
Sep 28 2015 08:47
Thanks @xeoneux takes up much less space :)
CamperBot
@camperbot
Sep 28 2015 08:47
katie-s sends brownie points to @xeoneux :sparkles: :thumbsup: :sparkles:
:star: 257 | @xeoneux | http://www.freecodecamp.com/xeoneux
Aayush Kapoor
@xeoneux
Sep 28 2015 08:50
@Katie-S Using ternary operator takes even less space, like
return flip === 0 ? "heads" : "tails";
Katie
@Katie-S
Sep 28 2015 08:56
Once again Thanks @xeoneux Nice to know there are "shortcuts" to how much has to be typed
CamperBot
@camperbot
Sep 28 2015 08:56
katie-s sends brownie points to @xeoneux :sparkles: :thumbsup: :sparkles:
:warning: katie-s already gave xeoneux points
Katie
@Katie-S
Sep 28 2015 08:56
Well, thank you either way ;)
Aayush Kapoor
@xeoneux
Sep 28 2015 08:57
You're welcome :)
Katie
@Katie-S
Sep 28 2015 09:02
I'm also curious as the lessons don't really explain it or at least not yet. When doing the for and while loops the end of the code will have the variable then two ++ at the end of the code. What are the pluses representing?
abhisheks420
@abhisheks420
Sep 28 2015 09:05
these are the post increment operators ... so 
Katie
@Katie-S
Sep 28 2015 09:05
i.e.
ourArray = [];
for(var i = 0; i < 5; i++){
  ourArray.push(i);
}
abhisheks420
@abhisheks420
Sep 28 2015 09:05
if you want to put something like this:i=i+1
after using its value then you can use it as i++
@Katie-S here first var i=0 will be used it will initialize its value to 0
next condition will be checked whether i less than 5 or not
at the end 'i' will be incremented by one
because we will to run our loop 5 times so it's required else it will go into infinite loop
as you are asking about i++ so it will be used as i=i+1
Katie
@Katie-S
Sep 28 2015 09:08
Oh, otherwise it would just check while it was equal to 0 and not then check once you add 1 then add another one etc
Thanks @abhisheks420 That makes sense now. :)
CamperBot
@camperbot
Sep 28 2015 09:08
katie-s sends brownie points to @abhisheks420 :sparkles: :thumbsup: :sparkles:
:warning: could not find receiver for abhisheks420
abhisheks420
@abhisheks420
Sep 28 2015 09:09
your welcome @Katie-S :)
Karolis
@Luomint
Sep 28 2015 09:24
pomodoro
kasu207
@kasu207
Sep 28 2015 09:28

Hi guys, I got stuck at "Waypoint: Make Object Properties Private" I dont get the question right. ( How do I write the code in the blackquares)
var Bike = function() {
// Only change code below this line.
this.speed = 100;
function addUnit(value) {
return value + "KM/H";
}

getSpeed = function () {
return addUnit(speed);
};

};

How do I change the properties and methods to private or public?

Abhisek Pattnaik
@abhisekp
Sep 28 2015 09:29
explain format
CamperBot
@camperbot
Sep 28 2015 09:29

: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

```js ⇦ Type 3 backticks, then type js or html and 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

Abhisek Pattnaik
@abhisekp
Sep 28 2015 09:29
@kasu207 :point_up: September 28, 2015 2:59 PM
kasu207
@kasu207
Sep 28 2015 09:30
first question solved , thanks @abhisekp
CamperBot
@camperbot
Sep 28 2015 09:30
kasu207 sends brownie points to @abhisekp :sparkles: :thumbsup: :sparkles:
:star: 506 | @abhisekp | http://www.freecodecamp.com/abhisekp
kasu207
@kasu207
Sep 28 2015 09:40
This message was deleted
Jason
@Jauble
Sep 28 2015 09:50
I'm kinda tired, hopefully this makes sense.. If you were making a nested for loop with i as the counter outside and j on the counter inside, how would you refer to the counter on the inside? How would you refer to j of str[i] if that makes sense. Intuitively it seems like it would be str[i][j], but I know that's not right, or at least it doesn't work for me.
Aleksandar B.
@aleksandar-b
Sep 28 2015 09:51
@Jauble it's right str[i][j]
Jason
@Jauble
Sep 28 2015 09:52
@samosale Thanks, I'll try it again. Maybe I had a typo or something.
CamperBot
@camperbot
Sep 28 2015 09:52
jauble sends brownie points to @samosale :sparkles: :thumbsup: :sparkles:
:star: 276 | @samosale | http://www.freecodecamp.com/samosale
Aleksandar B.
@aleksandar-b
Sep 28 2015 09:53
@Jauble Can you paste your code somewhere?
Jason
@Jauble
Sep 28 2015 10:12
@samosale ya, hold on, my charger doesn't seem to be working and my battery is down to 10% so I'm kinda screwed if I can't get it to work
Stjepan Mazalovic
@stjema
Sep 28 2015 10:17
This message was deleted
Jason
@Jauble
Sep 28 2015 10:17
got it to start charging, but I gotta hold it in place
Raji von Arx
@kemosabe73
Sep 28 2015 10:18
I have a question for the TwitchAPI Project, if the streamer is offline or not streaming, should the status still provide a link for his twitch page? The twitch API (/streams) only provides a url if the user is streaming and I find it wrong to link anyone anywhere if there is no streami on-going. Of course I could use another link (/channel) or just provide the direct link (meh) to the twitch link but it just seems wrong.
Jason
@Jauble
Sep 28 2015 10:25
still around @samosale?
Aleksandar B.
@aleksandar-b
Sep 28 2015 10:25
yes
Jason
@Jauble
Sep 28 2015 10:26
            function titleCase(str) {
                var strArray = str.toLowerCase().split(' ');
                console.log(strArray);
                for (var i = 0; i < strArray.length; i++) {
                    for (var j = 0; j < strArray[i].length; j++) {
                      if (j === 0) {
                          strArray[i][j].toUpperCase();
                        }
                        else {
                          continue;
                        }
                    }
                }
                console.log(strArray);
                return strArray;
            }
I've tried a bunch of different things, but that's where I'm at right now
Oops, meant to take out the console.log's
Whatever I do, it just returns the original string lowercase, or it returns just the first letter of each word in uppercase
Coira Ellison
@Coira
Sep 28 2015 10:30
hey @Jauble, looks like you got the regex working :)
Jason
@Jauble
Sep 28 2015 10:31
@Coira Yep, finally! lol
Coira Ellison
@Coira
Sep 28 2015 10:31
strings are immutable, you can't change them, you'll need to create a new string with upper case and the rest of the string
Jason
@Jauble
Sep 28 2015 10:32
Ohh that's right. I remember seeing someone post that in here earlier too lol
mientje
@mientje
Sep 28 2015 10:32
Miauw lost kitten here. I keep looking at that twitch API documentation and the panic just won't go away. I want to see if a stream is live but I'm always getting null even if they are live. I've got a client id and the init function. I got : twitch.open("GET", "https://api.twitch.tv/kraken/streams/Destiny", true); twitch.send()
But I guess this isn't nearly complicated enough. Please don't laugh
Jason
@Jauble
Sep 28 2015 10:33
@Coira Ok thanks!
CamperBot
@camperbot
Sep 28 2015 10:33
jauble sends brownie points to @coira :sparkles: :thumbsup: :sparkles:
:star: 243 | @coira | http://www.freecodecamp.com/coira
Jason
@Jauble
Sep 28 2015 10:34
Sorry, that's over my head @mientje
Aleksandar B.
@aleksandar-b
Sep 28 2015 10:34
@Jauble use this
function titleCase(str) {

  var arr = str.toLowerCase().split(" ");
  var arr1 = [];
  for (var i = 0; i < arr.length; i++) {

   var data = arr[i].charAt(0).toUpperCase() + arr[i].slice(1);

    arr1.push(data);

  }

  var string = arr1.join(" ");

  return string;

}

titleCase("I'm a little tea pot");
Stjepan Mazalovic
@stjema
Sep 28 2015 10:35
@Coira Ok thanks!
CamperBot
@camperbot
Sep 28 2015 10:35
stjema sends brownie points to @coira :sparkles: :thumbsup: :sparkles:
:star: 244 | @coira | http://www.freecodecamp.com/coira
Coira Ellison
@Coira
Sep 28 2015 10:35
hi @stjema but I haven't helped you yet :p
Stjepan Mazalovic
@stjema
Sep 28 2015 10:37
i'm just nice to you.. kinda
Jason
@Jauble
Sep 28 2015 10:37
@Coira Thanks, I'm gonna try to see if I can figure it out tomorrow, but I'll save that in case I get too frustrated lol
CamperBot
@camperbot
Sep 28 2015 10:37
jauble sends brownie points to @coira :sparkles: :thumbsup: :sparkles:
:warning: jauble already gave coira points
Aleksandar B.
@aleksandar-b
Sep 28 2015 10:37
I think that Destiny user is not live. This user is live: https://api.twitch.tv/kraken/streams/monstercat
@mientje
Coira Ellison
@Coira
Sep 28 2015 10:37
well, not going to complain about free brownie points, thanks @stjema :p
CamperBot
@camperbot
Sep 28 2015 10:37
coira sends brownie points to @stjema :sparkles: :thumbsup: :sparkles:
:star: 264 | @stjema | http://www.freecodecamp.com/stjema
Stjepan Mazalovic
@stjema
Sep 28 2015 10:38
what does the star mean?
Coira Ellison
@Coira
Sep 28 2015 10:38
it's how many points you have (brownie points + points from doing code)
Stjepan Mazalovic
@stjema
Sep 28 2015 10:40
/kiss
Jason
@Jauble
Sep 28 2015 10:40
Well I'm gonna try to get some sleep. Thanks again @Coira & @samosale
CamperBot
@camperbot
Sep 28 2015 10:40
:warning: jauble already gave samosale points
jauble sends brownie points to @coira and @samosale :sparkles: :thumbsup: :sparkles:
:warning: jauble already gave coira points
Coira Ellison
@Coira
Sep 28 2015 10:40
@Jauble night!
Jason
@Jauble
Sep 28 2015 10:41
night!
Stjepan Mazalovic
@stjema
Sep 28 2015 10:41
stjema has more SUPER-POINTS than @Coira. Taadaaa.
muahaha
Coira Ellison
@Coira
Sep 28 2015 10:41
@stjema might work with a : rather than /, let's try, :kiss:
oh, i want to take that back now :(
Stjepan Mazalovic
@stjema
Sep 28 2015 10:41
/help
CamperBot
@camperbot
Sep 28 2015 10:41

Hi, I'm CamperBot! I can help you in this chatroom :smile:

Basic Commands:

  • find TOPIC find all entries about topic. ex: find js
  • wiki TOPIC show contents of topic page
  • thanks @username send brownie points to another user
  • about @username shows info on that user
  • bonfire BONFIRENAME info on a bonfire

:speech_balloon: meet CamperBot in this room!

:pencil: read more about camperbot on the FCC Wiki

Coira Ellison
@Coira
Sep 28 2015 10:41
damn fake internet karma!
Stjepan Mazalovic
@stjema
Sep 28 2015 10:42
no /me command here omg... :kiss:
Stjepan Mazalovic
@stjema
Sep 28 2015 10:42
stjema wants a little cute @Coira .
what is this animal called?
mientje
@mientje
Sep 28 2015 10:43
@samosale yes, it is !!! I'm not into twitch tv or games. This is an alien world to me. Thanks for the next step, sometimes I need a little encouragement>
CamperBot
@camperbot
Sep 28 2015 10:43
mientje sends brownie points to @samosale :sparkles: :thumbsup: :sparkles:
:star: 277 | @samosale | http://www.freecodecamp.com/samosale
Coira Ellison
@Coira
Sep 28 2015 10:43
me too, look at it's little face
red panda
Stjepan Mazalovic
@stjema
Sep 28 2015 10:44
even the name is so cuuute
KAWAIIIIIIIIIIIII <33333333333333333
@Coira
var array = [4,5,6,7,8];
var singleVal = 0;
// Only change code below this line.
var singleVal = array.reduce(function(previousVal, currentVal){
  return previousVal + currentVal;
});


// Only change code above this line.
(function() {return singleVal;})();
console.log(array);
console.log(singleVal);
CamperBot
@camperbot
Sep 28 2015 10:45
:bulb: to format code use backticks! ``` more info
Coira Ellison
@Coira
Sep 28 2015 10:46
@stjema what's the waypoint called?
why is singleVal = 30
o.O
add the array numbers and you get 30, yes. but why does it gets added
Coira Ellison
@Coira
Sep 28 2015 10:47
that's just what reduce does
whatever you return from reduce get's added together
Stjepan Mazalovic
@stjema
Sep 28 2015 10:47
and what is previousVal and currentVal?=
Coira Ellison
@Coira
Sep 28 2015 10:47
ok, give me a minute
@stjema ok, here's the example from the mdn page https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/Reduce
[0, 1, 2, 3, 4].reduce(function(previousValue, currentValue, index, array) {
  return previousValue + currentValue;
});
Mateja Trifunovski
@Matko95
Sep 28 2015 10:49
@stjema previousVal and currentVal are just placeholder names, you could also put a and b instead of that, what .reduce does is that it takes the first and second element in an array and does something with them, then second an third.. until the end
and then returns 1 element
Coira Ellison
@Coira
Sep 28 2015 10:50
yeah ^ ^ , reduce works like a loop,
Stjepan Mazalovic
@stjema
Sep 28 2015 10:51
aha
o.o
Coira Ellison
@Coira
Sep 28 2015 10:51
@stjema it'll go through every element in the array, where prevVal is the value returned previously, currentVal is the element of the array it's currently adding
you just don't have to write out for... etc
Stjepan Mazalovic
@stjema
Sep 28 2015 10:52
aah
i gained 30% knowledge boni for today!
Coira Ellison
@Coira
Sep 28 2015 10:53
and you got to see a cute red panda face too :)
Stjepan Mazalovic
@stjema
Sep 28 2015 10:53
not anymore.. i'm seeing a cruel beast ._.
Coira Ellison
@Coira
Sep 28 2015 10:53
oh...?
are it's little beady eyes staring into your soul?
Stjepan Mazalovic
@stjema
Sep 28 2015 10:54
ouh yes o.o ok thanks @Coira
thanks @Coira
CamperBot
@camperbot
Sep 28 2015 10:55
stjema sends brownie points to @coira :sparkles: :thumbsup: :sparkles:
:warning: stjema already gave coira points
Stjepan Mazalovic
@stjema
Sep 28 2015 10:55
why do you have less points than me but you know js better than me
o.ö
Coira Ellison
@Coira
Sep 28 2015 10:55
np, going to lunch now, i'll get a new pic when i'm back
i don't know, i should complain!
Stjepan Mazalovic
@stjema
Sep 28 2015 10:56
thanks @Matko95
CamperBot
@camperbot
Sep 28 2015 10:56
stjema sends brownie points to @matko95 :sparkles: :thumbsup: :sparkles:
:star: 395 | @matko95 | http://www.freecodecamp.com/matko95
Stjepan Mazalovic
@stjema
Sep 28 2015 10:57
/play nyan
bad :(
pity pity pity.. no sound function on g itter
Mateja Trifunovski
@Matko95
Sep 28 2015 10:59
there is
music
CamperBot
@camperbot
Sep 28 2015 10:59
Katie
@Katie-S
Sep 28 2015 10:59
Is there a particular place I kind find more info on a particular waypoint to help me figure out what it's asking me to do?
Cubor
@Cubor
Sep 28 2015 11:00
Hi there ! I got a question on challenge #157
I can copypast the stuff, but I don't understand why do you need the two "+" ?
Stjepan Mazalovic
@stjema
Sep 28 2015 11:01
i dont want music, i want sounds, @Matko95
Cubor
@Cubor
Sep 28 2015 11:01
In $($('.slot')[0]).html('<img src = "' + images[slotOne-1] + '">');
Mateja Trifunovski
@Matko95
Sep 28 2015 11:02
@Cubor you can use the "+" sign for concatenation
@Cubor you are merging 3 strings together
Bonnartom
@Bonnartom
Sep 28 2015 11:03
help
CamperBot
@camperbot
Sep 28 2015 11:03

Hi, I'm CamperBot! I can help you in this chatroom :smile:

Basic Commands:

  • find TOPIC find all entries about topic. ex: find js
  • wiki TOPIC show contents of topic page
  • thanks @username send brownie points to another user
  • about @username shows info on that user
  • bonfire BONFIRENAME info on a bonfire

:speech_balloon: meet CamperBot in this room!

:pencil: read more about camperbot on the FCC Wiki

Mateja Trifunovski
@Matko95
Sep 28 2015 11:03
@Bonnartom what's wrong :)
Bonnartom
@Bonnartom
Sep 28 2015 11:03
hi person
Katie
@Katie-S
Sep 28 2015 11:05
help js object instances
CamperBot
@camperbot
Sep 28 2015 11:05
no wiki entry for: js object instances
:pencil: click here to create one now!after creating your page type update to reload it here
Cubor
@Cubor
Sep 28 2015 11:05
@Matko95 Thx ! I'll look for it
CamperBot
@camperbot
Sep 28 2015 11:05
cubor sends brownie points to @matko95 :sparkles: :thumbsup: :sparkles:
:star: 396 | @matko95 | http://www.freecodecamp.com/matko95
Katie
@Katie-S
Sep 28 2015 11:05
help constructor function
CamperBot
@camperbot
Sep 28 2015 11:05

:point_right: waypoint make instances of objects with a constructor function [wiki]

A function that creates objects is called a constructor_, my favorite way of creating objects when you have to create more than one of the same object. You can also edit the second object to add more properties if needed. This is called creating _instances of an object.

Each new instance of this object inherits all the properties and methods of your original object.

var Car = function() {
   this.wheels = 4;
};

// New instance of Car object.
var myCar = new Car();

//Add the property "engines" to myCar, and make it a number.
myCar.engines = 1;

:pencil: read more about waypoint make instances of objects with a constructor function on the FCC Wiki

Katie
@Katie-S
Sep 28 2015 11:07
and I thought I had tried that.... I didn't want the solution, but I guess that works
Mateja Trifunovski
@Matko95
Sep 28 2015 11:08
@Katie-S what's wrong?
Katie
@Katie-S
Sep 28 2015 11:13
I got it now thanks. Just the way the instructions were written on this waypoint were horrible. I didn't have any clue how "create a new instance using constructor function". It said to create 1. function that creates objects = constructor 2. you can create "instances" using a CONSTRUCTOR so that led me to believe I had to write a new function to make a new instance . I understood that the properties carried I just wasn't sure how to add on the new properties. i.e. just type new instance name and then a period with new property
CamperBot
@camperbot
Sep 28 2015 11:13
if you want to thank someone, put an @ before their name!
Katie
@Katie-S
Sep 28 2015 11:13
@Matko95
Just was confusing the way it was written. I understand now, but for a @Matko95 complete newbie it didn't explain itself very well.
lol wow i gotta double check my typing
Mateja Trifunovski
@Matko95
Sep 28 2015 11:15
@Katie-S oh cool :)
Katie
@Katie-S
Sep 28 2015 11:25
Thanks @Matko95 for asking though. Appreciate you trying to help me out :smile:
CamperBot
@camperbot
Sep 28 2015 11:25
katie-s sends brownie points to @matko95 :sparkles: :thumbsup: :sparkles:
:star: 398 | @matko95 | http://www.freecodecamp.com/matko95
AnandSiyote
@AnandSiyote
Sep 28 2015 11:26
Need Help with Bonfire: Seek and Destroy!!!
CamperBot
@camperbot
Sep 28 2015 11:26
type bonfire name to get some info on that bonfire. And check HelpBonfires chatroom
Katie
@Katie-S
Sep 28 2015 11:27
@AnandSiyote Take out the word with and retype
AnandSiyote
@AnandSiyote
Sep 28 2015 11:28
Need Help with Bonfire: Seek and Destroy!!!
CamperBot
@camperbot
Sep 28 2015 11:28
type bonfire name to get some info on that bonfire. And check HelpBonfires chatroom
Abhijeet De
@iamads
Sep 28 2015 11:31
bonfire destroy
CamperBot
@camperbot
Sep 28 2015 11:31

: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

Abhijeet De
@iamads
Sep 28 2015 11:31
@AnandSiyote Click on the link
AnandSiyote
@AnandSiyote
Sep 28 2015 11:34
Which link?
Aayush Kapoor
@xeoneux
Sep 28 2015 11:34
@AnandSiyote What is it?
Gary Wong
@gary-w
Sep 28 2015 11:34
wiki Waypoint: Make Object Properties Private
CamperBot
@camperbot
Sep 28 2015 11:34

:point_right: waypoint make object properties private [wiki]

Objects have their own attributes, called properties_, and their own functions, called _methods.

You can use the this keyword to reference public properties and methods of the current objects. However, when You need to create private ones, so they are not accessible from the outside of the object.

For that, you just remove the keyword this from the object property or method declaration.

var Bike = function() {
  speed = 100; // private
  function addUnit(value) { // private
    return value + "KM/H";
  }

  this.getSpeed = function () {  // public
    return addUnit(speed);
  };

};

:pencil: read more about waypoint make object properties private on the FCC Wiki

AnandSiyote
@AnandSiyote
Sep 28 2015 11:34
@iamads which link?
Abhijeet De
@iamads
Sep 28 2015 11:35
@AnandSiyote the one with bonfire seek and destroy by camperbot
Alexandrix Ikechukwu
@SpaghettiThots
Sep 28 2015 11:49
Hello people
Could I get some help with the palindrome exercise?
My regex isn't working!
```js
var palin = str.replace(/\s0-9[^0-9A-Za-z]/g, "");
Aayush Kapoor
@xeoneux
Sep 28 2015 11:51
@IshMary \w searches for all words in a string
@IshMary \W searches for all non-words in a string
Alexandrix Ikechukwu
@SpaghettiThots
Sep 28 2015 11:51
Do I have to use those @xeoneux ?
Aayush Kapoor
@xeoneux
Sep 28 2015 11:52
However, as JS considers underscore a word, you use or as well
Not necessary but it's the better way
So the regex you want is /\W|_/g
Alexandrix Ikechukwu
@SpaghettiThots
Sep 28 2015 11:53
Don't kid me. That simple?
Let me see how that goes
Rory Smith
@alanbuchanan
Sep 28 2015 11:54
has anyone completed every single module of Waypoint: Manage Packages with NPM?
Aayush Kapoor
@xeoneux
Sep 28 2015 11:57
@IshMary Yup! :)
@AnandSiyote Did you find a solution?
Alexandrix Ikechukwu
@SpaghettiThots
Sep 28 2015 12:03
@xeoneux How did you do the comparison to return the boolean? I am thinking of looping over each.
Aayush Kapoor
@xeoneux
Sep 28 2015 12:04
@IshMary Reverse the string and compare
@IshMary There's a method, Array.reverse()
Alexandrix Ikechukwu
@SpaghettiThots
Sep 28 2015 12:06
Ok. Fair enough.
Not sure what I'm doing wrong.
function palindrome(str) {
  // Good luck!
  str = str.toLowerCase();
  var palin = str.replace(/\W|_/g, "");

  palin = str.split('').reverse().join('');
  if(str === palin.split('').reverse().join('')){
    return true;
  }
  else{
    return false;
  }
}

palindrome("eye");
Doesn't work.
Aayush Kapoor
@xeoneux
Sep 28 2015 12:11
You're splitting, reversing and joining twice!
function palindrome(str) {
  // Good luck!
  str = str.toLowerCase();
  var palin = str.replace(/\W|_/g, "");

  palin = str.split('').reverse().join('');
  if(str === palin){
    return true;
  }
  else{
    return false;
  }
}

palindrome("eye");
Alexandrix Ikechukwu
@SpaghettiThots
Sep 28 2015 12:11
The second was to compare
Aayush Kapoor
@xeoneux
Sep 28 2015 12:12
It gives you the same string again!
So there's no use comparing the two...
You need to check if the reversed string is the same as the normal string
Alexandrix Ikechukwu
@SpaghettiThots
Sep 28 2015 12:15
Do me a favour @xeoneux . Can I see your original solution to this problem?
Aayush Kapoor
@xeoneux
Sep 28 2015 12:15
Voila!
function palindrome(str) {
  str = str.toLowerCase().replace(/\W|_/g, "");
  var rev = str.split("").reverse().join("");

  if (str === rev) return true;

  return false;
}

palindrome("eye");
Alexandrix Ikechukwu
@SpaghettiThots
Sep 28 2015 12:19
Don't kid me... Where in Heaven's Name are you from?
:-)
Aayush Kapoor
@xeoneux
Sep 28 2015 12:21
@IshMary Lol, what?
Pratik Ratnaparkhi
@pratikr1593
Sep 28 2015 12:23
 cvar test = (function() {
  var testString = "Ada Lovelace and Charles Babbage designed the first computer and the software that would have run on it.";
  var expressionToGetSoftware = /software/gi;
  // Only change code below this line.

   var string = "Ada Lovelace and Charles Babbage designed the first computer and the software that would have run on it.";

  var expression: /and/gi;

  // Only change code above this line.
  // We use this function to show you the value of your variable in your output box.
  return testString.match(expression).length;
})();(function(){return test;})();
Alexandrix Ikechukwu
@SpaghettiThots
Sep 28 2015 12:23
I mean... I'm looking thru the code to see where I missed it.
Pratik Ratnaparkhi
@pratikr1593
Sep 28 2015 12:23
it says:
Let's try selecting all the occurrences of the word and in the string Ada Lovelace and Charles Babbage designed the first computer and the software that would have run on it. We can do this by replacing the . part of our regular expression with the current regular expression with the word and.
Alexandrix Ikechukwu
@SpaghettiThots
Sep 28 2015 12:24
@pratikr1593 You don't have any issues with that, do you?
Aayush Kapoor
@xeoneux
Sep 28 2015 12:24
@pratikr1593 Right!
Pratik Ratnaparkhi
@pratikr1593
Sep 28 2015 12:24
I have, thats why I posted it, It doesn't work for some reason
Tom Whitbread
@tomtom87
Sep 28 2015 12:25
Hey guys I am trying to do the first base jump but the yeoman script is failing
Aayush Kapoor
@xeoneux
Sep 28 2015 12:25
@pratikr1593 Because you've written var expression: /and/gi;
@pratikr1593 :P
Alexandrix Ikechukwu
@SpaghettiThots
Sep 28 2015 12:25
@xeoneux You could have let me try with that.
Aayush Kapoor
@xeoneux
Sep 28 2015 12:26
@IshMary Hehe, I'm sorry
Alexandrix Ikechukwu
@SpaghettiThots
Sep 28 2015 12:26
I need brownie points too. :+1:
Pratik Ratnaparkhi
@pratikr1593
Sep 28 2015 12:26
even = doesn't work. @IshMary @xeoneux
Aayush Kapoor
@xeoneux
Sep 28 2015 12:26
@IshMary Next time for sure!
@pratikr1593 What?
Tom Whitbread
@tomtom87
Sep 28 2015 12:26
here is my issue on github, it already exists FreeCodeCamp/FreeCodeCamp#3146
You can see my problem at the bottom
Pratik Ratnaparkhi
@pratikr1593
Sep 28 2015 12:27
@xeoneux if i put '=' t still doesn't work.
 cvar test = (function() {
  var testString = "Ada Lovelace and Charles Babbage designed the first computer and the software that would have run on it.";
  var expressionToGetSoftware = /software/gi;
  // Only change code below this line.

   var string = "Ada Lovelace and Charles Babbage designed the first computer and the software that would have run on it.";

  var expression= /and/gi;

  // Only change code above this line.
  // We use this function to show you the value of your variable in your output box.
  return testString.match(expression).length;
})();(function(){return test;})();
Tom Whitbread
@tomtom87
Sep 28 2015 12:28
? What would you like to write tests with? Jasmine
You're using the fantastic NgComponent generator.

Initializing yo-rc.json configuration.


events.js:72
        throw er; // Unhandled 'error' event
              ^
TypeError: Object [object Object] has no method 'isAbsolute'
    at Generator.processDirectory (/home/ubuntu/.nvm/v0.10.35/lib/node_modules/generator-angular-fullstack/util.js:110:19)
    at Generator.generateProject (/home/ubuntu/.nvm/v0.10.35/lib/node_modules/generator-angular-fullstack/app/generator.js:399:14)
    at /home/ubuntu/.nvm/v0.10.35/lib/node_modules/generator-angular-fullstack/node_modules/yeoman-generator/lib/base.js:429:16
    at processImmediate [as _immediateCallback] (timers.js:354:15)
Alexandrix Ikechukwu
@SpaghettiThots
Sep 28 2015 12:29
@pratikr1593 why not do ```jsexpression = /and/gi;
Aayush Kapoor
@xeoneux
Sep 28 2015 12:29
This message was deleted
var test = (function() {
  var testString = "Ada Lovelace and Charles Babbage designed the first computer and the software that would have run on it.";
  var expressionToGetSoftware = /software/gi;
  // Only change code below this line.

  var expression = /and/gi;

  // Only change code above this line.
  // We use this function to show you the value of your variable in your output box.
  return testString.match(expression).length;
})();(function(){return test;})();
Alexandrix Ikechukwu
@SpaghettiThots
Sep 28 2015 12:29
var expression = /and/gi;
Pratik Ratnaparkhi
@pratikr1593
Sep 28 2015 12:30
var test = (function() {
  var testString = "Ada Lovelace and Charles Babbage designed the first computer and the software that would have run on it.";
  var expressionToGetSoftware = /software/gi;
  // Only change code below this line.

  var expression = /and/gi;

  // Only change code above this line.
  // We use this function to show you the value of your variable in your output box.
  return testString.match(expression).length;
})();(function(){return test;})();
Alexandrix Ikechukwu
@SpaghettiThots
Sep 28 2015 12:30
You joined expression to =
Aayush Kapoor
@xeoneux
Sep 28 2015 12:30
@IshMary That doesn't matter
Tom Whitbread
@tomtom87
Sep 28 2015 12:30
Anyone read me?
Pratik Ratnaparkhi
@pratikr1593
Sep 28 2015 12:30
@IshMary Thanks. it worked.
CamperBot
@camperbot
Sep 28 2015 12:30
pratikr1593 sends brownie points to @ishmary :sparkles: :thumbsup: :sparkles:
:star: 174 | @ishmary | http://www.freecodecamp.com/ishmary
Alexandrix Ikechukwu
@SpaghettiThots
Sep 28 2015 12:30
Really? I thought it did
Pratik Ratnaparkhi
@pratikr1593
Sep 28 2015 12:30
@xeoneux Thank you!
CamperBot
@camperbot
Sep 28 2015 12:30
pratikr1593 sends brownie points to @xeoneux :sparkles: :thumbsup: :sparkles:
:star: 261 | @xeoneux | http://www.freecodecamp.com/xeoneux
Alexandrix Ikechukwu
@SpaghettiThots
Sep 28 2015 12:31
@xeoneux he said it worked.
Anytime @pratikr1593 .
Pratik Ratnaparkhi
@pratikr1593
Sep 28 2015 12:31
@IshMary don't know whats up with you two, but I will be back with more.
Aayush Kapoor
@xeoneux
Sep 28 2015 12:31
@IshMary It worked due to something else :P
@IshMary var abc=3 is the same as var abc = 3
Tom Whitbread
@tomtom87
Sep 28 2015 12:32
anyone?
Alexandrix Ikechukwu
@SpaghettiThots
Sep 28 2015 12:33
So why did it work, Lord @xeoneux ? I'd really like to know.
Aayush Kapoor
@xeoneux
Sep 28 2015 12:34
@IshMary No idea :/
Alexandrix Ikechukwu
@SpaghettiThots
Sep 28 2015 12:35
@pratikr1593 , @xeoneux is a truly great guy. He's held my head above water since I came here.
I'm seeing the beauty of community first hand. Thanks @xeoneux :sparkles:
CamperBot
@camperbot
Sep 28 2015 12:36
ishmary sends brownie points to @xeoneux :sparkles: :thumbsup: :sparkles:
:star: 262 | @xeoneux | http://www.freecodecamp.com/xeoneux
Aayush Kapoor
@xeoneux
Sep 28 2015 12:38
@IshMary Thanks for your words of appreciation! :D
CamperBot
@camperbot
Sep 28 2015 12:38
xeoneux sends brownie points to @ishmary :sparkles: :thumbsup: :sparkles:
:star: 175 | @ishmary | http://www.freecodecamp.com/ishmary
Santiago Melo
@smeloa
Sep 28 2015 12:43

Hi can someone help me with the call to the Wikipedia API. I am using AngularJS and this is my call:

https://en.wikipedia.org/w/api.php?callback=?action=opensearch&format=json&search=PacMan

I am getting the: Access-Control-Allow-Origin and saw the add callback=? suggestion above, but don't really know how to implement it.

Jason Wood
@catapixel
Sep 28 2015 12:44
@smeloa my guess is that your problem is that you are making the call across domains and don't have a callback implemented properly. Try adding "&callback=?" to the end of your string
@smeloa you'll need to remove it from earlier and move it to the end
Santiago Melo
@smeloa
Sep 28 2015 12:46
@catapixel still getting the error message
Jason Wood
@catapixel
Sep 28 2015 12:47
@smeloa how are you making the call? what does your surrounding code look like?
Raygendary
@raygendary
Sep 28 2015 12:47
can you get a job by just knowing SQL and PHP?
Santiago Melo
@smeloa
Sep 28 2015 12:48
@catapixel
app.controller("wikipediaCtrl", function($scope, $http, $log) {

  var searchTerm = "PacMan";

  $http.get("https://en.wikipedia.org/w/api.php?action=opensearch&format=json&search="+searchTerm+"&callback=?").success(function (data) {
    $log.log(data);
    $scope.allresults = data;
  }).error(function () {
    alert("an unexecpeted error occured!")
  })
CamperBot
@camperbot
Sep 28 2015 12:48
:trollface: troll problems? notify admins here
Aayush Kapoor
@xeoneux
Sep 28 2015 12:50
@smeloa Haha, your "troll" in "app.controller" triggered camperbot
CamperBot
@camperbot
Sep 28 2015 12:50
:trollface: troll problems? notify admins here
Jason Wood
@catapixel
Sep 28 2015 12:53
@smeloa you need to get the json and then run it through parse the html.
Santiago Melo
@smeloa
Sep 28 2015 12:53
@xeoneux I should report the Wikipedia app
Aayush Kapoor
@xeoneux
Sep 28 2015 12:54
@smeloa Lol :D
Pratik Ratnaparkhi
@pratikr1593
Sep 28 2015 12:54
can anyone explain, what does inverting regular expression matches in javascript means?
Santiago Melo
@smeloa
Sep 28 2015 12:54
@catapixel but isn't the $http.get already doing that?
Aayush Kapoor
@xeoneux
Sep 28 2015 12:55
@pratikr1593 Suppose a regular matches ABC
@pratikr1593 If you invert it, it will match everything but ABC
@smeloa $http.get isn't getting json. It's getting whatever is provided
Santiago Melo
@smeloa
Sep 28 2015 12:57

fixed it:

  $http.jsonp("https://en.wikipedia.org/w/api.php?action=opensearch&format=json&search="+searchTerm+"&callback=JSON_CALLBACK"

thanks @catapixel @xeoneux

CamperBot
@camperbot
Sep 28 2015 12:57
smeloa sends brownie points to @catapixel and @xeoneux :sparkles: :thumbsup: :sparkles:
:star: 263 | @xeoneux | http://www.freecodecamp.com/xeoneux
:star: 394 | @catapixel | http://www.freecodecamp.com/catapixel
Jason Wood
@catapixel
Sep 28 2015 12:58
@smeloa :thumbsup: One other thing. You don't need to make it a secure call. In other words you should be able to drop the "s" from "https"
Alexandrix Ikechukwu
@SpaghettiThots
Sep 28 2015 13:00
@catapixel @xeoneux How would you define a word in simple terms with respect to the LongestWord challenge?
Jason Wood
@catapixel
Sep 28 2015 13:02
@IshMary a word is "all characters between a leading and trailing space"
Rory Smith
@alanbuchanan
Sep 28 2015 13:02
on Waypoint: Manage Packages with NPM there seem to be issues like this FreeCodeCamp/FreeCodeCamp#758 that prevent completion... is there a way around it?
Aayush Kapoor
@xeoneux
Sep 28 2015 13:03
@catapixel Right on!
Alexandrix Ikechukwu
@SpaghettiThots
Sep 28 2015 13:04
Ok.
That means regular expressions for that problem.
DoRm
@DoRm
Sep 28 2015 13:08
@IshMary If you're talking about the bonfire Find the longest string why would you use regular expressions...
Aayush Kapoor
@xeoneux
Sep 28 2015 13:12
@IshMary Exactly what @DoRm said!
Pratik Ratnaparkhi
@pratikr1593
Sep 28 2015 13:16
<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.
   selector $(".slot");
    $($(".slot")[0]).html(slotOne);
    selector $(".slot");
    $($(".slot")[1]).html(slotOne);
    selector $(".slot");
    $($(".slot")[2]).html(slotOne);


    // Only change code above this line.

    if(slotOne !== slotTwo || slotTwo !== slotThree){
      return null;
    }

    if(slotOne !== undefined && slotTwo !== undefined && slotThree !== undefined){
      $(".logger").html(slotOne);
      $(".logger").append(" " + slotTwo);
      $(".logger").append(" " + slotThree);
    }

    return [slotOne, slotTwo, slotThree];
  }

  $(document).ready(function(){
     $(".go").click(function(){
       runSlots();
     });
   });
</script>

<div>
 <div class = "container inset">
   <div class = "header inset">
     <img src="https://s3.amazonaws.com/freecodecamp/freecodecamp_logo.svg.gz" alt="learn to code javascript at Free Code Camp logo" class="img-responsive nav-logo">
     <h2>FCC Slot Machine</h2>
   </div>
   <div class = "slots inset">
     <div class = "slot inset">

     </div>
     <div class = "slot inset">

     </div>
     <div class = "slot inset">

     </div>
   </div>
   <br/>
   <div class = "outset">
     <button class = "go inset">
       Go
     </button>
   </div>
   <br/>
   <div class = "foot inset">
     <span class = "logger"></span>
   </div>
 </div>
</div>

<style>
 .container {
   background-color: #4a2b0f;
   height: 400px;
   width: 260px;
   margin: 50px auto;
   border-radius: 4px;
 }
 .header {
   border: 2px solid #fff;
   border-radius: 4px;
   height: 55px;
   margin: 14px auto;
   background-color: #457f86
 }
 .header h2 {
   height: 30px;
   margin: auto;
 }
 .header h2 {
   font-size: 14px;
   margin: 0 0;
   padding: 0;
   color: #fff;
   text-align: center;
 }
 .slots{
   display: flex;
   background-color: #457f86;
   border-radius: 6px;
   border: 2px solid #fff;
 }
 .slot{
   flex: 1 0 auto;
   background: white;
   height: 75px;
   margin: 8px;
   border: 2px solid #215f1e;
   border-radius: 4px;
   text-align: center;
   padding-top: 25px;
 }
 .go {
   width: 100%;
   color: #fff;
   background-color: #457f86;
   border: 2px solid #fff;
   border-radius: 2px;
   box-sizing: none;
   outline: none!important;
 }
 .foot {
   height: 150px;
   background-color: 457f86;
   border: 2px solid #fff;
 }

 .logger {
   color: white;
   margin: 10px;
 }

 .outset {
   -webkit-box-shadow: 0px 0px 15px -2px rgba(0,0,0,0.75);
   -moz-box-shadow: 0px 0px 15px -2px rgba(0,0,0,0.75);
     box-shadow: 0px 0px 15px -2px rgba(0,0,0,0.75);
 }

 .inset {
   -webkit-box-shadow: inset 0px 0px 15px -2px rgba(0,0,0,0.75);
   -moz-box-shadow: inset 0px 0px 15px -2px rgba(0,0,0,0.75);
   box-shadow: inset 0px 0px 15px -2px rgba(0,0,0,0.75);
 }
</style>
whats wrong with this code?

Let's use the jQuery selector $(".slot") to select all of the slots.

Once they are all selected, we can use bracket notation to access each individual slot:

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

This jQuery will select the first and update the slot's HTML to display the correct number.

Use the above selector to display each number in its corresponding slot.

error says: unexpected identifier
DoRm
@DoRm
Sep 28 2015 13:18
@pratikr1593 first off we didn't need all that code and you should look at $($(".slot")[1]).html(slotOne); again
Pratik Ratnaparkhi
@pratikr1593
Sep 28 2015 13:19
@DoRm Okay, I changed it. but it says unexpected identifier?
  // Only change code below this line.
   selector $(".slot 0");
    $($(".slot")[0]).html(slotOne);
    selector $(".slot 1");
    $($(".slot")[1]).html(slotTwo);
    selector $(".slot 2");
    $($(".slot")[2]).html(slotThree);
DoRm
@DoRm
Sep 28 2015 13:22
@pratikr1593 I don't know why you have all that selector code in there
Pratik Ratnaparkhi
@pratikr1593
Sep 28 2015 13:26
@DoRm Thanks.I got it fixed. removed all selector code.
CamperBot
@camperbot
Sep 28 2015 13:26
pratikr1593 sends brownie points to @dorm :sparkles: :thumbsup: :sparkles:
:warning: could not find receiver for dorm
Pratik Ratnaparkhi
@pratikr1593
Sep 28 2015 13:29

    $($('.slot')[0]).html('<img src = "' + images[slotOne-0] + '">');
    $($('.slot')[1]).html('<img src = "' + images[slotTwo-1] + '">');
    $($('.slot')[2]).html('<img src = "' + images[slotThree-2] + '">');
Cubor
@Cubor
Sep 28 2015 13:29
This message was deleted
Pratik Ratnaparkhi
@pratikr1593
Sep 28 2015 13:30
I used the code three times, it still says..
Use the provided code three times. One for each slot.
tva10
@tva10
Sep 28 2015 13:30
@pratikr1593 [slotOne-0] -> [slotOne-1]
Aayush Kapoor
@xeoneux
Sep 28 2015 13:30
@pratikr1593 Which Waypoint?
tva10
@tva10
Sep 28 2015 13:31
@pratikr1593 [slotThree-2] ->[slotThree-1]
harwluk
@harwluk
Sep 28 2015 13:32
Hello all. First time posting in here. Let me know if I'm posting in the wrong spot, but I'm a little confused about syntax with the .charAt() function...
'''
Pratik Ratnaparkhi
@pratikr1593
Sep 28 2015 13:32
@xeoneux Waypoint: Give your JavaScript Slot Machine some stylish images
DoRm
@DoRm
Sep 28 2015 13:32
.charAt(0); will return the letter at index 0
Cubor
@Cubor
Sep 28 2015 13:33
I'm at the same lvl as @pratikr1593 , thing is I still don't get why you need concatenation
Pratik Ratnaparkhi
@pratikr1593
Sep 28 2015 13:33
@tva10 Thanks! got it fixed
CamperBot
@camperbot
Sep 28 2015 13:33
pratikr1593 sends brownie points to @tva10 :sparkles: :thumbsup: :sparkles:
:star: 263 | @tva10 | http://www.freecodecamp.com/tva10
Cubor
@Cubor
Sep 28 2015 13:34
You need the url stocked in the 1st, second or 3rd place in the images variable, that's ok, but why these two + ?
harwluk
@harwluk
Sep 28 2015 13:34

and clearly confused on the markdown for posting on here, lol... anyway, here's the code I have that I have an issue with
'''
function titleCase(str) {
str = str.toLowerCase().split(" ");

for (i=0; i<str.length; i++){
str[i].charAt(0) = str[i].charAt(0).toUpperCase();
}

str = str.join(" ");
return str;
}

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

when I try to assign a value here, I come up with 'invalid assignment left-hand'
'''
str[i].charAt(0) = str[i].charAt(0).toUpperCase();
'''

CamperBot
@camperbot
Sep 28 2015 13:34
:bulb: to format code use backticks! ``` more info
harwluk
@harwluk
Sep 28 2015 13:35
sorry, I misread that as single quotes
Aleksandar B.
@aleksandar-b
Sep 28 2015 13:35
@harwluk strings are immutable
tva10
@tva10
Sep 28 2015 13:35
@harwluk you can edit this message
Tom Whitbread
@tomtom87
Sep 28 2015 13:36
hey guys can anyone help with my issue on the basecamp
Abhisek Pattnaik
@abhisekp
Sep 28 2015 13:36
explain format
CamperBot
@camperbot
Sep 28 2015 13:36

: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

```js ⇦ Type 3 backticks, then type js or html and 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

Abhisek Pattnaik
@abhisekp
Sep 28 2015 13:36
@harwluk :point_up: September 28, 2015 7:04 PM
Abhisek Pattnaik
@abhisekp
Sep 28 2015 13:37
@tomtom87 :point_up: September 28, 2015 7:06 PM
Aleksandar B.
@aleksandar-b
Sep 28 2015 13:37
@harwluk you can't mutate the string...
kasu207
@kasu207
Sep 28 2015 13:38

Hi guys Iam struggeling with Bonfire: Reverse a String, can anybody give me a hint?

`function reverseString(str) {
return str;
}

reverseString("hello", "");
`

harwluk
@harwluk
Sep 28 2015 13:38
ahhh, @samosale , that makes sense that they're immutable, so I should probably assign each string to a new array before changing them and then join them again. Thanks for the help. --- and thanks @all for the help with formatting code snippets. Misunderstood the backticks for single quotes. I'll be sorted for next time. Thanks again
CamperBot
@camperbot
Sep 28 2015 13:38
harwluk sends brownie points to @samosale and @all :sparkles: :thumbsup: :sparkles:
:warning: could not find receiver for all
:star: 278 | @samosale | http://www.freecodecamp.com/samosale
Aayush Kapoor
@xeoneux
Sep 28 2015 13:39
@kasu207 There's no reverse method for a string
Abhisek Pattnaik
@abhisekp
Sep 28 2015 13:39
@tomtom87 sry! Haven't got there yet!
Aayush Kapoor
@xeoneux
Sep 28 2015 13:39
@kasu207 You have to split it into an Array, Reverse it and then Join it again...
kasu207
@kasu207
Sep 28 2015 13:39
I know that I have to change the string into an array
Phillip Kneeland
@pkneeland78
Sep 28 2015 13:40
Good morning everyone! Stuck on way point 39 of basic JavaScript. What am I doing wrong here?
<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")[0]).html(slotOne);
    $($(".slot")[0]).html(slotTwo);
    $($(".slot")[0]).html(slotThree);

    // Only change code above this line.
kasu207
@kasu207
Sep 28 2015 13:40
var str = 'asdfghjkl';
var strReverse = str.split('').reverse().join(''); // 'lkjhgfdsa'
// split() returns an array on which reverse() and join() can be applied
I have to use this, but I dont know how to ?
Blauelf
@Blauelf
Sep 28 2015 13:41
@pkneeland78 You assign the three variables to one and the same slot element. Use [0], [1], [2] instead.
Phillip Kneeland
@pkneeland78
Sep 28 2015 13:42
ah, excellent! Thanks @Blauelf :)
CamperBot
@camperbot
Sep 28 2015 13:42
pkneeland78 sends brownie points to @blauelf :sparkles: :thumbsup: :sparkles:
:star: 311 | @blauelf | http://www.freecodecamp.com/blauelf
Aleksandar B.
@aleksandar-b
Sep 28 2015 13:42
@harwluk you have already done that(each string in the new array)... but you can not change the first letter of the array bc they are immutable. You must assign to new variable value of first letter, and concatinate with the second variable that contains the rest of the word using slice()
Aayush Kapoor
@xeoneux
Sep 28 2015 13:42
@kasu207 Use it on the str parameter that was passed to you by the function
kasu207
@kasu207
Sep 28 2015 13:42
Ah ok, I tried to use reverseString
harwluk
@harwluk
Sep 28 2015 13:45
@samosale , i meant to split off each word into separate arrays made up of letters -- (eg) [word1, word2] = [[w,o,r,d,1], [w,o,r,d,1]]
kasu207
@kasu207
Sep 28 2015 13:45

Hm, still struggeling,

reverseString("hello", "");
reverseString = reverseString.split('').reverse().join('');

I actually dont know what I have to do.

Aleksandar B.
@aleksandar-b
Sep 28 2015 13:46
@harwluk ok then
harwluk
@harwluk
Sep 28 2015 13:47
@samosale perhaps my solution's not as elegant, though. I'll take a look at yours. thanks again!
CamperBot
@camperbot
Sep 28 2015 13:47
harwluk sends brownie points to @samosale :sparkles: :thumbsup: :sparkles:
:warning: harwluk already gave samosale points
DoRm
@DoRm
Sep 28 2015 13:47
@kasu207 return it
kasu207
@kasu207
Sep 28 2015 13:50
@DoRm I tried js return reverseString;
Moisés Man
@moigithub
Sep 28 2015 13:50

@kasu207
this is one way to declare a function

function sum(a,b ) {
 /// all ur logic should be inside the curly brackets
 // some function returns values...
  return a + b; // <-- like that
}

then on another part of ur code u can CALL the function

var test1 = sum(10 + 5 ) ;
alert(test1);
so we can say.. there are a function DECLARATION where u write the logic(the code dont execute),
.... and a function CALLING where u USE the function (it executes)
@kasu207
here u calling
reverseString("hello", "");
so somewhere should have a function declaration...
function reverseString( str ) {
  /// all ur logic here...
  /// whatever commands/instructions/code u need to 
  // RETURN a reversed string (str)
}
kasu207
@kasu207
Sep 28 2015 13:55
@moigithub I have this, I am trying to reverse this on
Moisés Man
@moigithub
Sep 28 2015 14:00
@kasu207 reverseString = reverseString.split('').reverse().join('');
is on WRONG place
u not assign the result to the function name
and u should work on str variable (if u move to the RIGHT place)
x34passenger
@x34passenger
Sep 28 2015 14:00
how do you return "not a function"
Moisés Man
@moigithub
Sep 28 2015 14:01
u mean returning a string ?? (a text message ) @x34passenger
return "hello world";
kasu207
@kasu207
Sep 28 2015 14:01
so
js str=str.split('').reverse().join('');
?
x34passenger
@x34passenger
Sep 28 2015 14:01
@moigithub expect(add(2)(3)).to.equal(5);add(...) is not a function
Aayush Kapoor
@xeoneux
Sep 28 2015 14:02
@x34passenger Anything other than a function is not a function...
Moisés Man
@moigithub
Sep 28 2015 14:02
Aayush Kapoor
@xeoneux
Sep 28 2015 14:02
@kasu207 Using str=str.split('').reverse().join(''); will change the value of the string!
@kasu207 However you can store it in a new variable
x34passenger
@x34passenger
Sep 28 2015 14:03
@xeoneux I am not able to pass the bonfire arguments optional, the ones which say is not a function, what am I suppose to return?
Aayush Kapoor
@xeoneux
Sep 28 2015 14:03
@kasu207 newStr=str.split('').reverse().join('');
Moisés Man
@moigithub
Sep 28 2015 14:03
@kasu207
ur code should be inside the function declaration
function reverseString(str) {
 /// HERE
 // inside the curly brackets
  return str.split etc etc etc
}
x34passenger
@x34passenger
Sep 28 2015 14:04
@moigithub I don't think it is about closures, have you done bonfire arguments optional?
Aayush Kapoor
@xeoneux
Sep 28 2015 14:04
@x34passenger What is the name of the bonfire?
DoRm
@DoRm
Sep 28 2015 14:04
He has the right code but for some unknown reason he removed it out of the function and is not returning it
x34passenger
@x34passenger
Sep 28 2015 14:04
@xeoneux bonfire arguments optional
Moisés Man
@moigithub
Sep 28 2015 14:04
@x34passenger there are an example there
and yes.. i already finished ALL the curricula
kasu207
@kasu207
Sep 28 2015 14:05
But how does the programm now to change hello in olleh, if I call it afterwards
x34passenger
@x34passenger
Sep 28 2015 14:05
@moigithub I am able to pass all the tests except the 2 that say is not a function
Aayush Kapoor
@xeoneux
Sep 28 2015 14:05
@x34passenger Show me the code!
@kasu207 Didn't get you...
x34passenger
@x34passenger
Sep 28 2015 14:06
function add() 
{
  var firstArg = arguments[0];
  var secondArg = arguments[1];
  var total;

  // if(v instanceof Function)
  if( typeof firstArg === 'string' || typeof secondArg === 'string' )
  {
    total = undefined;
  }
  else
  {
    total = firstArg + secondArg;
  }

  return total;
}
DoRm
@DoRm
Sep 28 2015 14:07
@kasu207 Javascript is an interpretive language so it will see reversestring("hello"); then go look for the function your trying to call
kasu207
@kasu207
Sep 28 2015 14:07

sry, I was worng. This is the code:

function reverseString(str) {
  return str;

}

reverseString("hello", "");

and the task is, to switch "Hello" to "Olleh"

x34passenger
@x34passenger
Sep 28 2015 14:07
@moigithub what am I missing in my code to handle not a function?
Aayush Kapoor
@xeoneux
Sep 28 2015 14:08
@x34passenger Look at the question
@x34passenger You might get 2 arguments or you might get only 1 argument
Moisés Man
@moigithub
Sep 28 2015 14:08
@x34passenger u need to check the arguments length
Aayush Kapoor
@xeoneux
Sep 28 2015 14:08
@x34passenger Will your code run if you get only 1 argument?
x34passenger
@x34passenger
Sep 28 2015 14:08
@xeoneux yes
Phillip Kneeland
@pkneeland78
Sep 28 2015 14:09
hello me again! Where am I going wrong?
var Car = function() {
   this.wheels = 4;
};

// Only change code below this line.
var myCar = function() {
  this.wheels = 4; 
  this.engines = 1;
};
//Add the property "engines" to myCar, and make it a number.


// Only change code above this line.
(function() {return JSON.stringify(myCar);})();
Aayush Kapoor
@xeoneux
Sep 28 2015 14:09
@x34passenger Like @moigithub said, check the length of arguments and determine what should be done
x34passenger
@x34passenger
Sep 28 2015 14:09
@moigithub okay so I check the arguments length and then what?
Aayush Kapoor
@xeoneux
Sep 28 2015 14:09
@x34passenger After that return a function if length of arguments is 1
Moisés Man
@moigithub
Sep 28 2015 14:09
@pkneeland78 u need to add engines property OUTSIDE myCar declaration.. and work with myCar variable
Aayush Kapoor
@xeoneux
Sep 28 2015 14:10
@x34passenger And if the length of the arguments is 2, just return the sum of the 2 arguments
x34passenger
@x34passenger
Sep 28 2015 14:10
@xeoneux how do you return a function?
Aayush Kapoor
@xeoneux
Sep 28 2015 14:10
@x34passenger How do you return a variable?
@x34passenger
return function(){};
But in this case you need a parameter as well, so
return function(param){};
x34passenger
@x34passenger
Sep 28 2015 14:20
@xeoneux I don't quite understand, what specific function am I returning?
@xeoneux for example, regarding: expect(add(2)(3)).to.equal(5);add(...) is not a function
what function am I suppose to return?
Aayush Kapoor
@xeoneux
Sep 28 2015 14:21
@x34passenger You're returning a function that takes in another parameters, then sums it up with the previous parameter and returns it
@x34passenger Here's the question add(2)(3)
@x34passenger Let's break it up!
x34passenger
@x34passenger
Sep 28 2015 14:22
@xeoneux you mean add(2), add(3)?
Aayush Kapoor
@xeoneux
Sep 28 2015 14:22
@x34passenger You need to process add(2) first
@x34passenger It should return a function that then takes in (3)
@x34passenger Something like this:
Step 1: add(2)(3)
Step 2: someFunction(3)
Step 3: 5
Thus, add(2) should return a function so that we can use the next value, that is (3)
Did you get it now?
x34passenger
@x34passenger
Sep 28 2015 14:24
@xeoneux if you process add(2), is that 2+0?
Aayush Kapoor
@xeoneux
Sep 28 2015 14:25
@x34passenger No! Internally, it won't do that. It'll just return a function with 2 as one of the parameter...
Do you want me to show you the code?
x34passenger
@x34passenger
Sep 28 2015 14:26
@xeoneux yes, I don't get it
Aayush Kapoor
@xeoneux
Sep 28 2015 14:27
@x34passenger
function add() {
  var arg = arguments[0];
  if (!Number.isInteger(arg)) return undefined;
  if (arguments.length === 2) {
    if (Number.isInteger(arguments[1])) {
      return arguments[0] + arguments[1];
    } else return undefined;
  } else {
    return function(x) {
      if (!Number.isInteger(x)) return undefined;
      return arg + x;
    };
  }
}

add(2,3);
Blauelf
@Blauelf
Sep 28 2015 14:29
What does add("1","2") return?
Ah, it does in fact return undefined. Number.isInteger does not use implicit conversion here.
x34passenger
@x34passenger
Sep 28 2015 14:29
@xeoneux which waypoint covers this?
Aayush Kapoor
@xeoneux
Sep 28 2015 14:30
@x34passenger None | Nil | Null
x34passenger
@x34passenger
Sep 28 2015 14:31
@xeoneux I never would have figured it out, of all the intermediate bonfires, that was the only one I did not understand
thanks @xeoneux
CamperBot
@camperbot
Sep 28 2015 14:31
x34passenger sends brownie points to @xeoneux :sparkles: :thumbsup: :sparkles:
:star: 265 | @xeoneux | http://www.freecodecamp.com/xeoneux
Aayush Kapoor
@xeoneux
Sep 28 2015 14:31
@x34passenger And the level will keep on increasing :D
x34passenger
@x34passenger
Sep 28 2015 14:32
@xeoneux well I finished the upper intermediate, but it was just that one that I was just totally lost
Rory Smith
@alanbuchanan
Sep 28 2015 14:41
on Waypoint: Manage Packages with NPM there seem to be issues like this FreeCodeCamp/FreeCodeCamp#758 that prevent completion... is there a way around it?
Michael Havis
@mhavis86
Sep 28 2015 15:05
I'm running into an issue in Bonfire: Check for Palindromes. The final test says that "0_0 (: /-\ :) 0-0" should return true, but that string begins with 0_0 and ends with 0-0 which makes it not a palindrome. Is this a know issue or am I doing something wrong?
DoRm
@DoRm
Sep 28 2015 15:09
0_0 and 0-0 are the same thing forward and backwards
Mateja Trifunovski
@Matko95
Sep 28 2015 15:11
they are not
@mhavis86 the idea in that test is to check if you removed all characters, after that it becomes "0000"
Michael Havis
@mhavis86
Sep 28 2015 15:12
@Matko95 Perfect. Thank you.
CamperBot
@camperbot
Sep 28 2015 15:12
mhavis86 sends brownie points to @matko95 :sparkles: :thumbsup: :sparkles:
:star: 399 | @matko95 | http://www.freecodecamp.com/matko95
DoRm
@DoRm
Sep 28 2015 15:13
I forgot they are on the same test I thought it was two different test
which in case if they are two different test then 0-0 and 0_0 would be a palindrome
Phillip Kneeland
@pkneeland78
Sep 28 2015 15:23
thanks @moigithub like more than an hour later! Sorry :)
CamperBot
@camperbot
Sep 28 2015 15:23
pkneeland78 sends brownie points to @moigithub :sparkles: :thumbsup: :sparkles:
:star: 358 | @moigithub | http://www.freecodecamp.com/moigithub
Phillip Kneeland
@pkneeland78
Sep 28 2015 15:33
I'm completely lost on this one:
var Car = function() {
   this.wheels = 4;
};

// Only change code below this line.
var myCar = new Car();

//Add the property "engines" to myCar, and make it a number.


// Only change code above this line.
(function() {return JSON.stringify(myCar);})();
reconspartan55
@reconspartan55
Sep 28 2015 15:34
Same was just about to ask
Phillip Kneeland
@pkneeland78
Sep 28 2015 15:35
I'm suppose to add the property "engine" to myCar, and not sure on how to do so....
Fábio Paraíso Oliveira
@FabioParaiso
Sep 28 2015 15:35
So you created a new class called Car
which has the property wheels
reconspartan55
@reconspartan55
Sep 28 2015 15:35
no that was there
Phillip Kneeland
@pkneeland78
Sep 28 2015 15:36

var Car = function() {
this.wheels = 4;
};

// Only change code below this line.
var myCar = new Car();

//Add the property "engines" to myCar, and make it a number.

// Only change code above this line.
(function() {return JSON.stringify(myCar);})();

Fábio Paraíso Oliveira
@FabioParaiso
Sep 28 2015 15:36
Yeah i kw i kbow =)
*know
Phillip Kneeland
@pkneeland78
Sep 28 2015 15:36
sorry wrong keyboard....
I'm at work as well....
Fábio Paraíso Oliveira
@FabioParaiso
Sep 28 2015 15:36
Normally you can add new properties in 2 ways
or you define it inside the constructor by adding something like this.engine = 1
reconspartan55
@reconspartan55
Sep 28 2015 15:38
what would it look like
Alexandrix Ikechukwu
@SpaghettiThots
Sep 28 2015 15:38
Sorry @DoRm and @xeoneux . Had to attend to some stuff. SO what do you guys think about the longest string problem?
Fábio Paraíso Oliveira
@FabioParaiso
Sep 28 2015 15:38
after the this.wheels part
but in this case you just want to add a property to the my car variable
reconspartan55
@reconspartan55
Sep 28 2015 15:38
no it cant be added there
Fábio Paraíso Oliveira
@FabioParaiso
Sep 28 2015 15:39
yes I know
reconspartan55
@reconspartan55
Sep 28 2015 15:39
oh ok so where would i put it
Fábio Paraíso Oliveira
@FabioParaiso
Sep 28 2015 15:39
so you have to use the other method
reconspartan55
@reconspartan55
Sep 28 2015 15:39
which is
Fábio Paraíso Oliveira
@FabioParaiso
Sep 28 2015 15:39
you can add using the dot method or square brakets
and it would stay somehting like
myvar["myproperty"] = number
or myvar.myproperty = number
see the object part of the codeacademy its a good helper on that part
Pratik Ratnaparkhi
@pratikr1593
Sep 28 2015 15:43
//Here is a sample Object
var car = {
  "wheels":4,
  "engines":1,
  "seats":5
};

//Now Let's make a similar Object called motorBike
//Give it two wheels, one engine and one seat
var motorBike = {
  // Only change code below this line.
"wheeles":2,
  "engine":1,
  "seats":5


  // Only change code above this line.
};

(function() {return JSON.stringify(motorBike);})();
motorBike should have a wheels attribute set to a number.');motorBike should have a wheels attribute set to a number.
how can I do it?
I dont recall it, can anyone help?
Chris
@Shifthawke
Sep 28 2015 15:45
you misspelled wheels.
@pratikr1593
Phillip Kneeland
@pkneeland78
Sep 28 2015 15:45
@pratikr1593 you have a typo in the second occurance of "wheels"
Amber Camus
@aacam
Sep 28 2015 15:45
@pratikr1593 check the spelling. "wheels" is spelled as "wheels"
reconspartan55
@reconspartan55
Sep 28 2015 15:45

var Car = function() {
this.wheels = 4;
};

// Only change code below this line.
var myCar = new Car();
myCar.engine = 1;
//Add the property "engines" to myCar, and make it a number.

// Only change code above this line.
(function() {return JSON.stringify(myCar);})();

The property engine of myCar should be a number
How???
Anyone know what I am doing wrong
Ariel
@ArielLeslie
Sep 28 2015 15:47
explain formatting
CamperBot
@camperbot
Sep 28 2015 15:47

: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

```js ⇦ Type 3 backticks, then type js or html and 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

Pratik Ratnaparkhi
@pratikr1593
Sep 28 2015 15:47
//Here is a sample Object
var car = {
  "wheels":4,
  "engines":1,
  "seats":5
};

//Now Let's make a similar Object called motorBike
//Give it two wheels, one engine and one seat
var motorBike = {
  // Only change code below this line.
  assert(typeof(motorBike.engines) === 'number';
  assert(typeof(motorBike.wheels) === 'number';



"wheels":2,
  "engines":1,
  "seats":5


  // Only change code above this line.
};

(function() {return JSON.stringify(motorBike);})();
even that doesn't work
Ariel
@ArielLeslie
Sep 28 2015 15:48
@reconspartan55 It's supposed to be "engines" not "engine"
Pratik Ratnaparkhi
@pratikr1593
Sep 28 2015 15:49
@Shifthawke @aacam changed the spelling, but it doesn't work .Unexpected token '('. Expected a ':' following the property name 'assert'.
reconspartan55
@reconspartan55
Sep 28 2015 15:49
oh
Thanks @ArielLeslie
CamperBot
@camperbot
Sep 28 2015 15:49
reconspartan55 sends brownie points to @arielleslie :sparkles: :thumbsup: :sparkles:
:star: 416 | @arielleslie | http://www.freecodecamp.com/arielleslie
Ariel
@ArielLeslie
Sep 28 2015 15:49
@pratikr1593 "unexpected token" always means "typo"
@pratikr1593 In this case you aren't closing all your parentheses in your assert statements
Pratik Ratnaparkhi
@pratikr1593
Sep 28 2015 15:51
@ArielLeslie Can you help? I don't understand which is an extra parenthesis?
Ariel
@ArielLeslie
Sep 28 2015 15:52
@pratikr1593 Count your opening ones and closing ones. You need to have the same number
Aleksander Gębicki
@Takumar
Sep 28 2015 15:52
@pratikr1593 look at these lines:
  assert(typeof(motorBike.engines) === 'number';
  assert(typeof(motorBike.wheels) === 'number';
@pratikr1593 extra means something additional.
Phillip Kneeland
@pkneeland78
Sep 28 2015 15:54
thanks @FabioParaiso for the thorough explination :clap:
CamperBot
@camperbot
Sep 28 2015 15:54
pkneeland78 sends brownie points to @fabioparaiso :sparkles: :thumbsup: :sparkles:
:star: 236 | @fabioparaiso | http://www.freecodecamp.com/fabioparaiso
Pratik Ratnaparkhi
@pratikr1593
Sep 28 2015 15:54
@ArielLeslie I understood that @Takumar , but I am confused where should I put another closing or opening parentheses? i tried multiple places it throws same error
Ariel
@ArielLeslie
Sep 28 2015 15:55
@pratikr1593 On both lines it will need to be before the ;. If you're not sure where, you need to re-read the docs for the function(s) you're using.
Aleksander Gębicki
@Takumar
Sep 28 2015 15:55
@ArielLeslie said to you, that your aren't closing all your parantheses in assert statements. Check how many times you have opening paranthesis and how many closing.
@pratikr1593 assert( ) is testing the condition between its parantheses, so you have to enclose entire condition between ( )
Roman19
@Roman19
Sep 28 2015 16:01
"Be sure to delete all trailing comment tags, i.e. -->."
what should I do? I do not understand. help me please
Ariel
@ArielLeslie
Sep 28 2015 16:03
@Roman19 Make sure that you don't have --> still left in your code.
Pratik Ratnaparkhi
@pratikr1593
Sep 28 2015 16:03
This message was deleted
 assert(typeof(motorBike.engines) === 'number');
  assert(typeof(motorBike.wheels) === 'number');
@Takumar @ArielLeslie , isn't that right? it says Unexpected token '('. Expected a ':' following the property name 'assert'.
I tried putting ':' it didn't worked
Avil
@Avil172
Sep 28 2015 16:05

hi.. i am learning js functions.
can someone explain what's the difference between..

var orangeCost=function(Numbers)
{
    var total=Numbers*5;
    console.log(total);
};
orangeCost(52);

and

var orangeCost=function(Numbers)
{
    total=Numbers*5;
    console.log(total);
};
orangeCost(52);

(to be more specific, i want to know why is the need of declaring total as a variable inside var, whereas we can do so without "var")

Vitalii Danylov
@vitaliidanylov
Sep 28 2015 16:08
Hi everyone! I almost finished my "Pomodoro Timer" project and now I want to add some animation to my timer. Could anyone give my peace of advice what library in this case would be appropriate. Thank You!
Ariel
@ArielLeslie
Sep 28 2015 16:08
@pratikr1593 You're probably not using a library that has assert. I'm not sure why you're trying to use it anyway. It isn't part of the waypoint
@vitaliidanylov What type of animation?
Danielle Soto
@purplewuzzles
Sep 28 2015 16:08
I'm not sure why my join command isn't working:
blob
Pratik Ratnaparkhi
@pratikr1593
Sep 28 2015 16:08
@ArielLeslie I am on Waypoint: Declare JavaScript Objects as Variables
Aleksandar B.
@aleksandar-b
Sep 28 2015 16:09
@Avil172 total without var is global variable and it is considered a bad practice
Ariel
@ArielLeslie
Sep 28 2015 16:09
@pratikr1593 I know
Aleksandar B.
@aleksandar-b
Sep 28 2015 16:10
@purplewuzzles you need to put the code inside function. and return olleh
DTing
@dting
Sep 28 2015 16:10
@purplewuzzles your code should in the function right now it is just displaying line 34's output
Vitalii Danylov
@vitaliidanylov
Sep 28 2015 16:11
@ArielLeslie smth what will be appropriate for timer animation...maybe visual effect for changing numbers or simillar
Pratik Ratnaparkhi
@pratikr1593
Sep 28 2015 16:11
  assert(typeof(motorBike.engines) === 'number');
  assert(typeof(motorBike.wheels) === 'number');
@ArielLeslie Please check it once. isn't that right?
Ariel
@ArielLeslie
Sep 28 2015 16:11
@pratikr1593 I don't know why you're putting the assert statement in there. Also, I don't think that you can even use assert() without using a library
Pratik Ratnaparkhi
@pratikr1593
Sep 28 2015 16:12
it still says Unexpected token '('. Expected a ':' following the property name 'assert'., and I tried putting ':'
gives same error
Ariel
@ArielLeslie
Sep 28 2015 16:12
@vitaliidanylov jQuery?
@pratikr1593 That's because assert() isn't a standard javascript function
Avil
@Avil172
Sep 28 2015 16:12
@samosale oh, i got it. thanks.
CamperBot
@camperbot
Sep 28 2015 16:12
avil172 sends brownie points to @samosale :sparkles: :thumbsup: :sparkles:
:star: 279 | @samosale | http://www.freecodecamp.com/samosale
DTing
@dting
Sep 28 2015 16:12
@pratikr1593 you are trying to make an assertion inside an object literal
var motorBike = {
  // This is inside an object literal
  assert(typeof(motorBike.engines) === 'number'; 
  assert(typeof(motorBike.wheels) === 'number';



"wheels":2,
  "engines":1,
  "seats":5


  // Only change code above this line.
};
if you want to make an assertion do it after that variable assignment
Danielle Soto
@purplewuzzles
Sep 28 2015 16:14
@samosale do you mean the actual join code inside the function? in the parentheses?
DTing
@dting
Sep 28 2015 16:14
var motorBike = {
  // This is inside an object literal
"wheels":2,
  "engines":1,
  "seats":5

  // Only change code above this line.
};

  assert(typeof(motorBike.engines) === 'number'); 
  assert(typeof(motorBike.wheels) === 'number');
Pratik Ratnaparkhi
@pratikr1593
Sep 28 2015 16:15
what should I do to get it right? @dting
DTing
@dting
Sep 28 2015 16:15
@purplewuzzles all the code should go inside the function
Ariel
@ArielLeslie
Sep 28 2015 16:15
@dting @pratikr1593 YOU DO NOT NEED TO USE ASSERT AT ALL
DTing
@dting
Sep 28 2015 16:15
the function is what is called by the tests
you dont need to use assert but you can use it to check your code in the fcc editor
Danielle Soto
@purplewuzzles
Sep 28 2015 16:16
Aha! Thanks so much @dting and @samosale !! :)
CamperBot
@camperbot
Sep 28 2015 16:16
purplewuzzles sends brownie points to @dting and @samosale :sparkles: :thumbsup: :sparkles:
:star: 280 | @samosale | http://www.freecodecamp.com/samosale
:star: 1269 | @dting | http://www.freecodecamp.com/dting
Pratik Ratnaparkhi
@pratikr1593
Sep 28 2015 16:16
@ArielLeslie OMG! Thanks a ton! This line 'Give your motorBike object a wheels, engines and seats attribute and set them to numbers. ' got me confused
CamperBot
@camperbot
Sep 28 2015 16:16
pratikr1593 sends brownie points to @arielleslie :sparkles: :thumbsup: :sparkles:
:star: 418 | @arielleslie | http://www.freecodecamp.com/arielleslie
Aleksandar B.
@aleksandar-b
Sep 28 2015 16:16
@purplewuzzles all your code bellow reverseString("Hello", '') must be inside function reverseString(){your code must be here must be here}
Ariel
@ArielLeslie
Sep 28 2015 16:18
@pratikr1593 :+1: "set them to numbers" just means make them equal to numeric values. assert() is used in testing.
Pratik Ratnaparkhi
@pratikr1593
Sep 28 2015 16:18
@ArielLeslie you must have checked that waypoint. can you tell me how did it worked even if I haven't set any attribute set to number?
Ariel
@ArielLeslie
Sep 28 2015 16:18
@pratikr1593 Show me your code?
Pratik Ratnaparkhi
@pratikr1593
Sep 28 2015 16:18
@ArielLeslie alright! thanks again!
CamperBot
@camperbot
Sep 28 2015 16:18
pratikr1593 sends brownie points to @arielleslie :sparkles: :thumbsup: :sparkles:
:warning: pratikr1593 already gave arielleslie points
Pratik Ratnaparkhi
@pratikr1593
Sep 28 2015 16:19
//Here is a sample Object
var car = {
  "wheels":4,
  "engines":1,
  "seats":5
};



//Now Let's make a similar Object called motorBike
//Give it two wheels, one engine and one seat
var motorBike = {
  // Only change code below this line.



"wheels":2,
  "engines":1,
  "seats":5



  // Only change code above this line.
};

(function() {return JSON.stringify(motorBike);})();
@ArielLeslie
This worked @ArielLeslie
DTing
@dting
Sep 28 2015 16:19
"wheels":2,
  "engines":1,
  "seats":5
Ariel
@ArielLeslie
Sep 28 2015 16:19
@pratikr1593 2, 1, and 5 are all numbers, so you did accomplished the task :sparkles:
DTing
@dting
Sep 28 2015 16:19
those are numbers assigned to attributes
Pratik Ratnaparkhi
@pratikr1593
Sep 28 2015 16:20
@ArielLeslie @dting thanks for helping out!
CamperBot
@camperbot
Sep 28 2015 16:20
pratikr1593 sends brownie points to @arielleslie and @dting :sparkles: :thumbsup: :sparkles:
:warning: pratikr1593 already gave arielleslie points
:star: 1270 | @dting | http://www.freecodecamp.com/dting
Ariel
@ArielLeslie
Sep 28 2015 16:20
You're welcome @pratikr1593
Derek Frankel
@TuvyaYis
Sep 28 2015 16:25
Hi, is the Bike Speed not private... and the .getSpeed not public:

```var Bike = function() {
// Only change code below this line.
"speed": 100,
function addUnit(value) {
return value + "KM/H";
}

this.getSpeed = function () {
return addUnit(speed);
};

};

```var Bike = function() {
// Only change code below this line.
"speed": 100,
function addUnit(value) {
return value + "KM/H";
}

this.getSpeed = function () {
return addUnit(speed);
};

};
```

Sorry... i forget how to properly use the backticks when copy pasting my code
Ariel
@ArielLeslie
Sep 28 2015 16:26
help formatting
CamperBot
@camperbot
Sep 28 2015 16:26

: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

```js ⇦ Type 3 backticks, then type js or html and 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

Ariel
@ArielLeslie
Sep 28 2015 16:27
@TuvyaYis :point_up_2:
Derek Frankel
@TuvyaYis
Sep 28 2015 16:28

var Bike = function() {
  // Only change code below this line.
  "speed": 100,
  function addUnit(value) {
    return value + "KM/H";
  }

  this.getSpeed = function () {
    return addUnit(speed);
  };

};
@ArielLeslie thx... that's a lil different from before
CamperBot
@camperbot
Sep 28 2015 16:29
tuvyayis sends brownie points to @arielleslie :sparkles: :thumbsup: :sparkles:
:star: 419 | @arielleslie | http://www.freecodecamp.com/arielleslie
Danielle Soto
@purplewuzzles
Sep 28 2015 16:30
I'm on the Bonfire: Reverse a String - I can't satisfy all requirements of the task at once. There are 3 variables to return, and I can get them all one at a time, but how do I get all 3 to return at once to satisfy all of the requirements?
Derek Frankel
@TuvyaYis
Sep 28 2015 16:30
@ArielLeslie --- apparently i didn't make speed private and .getSpeed public, correctly? I'm not sure what else to look at?
Aayush Kapoor
@xeoneux
Sep 28 2015 16:31
@TuvyaYis function is not an object so you can't set "speed": 100 here
@TuvyaYis To set is to private, you simply need to declare it with var keyword
@TuvyaYis Like var speed = 900
Ariel
@ArielLeslie
Sep 28 2015 16:32
@TuvyaYis why did you put "speed" in quotes?
Derek Frankel
@TuvyaYis
Sep 28 2015 16:32
because i thought this was a function as an object
or an object at the very least which looks like
```js
var car = {
  "wheels":4,
  "engines":1,
  "seats":5
};
Aayush Kapoor
@xeoneux
Sep 28 2015 16:33
@TuvyaYis Your getSpeed method IS public
Amber Camus
@aacam
Sep 28 2015 16:35
@purplewuzzles check this out: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/split. Look at the description and the last example. I think the link was included in the bf challenge, but that helped me.
Derek Frankel
@TuvyaYis
Sep 28 2015 16:36
@xeoneux @ArielLeslie thx
CamperBot
@camperbot
Sep 28 2015 16:36
tuvyayis sends brownie points to @xeoneux and @arielleslie :sparkles: :thumbsup: :sparkles:
:warning: tuvyayis already gave arielleslie points
:star: 266 | @xeoneux | http://www.freecodecamp.com/xeoneux
Derek Frankel
@TuvyaYis
Sep 28 2015 16:37
this camperbot takes up too much space... it interferes with the flow of productivity or concentration
"your zone" i'd say... its a lil distracting at times when giving points
Danielle Soto
@purplewuzzles
Sep 28 2015 16:45
@aacam I'm just not getting this at all! I looked at the link (looked at it before, too), but it only tells me how to do what I've already done. If I try to combine all the strings into one big array, that doesn't work either. I can get all the phrases reversed, but I'm only able to return them one at a time, which doesn't meet the requirements... :(

```function reverseString(str) {
string="hello";
myArray=string.split('');
reverse1=myArray.reverse();
var olleh=reverse1.join('');

return olleh;
}
reverseString("hello", "");

function reverseString(str) {
string2="Howdy";
myArray2=string2.split('');
reverse2=myArray2.reverse();
var ydwoH=reverse2.join('');

return ydwoH;
}
reverseString("Howdy", "");

function reverseString(str) {
string3="Greetings from Earth";
myArray3=string3.split('');
reverse3=myArray3.reverse();
var earth=reverse3.join('');

return earth;
}
reverseString("Greetings from Earth", "");```

Amber Camus
@aacam
Sep 28 2015 16:56
@purplewuzzles and maybe someone with more coding experience can chime in here because I just started coding and I'm not sure how much help I can but I think the problem might be with the return statement.
Ariel
@ArielLeslie
Sep 28 2015 16:58
explain formatting
CamperBot
@camperbot
Sep 28 2015 16:58

: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

```js ⇦ Type 3 backticks, then type js or html and 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

Ariel
@ArielLeslie
Sep 28 2015 16:58
@purplewuzzles :point_up_2:
If you markup your code, I'll take a look.
J Player
@Heyjp
Sep 28 2015 16:59
Hey @purplewuzzles instead of using string.split, you can call .split on the 'str' parameter. That should allow you to stop repeating yourself.
Danielle Soto
@purplewuzzles
Sep 28 2015 17:00
@aacam I figured it out, finally! I was separating each string/phrase into its own function. When I just listed the strings one after the other in the same function, it worked! Thanks everyone! :)
CamperBot
@camperbot
Sep 28 2015 17:00
purplewuzzles sends brownie points to @aacam :sparkles: :thumbsup: :sparkles:
:star: 175 | @aacam | http://www.freecodecamp.com/aacam
J Player
@Heyjp
Sep 28 2015 17:00
I think i need to take a look at that wiki. :D
Amber Camus
@aacam
Sep 28 2015 17:01
@purplewuzzles Yay! Glad you figured it out. I feel like the transition from the waypoint challenges to bonfire is pretty rough (or at least it has been for me).
Danielle Soto
@purplewuzzles
Sep 28 2015 17:02
Yes, I agree! The waypoints are so basic, without in depth explanation or translation of what the code actually means. Then the bonfire makes a huge leap! I wish the waypoints were more helpful in that sense (instead of just letting me get by by copying syntax without understanding it...). Oh well! :)
Ariel
@ArielLeslie
Sep 28 2015 17:06
@purplewuzzles That's the tricky thing about self-directed study (including most higher education); tools can only reasonably check your ability to perform tasks and it's on you to make sure you actually understand what you're doing.
Amber Camus
@aacam
Sep 28 2015 17:06
@purplewuzzles Haha that's what I did with the waypoints too. The bonfire challenges really make you work for it. It's much more slow going but we're learning a lot more.
Roman19
@Roman19
Sep 28 2015 17:19
What means?Help please
"Remove the style attribute from your h2 element."
Ariel
@ArielLeslie
Sep 28 2015 17:27
@Roman19 It means that you are using inline styles and you shouldn't.
Avil
@Avil172
Sep 28 2015 17:30

hi, can anyone help me in understanding the return fuction?
i mean, if you can write like this..

var product=function(number)
{
    var total=number*2;
    console.log(total);
};
product(3);

then why would you want to write it using return function, i.e.

var product=function(number)
{
return number*2;
};
newvariable=product(3);
console.log(newvariable);

^like this?

Ariel
@ArielLeslie
Sep 28 2015 17:32
@Avil172 Because most of the time what you want to do with the result of a function is not print it to the console.
console.log() is almost exclusively for debugging
Alexandrix Ikechukwu
@SpaghettiThots
Sep 28 2015 17:32
Concerning the FindLongestWord exercise, could I find some help with this?
function findLongestWord(str) {
  var strArray = str.split(" ");


  for(i = 0; i < strArray.length; i++){
    var longest = strArray[0].length;
    if(strArray[i].length > longest){
      longest = strArray[i].length;
    }

    return longest;
  }
}

findLongestWord("The quick brown fox jumped over the lazy dog");
Ariel
@ArielLeslie
Sep 28 2015 17:32
@IshMary What problem are you having?
@IshMary in your for loop, you are resetting longest to the length of the first word every time.
Alexandrix Ikechukwu
@SpaghettiThots
Sep 28 2015 17:33
@ArielLeslie Seems my logic is warped.
Ariel
@ArielLeslie
Sep 28 2015 17:33
with this var longest = strArray[0].length;
Alexandrix Ikechukwu
@SpaghettiThots
Sep 28 2015 17:34
What's up with it?
I first split() the string
Ariel
@ArielLeslie
Sep 28 2015 17:35
@IshMary in your for loop, you are resetting longest to the length of the first word every time.
(as I said before)
Avil
@Avil172
Sep 28 2015 17:36
@ArielLeslie thanks for the reply.
from what i understand , you are saying that, one would like to keep the value obtained from the "return", and use it in future, in that case, the first example(i.e without using the return function) doesn't help because "6" is not stored anywhere.
Alexandrix Ikechukwu
@SpaghettiThots
Sep 28 2015 17:36
SO I should have declared that variable outside the for loop?
Ariel
@ArielLeslie
Sep 28 2015 17:36
@Avil172 right
@IshMary Yes.
Avil
@Avil172
Sep 28 2015 17:37
@ArielLeslie but in second example, 6 is stored inside newvariable so we can use it later.
is that all about return, or is there anything else?
Alexandrix Ikechukwu
@SpaghettiThots
Sep 28 2015 17:37
@ArielLeslie Still doesn't fly.
Ariel
@ArielLeslie
Sep 28 2015 17:38
@Avil172 That's about it. Functions with return values make something that you want to use outside the function.
@IshMary What is your new code?
Avil
@Avil172
Sep 28 2015 17:39
@ArielLeslie understood. thank you very much.
CamperBot
@camperbot
Sep 28 2015 17:39
avil172 sends brownie points to @arielleslie :sparkles: :thumbsup: :sparkles:
:star: 420 | @arielleslie | http://www.freecodecamp.com/arielleslie
Elizabeth Hatleli
@TheHighPriestess
Sep 28 2015 17:40
I'm back to trying to understand .reduce...and I found this example online. It looked promising..as in...simple. However, it doesn't work. Can someone tell me why?
var sum = [1, 2, 3].reduce(
  function(total, num){ return total + num }
  , 0);
x34passenger
@x34passenger
Sep 28 2015 17:41
I am not sure how to create the regex for 555-555-5555
Moisés Man
@moigithub
Sep 28 2015 17:41
@TheHighPriestess it store the result on the variable sum
so if u after that .. add alert(sum); it should show the answer
Elizabeth Hatleli
@TheHighPriestess
Sep 28 2015 17:42
@moigithub It doesn't in repl.it
doesn't in dev tools either
Moisés Man
@moigithub
Sep 28 2015 17:43
then use console.log(sum);
Elizabeth Hatleli
@TheHighPriestess
Sep 28 2015 17:43
hold on
i shouldn't have to do that though
it's returning undefined
Alexandrix Ikechukwu
@SpaghettiThots
Sep 28 2015 17:43
function findLongestWord(str) {
  var strArray = str.split(" ");

  var longest = strArray[0].length;
  for(i = 0; i < strArray.length; i++){

    if(strArray[i].length > longest){
      longest = strArray[i].length;
    }

    return longest;
  }
}

findLongestWord("The quick brown fox jumped over the lazy dog");
Elizabeth Hatleli
@TheHighPriestess
Sep 28 2015 17:43
that's what dev tools is saying.
Moisés Man
@moigithub
Sep 28 2015 17:44
var sum = [1, 2, 3].reduce(
  function(total, num){ return total + num }
  , 0);
console.log(sum);
works fine on repl.it
Elizabeth Hatleli
@TheHighPriestess
Sep 28 2015 17:44
hmm
Ariel
@ArielLeslie
Sep 28 2015 17:44
@TheHighPriestess Do you maybe have a stray keystroke causing a syntax error?
Elizabeth Hatleli
@TheHighPriestess
Sep 28 2015 17:44
@moigithub thanks
CamperBot
@camperbot
Sep 28 2015 17:44
thehighpriestess sends brownie points to @moigithub :sparkles: :thumbsup: :sparkles:
:star: 359 | @moigithub | http://www.freecodecamp.com/moigithub
Ariel
@ArielLeslie
Sep 28 2015 17:45
@x34passenger Have you tried using https://regex101.com/ ?
Elizabeth Hatleli
@TheHighPriestess
Sep 28 2015 17:45
no...and repl.it always shows me the returned values....
oh well...it's working now
x34passenger
@x34passenger
Sep 28 2015 17:45
@ArielLeslie not sure how to begin
@ArielLeslie how do use the dashes in regex?
@ArielLeslie or signify the dashes in regex
Ariel
@ArielLeslie
Sep 28 2015 17:46
@x34passenger it's just the dash character
-
x34passenger
@x34passenger
Sep 28 2015 17:46
@ArielLeslie how do signify the 3 digits?
Ariel
@ArielLeslie
Sep 28 2015 17:46
@x34passenger Do you know how to signify a digit?
x34passenger
@x34passenger
Sep 28 2015 17:46
@ArielLeslie /d
Moisés Man
@moigithub
Sep 28 2015 17:47
\d
Ariel
@ArielLeslie
Sep 28 2015 17:47
@x34passenger Do you know how to signify repetition?
x34passenger
@x34passenger
Sep 28 2015 17:47
@ArielLeslie no
Alexandrix Ikechukwu
@SpaghettiThots
Sep 28 2015 17:47
@ArielLeslie digits should be \d I think.
Elizabeth Hatleli
@TheHighPriestess
Sep 28 2015 17:47
I'm not sure how .reduce is working though. Yeah, that adds the numbers of the array...but the explanation on MDN wasn't helpful.
x34passenger
@x34passenger
Sep 28 2015 17:47
sorry \d for digit
Elizabeth Hatleli
@TheHighPriestess
Sep 28 2015 17:47
...and apart from adding all the numbers of an array...I'm not sure how to use it
x34passenger
@x34passenger
Sep 28 2015 17:48
@ArielLeslie I don't know how to signify digit repetition
Ariel
@ArielLeslie
Sep 28 2015 17:48
@x34passenger Do you know how to signify any repetition?
x34passenger
@x34passenger
Sep 28 2015 17:48
@ArielLeslie no
Ariel
@ArielLeslie
Sep 28 2015 17:48
@x34passenger Did you google it?
x34passenger
@x34passenger
Sep 28 2015 17:49
@TheHighPriestess MDN really needs a lot of work for some of their documentation, some things are not explained well at all!
@ArielLeslie yes
Ariel
@ArielLeslie
Sep 28 2015 17:49
@x34passenger What did you find?
x34passenger
@x34passenger
Sep 28 2015 17:49
@ArielLeslie nothing applicable
Elizabeth Hatleli
@TheHighPriestess
Sep 28 2015 17:49
@x34passenger I know. Some of them are completely useless.
Ariel
@ArielLeslie
Sep 28 2015 17:50
@x34passenger http://bfy.tw/216p
Elizabeth Hatleli
@TheHighPriestess
Sep 28 2015 17:50
but...they're really designed, I think, as documentation...not for learning
x34passenger
@x34passenger
Sep 28 2015 17:50
@ArielLeslie not sure how to signify \d for only 3 digits
Alexandrix Ikechukwu
@SpaghettiThots
Sep 28 2015 17:50
@TheHighPriestess @ArielLeslie Many times the documentation is prepared with certain assumptions
Elizabeth Hatleli
@TheHighPriestess
Sep 28 2015 17:50
@IshMary Yeah....and the word "documentation" is key here. It's often not the best place to go in order to learn.
Ariel
@ArielLeslie
Sep 28 2015 17:51
@x34passenger At least the first three of the links you get from google tell you how to do it.
using mdn is great if you know what you are looking for. definitely more of a documentation resource than a learning one
Alexandrix Ikechukwu
@SpaghettiThots
Sep 28 2015 17:54
THen again, it seems they are the better place to dive into production code. @TheHighPriestess @ArielLeslie
Elizabeth Hatleli
@TheHighPriestess
Sep 28 2015 17:55
I have yet to find a good source of information on .reduce