These are chat archives for FreeCodeCamp/Help

29th
Aug 2015
PhilipWoulfe
@PhilipWoulfe
Aug 29 2015 00:02
@jbryant8706 should be $('#target1').parent().css('background', 'red');
$('#target1').parent().css('background-color', 'red'); works too, you were targeting the parent of #leftwell, not #target1
JeremyWBean
@JeremyWBean
Aug 29 2015 00:06
@dnorthrupva Awesome. thank you much
CamperBot
@camperbot
Aug 29 2015 00:06
jeremywbean sends brownie points to @dnorthrupva :sparkles: :thumbsup: :sparkles:
:star: 271 | @dnorthrupva | http://www.freecodecamp.com/dnorthrupva
Donavin Northrup
@dnorthrupva
Aug 29 2015 00:06
@JeremyWBean No problem, if you need help with it lemme know, but it's very simple once you're used to it. And a great extra to add easily.
Jake Bryant
@jbryant8706
Aug 29 2015 00:08
@pillphil I got it! Thanks!
CamperBot
@camperbot
Aug 29 2015 00:08
jbryant8706 sends brownie points to @pillphil :sparkles: :thumbsup: :sparkles:
:star: 226 | @pillphil | http://www.freecodecamp.com/pillphil
NITEHAWK07
@NITEHAWK07
Aug 29 2015 00:16
Anyone one want to pair on bonfire with me?
Donavin Northrup
@dnorthrupva
Aug 29 2015 00:21
@NITEHAWK07 I can only do CodePen pairing at work, sorry! I can help if you need some, though. Or FreeCodeCamp/LetsPair might be looking.
Jing
@uow513
Aug 29 2015 00:22
@tmosoff
Yan Kozlovskiy
@YanKozlovskiy
Aug 29 2015 00:35
can someone tell me why this challenge isn't working?

$($('.slot')[0]).html('<img src = "' + images[slotOne - 1] + '">"');
    $($('.slot')[1]).html('<img src = "' + images[slotTwo - 1] + '">"');
    $($('.slot')[2]).html('<img src = "' + images[slotThree - 1] + '">"');
Tim
@timmcallister
Aug 29 2015 00:45
ok, the portfolio zipline, Is that only using Bootstrap and Jquery? Or was that built using more stuff that I don't know yet?
Cristián Berríos
@crisberrios
Aug 29 2015 00:46
some people started using Angular/React right away
but I think you don't need to use a library if it's not in the requirements
Tim
@timmcallister
Aug 29 2015 00:46
so really, as long as I hit the user stories, it's all good? If so, I've been going about these the wrong way
Lux3
@Lux3
Aug 29 2015 01:08
@JeremyWBean did you figure out FA already? I have it in my portfolio if you want to see
kyrull
@kyrull
Aug 29 2015 01:42

can someone tell me why this challenge isn't working?


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

@YanKozlovskiy not working too

Donavin Northrup
@dnorthrupva
Aug 29 2015 01:44
I'm trying to pull a number from an <input> field which has a default value of '25'. No matter what I put into the field, "('#work').val()" is returning 25. Anyone know how to fix?
DTing
@dting
Aug 29 2015 01:46
@kyrull remove the spaces, slotOne-1 etc
@kyrull copy paste the code from the left
Briana Swift
@brianamarie
Aug 29 2015 01:48
@timmcallister I don't understand your question...Matching the user stories is a minimum, but anything above and beyond is great :)
Nice quote generator by the way!
Cecilio Perez
@chilo15
Aug 29 2015 01:49
Use Conditional Logic with IfElse Statements

if ( 0 === true) {
"
return true;
}

else (1 ===false) {
return false;
}
}

I am not understanding the if else statement sequence
Donavin Northrup
@dnorthrupva
Aug 29 2015 01:50
Why does your Quote Generator look so familiar @timmcallister ....Maybe I've seen it before.
Wait, isn't this the example one?
Cecilio Perez
@chilo15
Aug 29 2015 01:51
I just ran it again with this

if ( 0 === true ) {

return true;
}

else {
return false;
}

I got two green but one is missing. it says my function should return heads or tails
Donavin Northrup
@dnorthrupva
Aug 29 2015 01:52
@chilo15 I don't see any of your important code, but it's wanting you to return a string of "heads" or a string of "tails"
What you posted is returning true and false.
Cecilio Perez
@chilo15
Aug 29 2015 01:54
Can someone explain to me what I am doing wrong?

function myFunction(){
var flip = Math.floor(Math.random() * (1 - 0 + 1)) + 0;
// Create an if-else statement here to return "heads" if flip is 0. Otherwise return "tails".

// Only change code below this line.

if ( 0 === true ) {

return true;
}

else {
return false;
}
}

// Only change code above this line.
// We use this function to show you the value of your variable in your output box.
(function(){return myFunction();})();

DTing
@dting
Aug 29 2015 01:54
@chilo15
// Create an if-else statement here to return "heads" if flip is 0. Otherwise return "tails".
Donavin Northrup
@dnorthrupva
Aug 29 2015 01:54
help format @chilo15
CamperBot
@camperbot
Aug 29 2015 01:54
no wiki entry for: format @chilo15
:pencil: click here to create one now!after creating your page type update to reload it here
Donavin Northrup
@dnorthrupva
Aug 29 2015 01:55
Rude
DTing
@dting
Aug 29 2015 01:55
if flip is 0, return "heads"; else return "tails";
Donavin Northrup
@dnorthrupva
Aug 29 2015 01:55
help format
CamperBot
@camperbot
Aug 29 2015 01:55

:point_right: code formatting [wiki]

Inline code

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

Code Block

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

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

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

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

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

jdubdigi
@jdubdigi
Aug 29 2015 01:59
@YanKozlovskiy Hi, I noticed the extra " after > in your code. Try this: $($('.slot')[0]).html('<img src = "' + images[slotOne-1] + '">');
$($('.slot')[1]).html('<img src = "' + images[slotTwo-1] + '">');
$($('.slot')[2]).html('<img src = "' + images[slotThree-1] + '">');
Cecilio Perez
@chilo15
Aug 29 2015 02:01

// Only change code below this line.

if ( 0 === true ) {

return true;
}

else {
return false;
}
}

I am not sure how to move forward from this
DTing
@dting
Aug 29 2015 02:06
@chilo15
// Create an if-else statement here to return "heads" if flip is 0. Otherwise return "tails".
if flip is 0, return "heads"; else return "tails";
if ( 0 === true ) { // change this to check if flip is equal to 0
return true; // return "heads";
}
else {
return false; // return "tails";
}
}
Tim
@timmcallister
Aug 29 2015 02:07
@dnorthrupva nope, not the example one. I thought we were supposed to make it look as similar as possible.
Donavin Northrup
@dnorthrupva
Aug 29 2015 02:08
@timmcallister Ahhh. I kind of did my 'portfolio' as an exact rip-off but I replaced all his pics/BGs/info with my own. The other ones I've gone completely free-style with.
Deepak Tapriyal
@deepaktapriyal
Aug 29 2015 02:10
blob
DTing
@dting
Aug 29 2015 02:10
@deepaktapriyal you're gonna have an extra space at the end
either manually remove that space, .trim() the result before returning, or store each word in an array with out a trailing space and .join(' ') that array to return
Deepak Tapriyal
@deepaktapriyal
Aug 29 2015 02:12
yes and it also have " at the end?
DTing
@dting
Aug 29 2015 02:13
?
Cecilio Perez
@chilo15
Aug 29 2015 02:14
@dting I dont understand what I am doing wrong
DTing
@dting
Aug 29 2015 02:15
// Only change code below this line.
if (flip === 0) {
  return "heads";
} else {
  return "tails";
}
Deepak Tapriyal
@deepaktapriyal
Aug 29 2015 02:17
i am getting : I'm A Little Tea Pot"....this quotaion mark at the end...
Cecilio Perez
@chilo15
Aug 29 2015 02:18
@dting Thank you !! I had both (return "true"; return"heads";)
CamperBot
@camperbot
Aug 29 2015 02:18
chilo15 sends brownie points to @dting :sparkles: :thumbsup: :sparkles:
:star: 793 | @dting | http://www.freecodecamp.com/dting
Cecilio Perez
@chilo15
Aug 29 2015 02:19
It worked @dting I was able to pass this level
DTing
@dting
Aug 29 2015 02:20
@deepaktapriyal paste your code instead of a screen shot
help formatting
CamperBot
@camperbot
Aug 29 2015 02:20

:point_right: code formatting [wiki]

Inline code

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

Code Block

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

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

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

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

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

Santina
@scroniser
Aug 29 2015 02:24
damn. did the exercises under "Basic Algorithm Scripting" go from 0-90, or is it just me?
I'm having a very tough time finishing up that section.
Glen Roberts
@ZeroAccess
Aug 29 2015 02:24
Ok, I verified my loop runs when the original array has the string false in it but it's not removing that particular entry. All other false entries get removed. I can't figure out why.
function bouncer(arr) {
  for(var i=0;i<arr.length;i++){ //for loop to loop over array
    var isFalse = new Boolean(arr[i]); //determine Boolean value
    if(isFalse == false) { //if false run loop
      arr.splice(i,1); //remove false entry
    }
  }
  return arr; //return arr array
}

bouncer([7, 'ate', '', false, 9]);
Deepak Tapriyal
@deepaktapriyal
Aug 29 2015 02:26
Thanks for the advise......
CamperBot
@camperbot
Aug 29 2015 02:26
if you want to thank someone, put an @ before their name!
Glen Roberts
@ZeroAccess
Aug 29 2015 02:27
if I do a console.log(isFalse) the "false" element comes out as false thus the if loop runs it's just not splicing that entry.
Deepak Tapriyal
@deepaktapriyal
Aug 29 2015 02:28
@dting ....Thanks for the advise and @camperbot you too.......new to this
CamperBot
@camperbot
Aug 29 2015 02:28
deepaktapriyal sends brownie points to @dting and @camperbot :sparkles: :thumbsup: :sparkles:
:star: 122 | @camperbot | http://www.freecodecamp.com/camperbot
:star: 794 | @dting | http://www.freecodecamp.com/dting
DTing
@dting
Aug 29 2015 02:30
This message was deleted
This message was deleted
This message was deleted
This message was deleted
This message was deleted
oh
actually
your problem is you are mutating the list
as you are iterating it
use filter rather than a for loop and arr.splice
Glen Roberts
@ZeroAccess
Aug 29 2015 02:33
Ok I'll read up on filter
thanks @dting
CamperBot
@camperbot
Aug 29 2015 02:33
zeroaccess sends brownie points to @dting :sparkles: :thumbsup: :sparkles:
:star: 795 | @dting | http://www.freecodecamp.com/dting
DTing
@dting
Aug 29 2015 02:35
basically what is happening is you arr.slice(i, 1) and remove an element from your array when i == 2, [7, 'ate', '', false, 9] becomes [7, 'ate', false, 9], you then increment i so i == 3, the problem is false is at index 2. you just skipped over that value because the length of your array changed .
Glen Roberts
@ZeroAccess
Aug 29 2015 02:38
OH
that makes sense
I'm just having a hard time figuring out this filter deal. I realize I need to make a function and pass the function into the filter method. Just creating this function is giving me a little bit of a problem. I'll keep working on it and if I need help luckily I have a place to ask.
Ben Heavner
@bheavner
Aug 29 2015 02:43

There's a subtlety here that seems important, that I'm not sure I understand quite... Why does this work:

arr.splice(0, howMany);
  return arr;

but this doesn't:

return arr.splice(0, howMany);

?
does the second one return the array before doing the splice?

(the first one returns the shorter array with the first N element removed; the second returns the elements removed from the array)
Donavin Northrup
@dnorthrupva
Aug 29 2015 02:45
What's the jQuery to replace HTML? AKA I need to rename a button from "A" to "B"
Logan Tegman
@ltegman
Aug 29 2015 02:47
@bheavner Which one works depends on what you’re wanting to return. splice alters the array in place and then returns the elements that were removed. So if you wants to return the removed elements you would use return arr.splice(0, howMany); but if you want to return the items left in the array after the splice then you have to
arr.splice(0, howMany);
  return arr;
@dnorthrupva If you want to replace the entire contents you can use JQuery.html
Cristián Berríos
@crisberrios
Aug 29 2015 02:53
@dnorthrupva api.jquery.com :)
Ben Heavner
@bheavner
Aug 29 2015 02:53
@ltegman thx - good to know its behaving as it should, though it's still a surprise as I'm learning.
CamperBot
@camperbot
Aug 29 2015 02:53
bheavner sends brownie points to @ltegman :sparkles: :thumbsup: :sparkles:
:star: 195 | @ltegman | http://www.freecodecamp.com/ltegman
DaforLynx
@DaforLynx
Aug 29 2015 02:57
What do I put in the parentheses of .pop()?
Rex Schrader
@SaintPeter
Aug 29 2015 02:57
@DaforLynx Nothing. Pop doesn't take any arguments.
Chandra Wijaya
@chandrawe
Aug 29 2015 02:58
Hey everyone. How do i get to use Array.filter()?
I read the documentation already but I can't seem to understand it.
DaforLynx
@DaforLynx
Aug 29 2015 02:58
hmmm...so myArray.pop(); should work, right?
nope
Cristián Berríos
@crisberrios
Aug 29 2015 02:59
@chandrawe what part you don't get?
Rex Schrader
@SaintPeter
Aug 29 2015 02:59
@DaforLynx You need to assign it to the variable they provide. JUST edit the line they provide, don't add your own line.
@chandrawe Do you know what a callback function is?
DaforLynx
@DaforLynx
Aug 29 2015 03:01
Thanks, it worked.
CamperBot
@camperbot
Aug 29 2015 03:01
if you want to thank someone, put an @ before their name!
Chandra Wijaya
@chandrawe
Aug 29 2015 03:01
@crisberrios I don't understand the arguments that I should put inside the filter functions.
@SaintPeter I don't. give me a sec. let me google it
DTing
@dting
Aug 29 2015 03:02

@chandrawe array.filter takes a call back function that is passed each element of the array that determines weather or not it should be included in the returned result

var result = arr.filter(<some function>);

if the function returns true, it will be include, if it returns false it will not.

var result = [1,2,3,4].filter(function(v) { return v > 2; });
console.log(result);
// [3, 4]
Rex Schrader
@SaintPeter
Aug 29 2015 03:03
@chandrawe Think of a callback function as being a function that you're passing that will be called on each element of the array you are filtering. You return a true or false result. Items for which your function returns true will be kept, and for false they will be discarded. Hence the "filter"
@chandrawe Also, what @dting said ;)
DTing
@dting
Aug 29 2015 03:04
thats like a simplified explanation but should be enough for our purposes.
Mohul Kaila
@mohulkaila88
Aug 29 2015 03:06
Hi everyone
Chandra Wijaya
@chandrawe
Aug 29 2015 03:06
@dting @SaintPeter Ahhh. That's pretty much easy to understand. Thanks a lot :smile: The thing is, I accidentally solved my bonfire 14 by using a dummy callback function for the filter. That's why it got me confused. lol
CamperBot
@camperbot
Aug 29 2015 03:06
chandrawe sends brownie points to @dting and @saintpeter :sparkles: :thumbsup: :sparkles:
:star: 395 | @saintpeter | http://www.freecodecamp.com/saintpeter
:star: 799 | @dting | http://www.freecodecamp.com/dting
Mohul Kaila
@mohulkaila88
Aug 29 2015 03:08
need help setting up dev environment locally for Javascript
Rex Schrader
@SaintPeter
Aug 29 2015 03:09
@mohulkaila88 Good news: All you need is a decent text editor (like Notepad++ for windows) and a web browser.
Mohul Kaila
@mohulkaila88
Aug 29 2015 03:10
@SaintPeter so, for working on my javascript Bonfires, I need to get the output on the html pages?
Rex Schrader
@SaintPeter
Aug 29 2015 03:10
@mohulkaila88 You can view an HTML file locally - just open it in the browser.
Mohul Kaila
@mohulkaila88
Aug 29 2015 03:10
@SaintPeter is there any IDE like eclipse I can use to get the output in the console?
Rex Schrader
@SaintPeter
Aug 29 2015 03:10
@mohulkaila88 All you need to do is setup the basic HTML document template
Mohul Kaila
@mohulkaila88
Aug 29 2015 03:10
ok
@SaintPeter ok, thank you! I'm doing it that way, just wanted to know if there is a faster way to do it.. :)
Rex Schrader
@SaintPeter
Aug 29 2015 03:11
@mohulkaila88 All modern browsers have dev tools built in - F12 usually pulls them up. Chrome's are maybe the nicest, but they're all decent.
@mohulkaila88 It's super fast. Trivial. You'll just need to build your HTML document and add links for things like jQuery or Bootstrap in the <head> section.
Mohul Kaila
@mohulkaila88
Aug 29 2015 03:12
@SaintPeter oh I forgot we can get the console output in the chrome dev tools
Rex Schrader
@SaintPeter
Aug 29 2015 03:12
@mohulkaila88 and in all browsers :D
@mohulkaila88 Gimme a sec and I'll DM you the template I used to make all my Ziplines
Mohul Kaila
@mohulkaila88
Aug 29 2015 03:13
@SaintPeter I see, thank you so much :)
CamperBot
@camperbot
Aug 29 2015 03:13
mohulkaila88 sends brownie points to @saintpeter :sparkles: :thumbsup: :sparkles:
:star: 396 | @saintpeter | http://www.freecodecamp.com/saintpeter
Glen Roberts
@ZeroAccess
Aug 29 2015 03:16
K, I think my last question on this one. So Filter cycles through everything so I realize I don't need a loop. My problem now is what do I pass into Boolean(). I thought this would work but it just gives me a weird object.
function bouncer(arr) {
  var invalidEntries=0;

  function determineTruth(){
    if(new Boolean() == true){
      console.log("true ran");
      return true;
    }else{
      console.log("false ran");
      invalidEntries++;
      return false;
    }
  }
  var arrResult = arr.filter(determineTruth);
  //console.log("The Array equals: " +arrResult + ". The number of invalid entries is " +    invalidEntries);
}
bouncer([7, 'ate', '', false, 9]);
When I say this I mean the keyword this as that's the object I'm passing in
Yan Kozlovskiy
@YanKozlovskiy
Aug 29 2015 03:27
i'd like a code hint because i don't understand why it's not storing the variable at the current iteration. i want it to store it to a variable and then return the variable at the end, but it's giving me the number that was inputted:

function factorialize(num) {

sta_number = num
dec_number = num - 1
dec_number--;
i = 1;

while(i < sta_number) {
    sta_number * dec_number;
    dec_number--;
    i++;
    result = sta_number;
}
}

console.log(result);
Glen Roberts
@ZeroAccess
Aug 29 2015 03:27
figured it out! ...thanks! Feel dumb I had to read over Filter again
CamperBot
@camperbot
Aug 29 2015 03:27
if you want to thank someone, put an @ before their name!
DTing
@dting
Aug 29 2015 03:28
@ZeroAccess nice
Glen Roberts
@ZeroAccess
Aug 29 2015 03:29
thanks @dting , yea just had to step back I appreciate your patience.
CamperBot
@camperbot
Aug 29 2015 03:29
zeroaccess sends brownie points to @dting :sparkles: :thumbsup: :sparkles:
:warning: zeroaccess already gave dting points
Yan Kozlovskiy
@YanKozlovskiy
Aug 29 2015 03:29
why isn't the sta number equal to 5 4 3 2 1(120)?
Glen Roberts
@ZeroAccess
Aug 29 2015 03:30
@YanKozlovskiy you need to to put ; on the first declarations
first two actually
Yan Kozlovskiy
@YanKozlovskiy
Aug 29 2015 03:31
oh........ why am i making these mistakes?!
DTing
@dting
Aug 29 2015 03:31
@YanKozlovskiy sta_number * dec_number;
Glen Roberts
@ZeroAccess
Aug 29 2015 03:31
@YanKozlovskiy because you're programming :D
DTing
@dting
Aug 29 2015 03:32
this line of code isnt doing anything
Yan Kozlovskiy
@YanKozlovskiy
Aug 29 2015 03:33
but i've reassigned num to sta_num (stable number) because that number isn't going to change kind of like a mini constant
Ryan Oliver
@oliverrs
Aug 29 2015 03:33
<script>
function repeat(str, num) {

if (num < 0) {
return '';
}

else {
return str.repeat(num);
}

};

repeat('abc', 3);

</script>
Glen Roberts
@ZeroAccess
Aug 29 2015 03:33
explain format
CamperBot
@camperbot
Aug 29 2015 03:33

:point_right: code formatting [wiki]

Inline code

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

Code Block

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

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

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

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

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

Glen Roberts
@ZeroAccess
Aug 29 2015 03:34
You're just doing sta*dec ...it's not assigned to anything
nellybrisket
@nellybrisket
Aug 29 2015 03:34
Help
CamperBot
@camperbot
Aug 29 2015 03:34

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

Glen Roberts
@ZeroAccess
Aug 29 2015 03:34
You're saying 2 * 2 = 4 but not using it anywhere
@nellybrisket I saw you posted code but what's going?
nellybrisket
@nellybrisket
Aug 29 2015 03:34

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

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

h {
font-family: Lobster;
}

p {
font-size: 16px;
font-family: Monospace;
}
</style>

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

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

Glen Roberts
@ZeroAccess
Aug 29 2015 03:35
@nellybrisket please check out the format it'll help everyone read your code
Ryan Oliver
@oliverrs
Aug 29 2015 03:35

'''function repeat(str, num) {

if (num < 0) {
return '';
}

else {
return str.repeat(num);
}

};

repeat('abc', 3);
'''

CamperBot
@camperbot
Aug 29 2015 03:35
:bulb: to format code use backticks! ``` more info
Glen Roberts
@ZeroAccess
Aug 29 2015 03:35
@oliverrs same to you, please format the code so it's easier to read
nellybrisket
@nellybrisket
Aug 29 2015 03:35
Thanks @ZeroAccess. I am trying to import the lobster font from google but it's not working
CamperBot
@camperbot
Aug 29 2015 03:35
nellybrisket sends brownie points to @zeroaccess :sparkles: :thumbsup: :sparkles:
:star: 190 | @zeroaccess | http://www.freecodecamp.com/zeroaccess
Glen Roberts
@ZeroAccess
Aug 29 2015 03:35
@nellybrisket ok gimme a second I did that one...hopefully can help you
Yan Kozlovskiy
@YanKozlovskiy
Aug 29 2015 03:35
but my logic (my own in my head which apparently isn't working) tells me that i reassigned the number and my while loop should have access to it
Ryan Oliver
@oliverrs
Aug 29 2015 03:35
tryinggg, it's only three back tics right? (''')
CamperBot
@camperbot
Aug 29 2015 03:35
:bulb: to format code use backticks! ``` more info
Yan Kozlovskiy
@YanKozlovskiy
Aug 29 2015 03:35
could you pleaes explain the flow of my program?
Glen Roberts
@ZeroAccess
Aug 29 2015 03:36
@nellybrisket you have h {} in your style can you change that to h2{} and tell me if it works.
@YanKozlovskiy you have like a=2 and b=2 right? so you're saying a * b = ? ...but you don't assign that ? anywhere
Ryan Oliver
@oliverrs
Aug 29 2015 03:37
function repeat(str, num) {

  if (num < 0) {
    return '';
  }

  else {
    return str.repeat(num);
  }

};

repeat('abc', 3);
Anybody know why this isn't working. Bonfire -- repeat a string.
DTing
@dting
Aug 29 2015 03:37
@oliverrs that looks like it should work
nellybrisket
@nellybrisket
Aug 29 2015 03:37
Well spotted @ZeroAccess. I am amazed at how helpful the community is here at FreeCodeCamp
Glen Roberts
@ZeroAccess
Aug 29 2015 03:38
@nellybrisket I'm just a nub like some of the others here. I ask so many questions that if one comes up I think I can answer I jump on it to help others who helped me.
I just hope I help instead of making it worse lol
DTing
@dting
Aug 29 2015 03:38
try reloading the browser
ya it works @oliverrs
try reloading your browser or trying a different one
Glen Roberts
@ZeroAccess
Aug 29 2015 03:38
@oliverrs Another thing you can do is copy that and paste it into notepad then reset the page and then paste that back. May help
I had to do that on a few
nellybrisket
@nellybrisket
Aug 29 2015 03:39
@ZeroAccess You most certainly are not making it worse. I was going to give up and go to bed. Now I am going to keep plowing through. Thanks again.
CamperBot
@camperbot
Aug 29 2015 03:39
nellybrisket sends brownie points to @zeroaccess :sparkles: :thumbsup: :sparkles:
:warning: nellybrisket already gave zeroaccess points
Ryan Oliver
@oliverrs
Aug 29 2015 03:39
undefined is not a function (evaluating 'str.repeat(num)')
Glen Roberts
@ZeroAccess
Aug 29 2015 03:39
@nellybrisket w00t, I'm here till midnight then it's off work and to the store for a 6pack I feel like I deserve :D
DTing
@dting
Aug 29 2015 03:40
works for me on chrome
nellybrisket
@nellybrisket
Aug 29 2015 03:40
@ZeroAccess 6pack is well deserved. I could do with a glass of wine. Just curious what time zone are you?
Glen Roberts
@ZeroAccess
Aug 29 2015 03:40
@nellybrisket EST I work 3pm to Midnight. I'm on a diet and if I get wine I'm drinking the bottle lol
nellybrisket
@nellybrisket
Aug 29 2015 03:42
@ZeroAccess Only 20 minutes to go then. It's 8:40 p.m. here in PST. Good luck with the diet.
Glen Roberts
@ZeroAccess
Aug 29 2015 03:42
Thanks! , yea I'm debating on trying to knock out the next bonfire
CamperBot
@camperbot
Aug 29 2015 03:42
if you want to thank someone, put an @ before their name!
Glen Roberts
@ZeroAccess
Aug 29 2015 03:44
bf details
CamperBot
@camperbot
Aug 29 2015 03:44

:fire:Bonfire: Chunky Monkey :link:

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

chunk(['a', 'b', 'c', 'd'], 2);
Write a function that splits an array (first argument) into groups the length of size (second argument) and returns them as a multidimensional array.
Remember to use RSAP if you get stuck. Try to pair program. Write your own code.
links:
Glen Roberts
@ZeroAccess
Aug 29 2015 03:44
help @camperbot
CamperBot
@camperbot
Aug 29 2015 03:44
no wiki entry for: @camperbot
:pencil: click here to create one now!after creating your page type update to reload it here
Glen Roberts
@ZeroAccess
Aug 29 2015 03:44
Bonfire: Where art thou
bf details
CamperBot
@camperbot
Aug 29 2015 03:44
Sorry, can't find a bonfire called where art thoubf details. [ Check the map? ]
Yan Kozlovskiy
@YanKozlovskiy
Aug 29 2015 03:44
@ZeroAccess what is the proper way of assigning that?
Glen Roberts
@ZeroAccess
Aug 29 2015 03:45
Sorry, don't mean to be spamming the chat trying to figure out what exactly that want for this bonfire.
@YanKozlovskiy something like calcResult = a * b;
then your answer is "calcResult"
DJ
@qualitymanifest
Aug 29 2015 03:45
@ZeroAccess you need to wait until it responds to each one
bf where art thou
CamperBot
@camperbot
Aug 29 2015 03:45

:fire:Bonfire: Where art thou :link:

function where(collection, source) {
  var arr = [];
  // What's in a name?
  return arr;
}

where([{ first: 'Romeo', last: 'Montague' }, { first: 'Mercutio', last: null }, { first: 'Tybalt', last: 'Capulet' }], { last: 'Capulet' });

Make a function that looks through a list (first argument) and returns an array of all objects that have equivalent property values (second argument).

more info:  bf details | bf links | hint

DJ
@qualitymanifest
Aug 29 2015 03:45
bf details
CamperBot
@camperbot
Aug 29 2015 03:45

:fire:Bonfire: Where art thou :link:

function where(collection, source) {
  var arr = [];
  // What's in a name?
  return arr;
}

where([{ first: 'Romeo', last: 'Montague' }, { first: 'Mercutio', last: null }, { first: 'Tybalt', last: 'Capulet' }], { last: 'Capulet' });
Make a function that looks through a list (first argument) and returns an array of all objects that have equivalent property values (second argument).
Remember to use RSAP if you get stuck. Try to pair program. Write your own code.
links:
Glen Roberts
@ZeroAccess
Aug 29 2015 03:45
@qualitymanifest good deal
bf hint
CamperBot
@camperbot
Aug 29 2015 03:45
:construction: Spoilers are only in the Bonfire's Custom Room :point_right:
Glen Roberts
@ZeroAccess
Aug 29 2015 03:49
Yep feeling extra dumb. I don't even understand what it's asking for lol. That means I'll tackle it another day.
Will Seymour
@wseymour
Aug 29 2015 04:26
bf check for palindromes
CamperBot
@camperbot
Aug 29 2015 04:26

:fire:Bonfire: Check for Palindromes :link:

function palindrome(str) {
  // Good luck!
  return true;
}



palindrome("eye");

Return true if the given string is a palindrome. Otherwise, return false.

more info:  bf details | bf links | hint

Will Seymour
@wseymour
Aug 29 2015 04:26
bf hint
CamperBot
@camperbot
Aug 29 2015 04:26
:construction: Spoilers are only in the Bonfire's Custom Room :point_right:
nellybrisket
@nellybrisket
Aug 29 2015 04:43
Quick question to the CodeCampers up late night
In HTML, why does the input element not have any closing tags?
e.g. <input type="text" placeholder="cat photo URL">
Rex Schrader
@SaintPeter
Aug 29 2015 04:45
@nellybrisket Some elements have them, some do not. For example, the <img> tag does not either. I guess my question to you would be: "what do you think would go in between those tags if it had them?"
nellybrisket
@nellybrisket
Aug 29 2015 04:47
@SaintPeter You raise an interesting point. I guess elements that don
@SaintPeter don't have any "words" in them don't need closing tags
@SaintPeter However "a" element does not have any "words" per se but still has closing tags <a href="#"></a>
Abi Tyas Tunggal
@AbiTyasTunggal
Aug 29 2015 04:48
Hey guys
Rex Schrader
@SaintPeter
Aug 29 2015 04:48
@nellybrisket I guess I'd think of it more like items without closing tags are those that do not contain something - they're for display and are not structural. For example, the <hr> tag is a horzontal rule (a line)
Abi Tyas Tunggal
@AbiTyasTunggal
Aug 29 2015 04:49
Just wondering why this code doesn't work
but this does

function factorialize(num) {
var tmp = num;
while (num > 2) {
tmp *= num;
}
return tmp;
}

factorialize(5);

Doesn't work

function factorialize(num) {
var tmp = num;
while (num-- > 2) {
tmp *= num;
}
return tmp;
}

factorialize(5);

does work
Luis Felipe López G.
@luishendrix92
Aug 29 2015 04:49
This message was deleted
Why num--?
Abi Tyas Tunggal
@AbiTyasTunggal
Aug 29 2015 04:50
That's what I'm asking
It's very strange
without -- it runs infinite loop
Rex Schrader
@SaintPeter
Aug 29 2015 04:50
@AbiTyasTunggal Well, if I'm reading it properly, the bottom one has a num--, which decrements num. You have to change num
Luis Felipe López G.
@luishendrix92
Aug 29 2015 04:50
num-- is a substraction, it will NEVER reach 2
Rex Schrader
@SaintPeter
Aug 29 2015 04:50
@AbiTyasTunggal num-- is the same as saying num = num - 1
Abi Tyas Tunggal
@AbiTyasTunggal
Aug 29 2015 04:51
but it works?
Whereas first solution just loops forever
Luis Felipe López G.
@luishendrix92
Aug 29 2015 04:51
If I keep going to the past and I wanted to go 2 years in the future, I will forever go into the past and never 2 years in the future. That's infinitely wrong.
nellybrisket
@nellybrisket
Aug 29 2015 04:51
@SaintPeter Good rule of thumb. Structural = no closing tags. Display = closing tags
Rex Schrader
@SaintPeter
Aug 29 2015 04:51
@AbiTyasTunggal Basically, you're starting at num = 5, right - in the first solution num NEVER CHANGES. But in the second, it's decremented each loop as it is compared to 2.
@nellybrisket vice versa
Abi Tyas Tunggal
@AbiTyasTunggal
Aug 29 2015 04:52
Ah!
So in the second solution it keeps decreasing num until it is =2?
Luis Felipe López G.
@luishendrix92
Aug 29 2015 04:52
Alright, num is greater than 2, but in the first solution num never changes
Rex Schrader
@SaintPeter
Aug 29 2015 04:53
@AbiTyasTunggal Something like that.
Abi Tyas Tunggal
@AbiTyasTunggal
Aug 29 2015 04:53
Whereas first it just stays at whatever num is forever
Rex Schrader
@SaintPeter
Aug 29 2015 04:53
@AbiTyasTunggal yup
Abi Tyas Tunggal
@AbiTyasTunggal
Aug 29 2015 04:53
I think I get it, thanks guys :)
CamperBot
@camperbot
Aug 29 2015 04:53
if you want to thank someone, put an @ before their name!
Luis Felipe López G.
@luishendrix92
Aug 29 2015 04:53
@AbiTyasTunggal The second solution ehh, what if num was 2 or 1?
Rex Schrader
@SaintPeter
Aug 29 2015 04:53
BTW, @AbiTyasTunggal, here is how to post formatted code:
Luis Felipe López G.
@luishendrix92
Aug 29 2015 04:53
Infinite loop I presume
Rex Schrader
@SaintPeter
Aug 29 2015 04:53
wiki format
CamperBot
@camperbot
Aug 29 2015 04:53

:point_right: code formatting [wiki]

Inline code

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

Code Block

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

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

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

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

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

Abi Tyas Tunggal
@AbiTyasTunggal
Aug 29 2015 04:53
I'll test @luishendrix92
Need to add that in
Thanks for format @SaintPeter
CamperBot
@camperbot
Aug 29 2015 04:54
abityastunggal sends brownie points to @saintpeter :sparkles: :thumbsup: :sparkles:
:star: 402 | @saintpeter | http://www.freecodecamp.com/saintpeter
Abi Tyas Tunggal
@AbiTyasTunggal
Aug 29 2015 04:57
This message was deleted
This message was deleted
This message was deleted
function factorialize(num) {
  if (num == 1){
    return 1;
  }
  else if (num <= 0){
    return 'Invalid';
  }
  var tmp = num;
  while (num-- >= 2) {
    tmp *= num;
  }
  return tmp;
}

factorialize(0);
That’d be a better solution, yeah?
Nnxoxo
@Nnxoxo
Aug 29 2015 05:03
@AbiTyasTunggal
function factorialize(num) {
  var fact = 1;
  if (num > 1) {
    for(var i = 1; i <= num; i++) {
      fact *= i;
    }
    return fact;
  }
  return 1;
}

factorialize(5);
John T. Bull
@jbull328
Aug 29 2015 05:04
I got a quick question for you guys..... how do you host images in your codepen projects. I've tried onedrive and image shack one drive gives you an iframe, I can't seem to get it to work...
Rex Schrader
@SaintPeter
Aug 29 2015 05:04
@jbull328 You can put them in GitHub, or Imgur
Abi Tyas Tunggal
@AbiTyasTunggal
Aug 29 2015 05:04
Thanks @Nnutthowze I’ll check your solution and try to understand it :)
CamperBot
@camperbot
Aug 29 2015 05:04
abityastunggal sends brownie points to @nnutthowze :sparkles: :thumbsup: :sparkles:
:star: 297 | @nnutthowze | http://www.freecodecamp.com/nnutthowze
John T. Bull
@jbull328
Aug 29 2015 05:05
thanks @SaintPeter I had yet to try those...
CamperBot
@camperbot
Aug 29 2015 05:05
jbull328 sends brownie points to @saintpeter :sparkles: :thumbsup: :sparkles:
:star: 404 | @saintpeter | http://www.freecodecamp.com/saintpeter
irobot12729
@irobot12729
Aug 29 2015 05:08
can anyone tell me why this code is throwing up the error: Cannot read property length of undefined?
Nnxoxo
@Nnxoxo
Aug 29 2015 05:08
@irobot12729 show the code
irobot12729
@irobot12729
Aug 29 2015 05:08

function findLongestWord(str) {
str = str.split(' ');
var ret = str.length;
var retNum = 0;
for(var i=0; i<=ret;i++){

if(str[i].length > retNum){
  retNum = str[i].length;
}

}
return retNum;
}

Rex Schrader
@SaintPeter
Aug 29 2015 05:08
@irobot12729 Because you've got a variable that you think is an array, but which is actually not anything at all
@irobot12729 Remember that arrays are zero indexed. Now look at this code:
i <=ret
Nnxoxo
@Nnxoxo
Aug 29 2015 05:09
@AbiTyasTunggal u have a nice solution
Rex Schrader
@SaintPeter
Aug 29 2015 05:09
@irobot12729 When i = str.length, i will be out of bounds on str
@irobot12729 it will be past the end.
irobot12729
@irobot12729
Aug 29 2015 05:09
Oh, got it. Thanks!
CamperBot
@camperbot
Aug 29 2015 05:09
if you want to thank someone, put an @ before their name!
irobot12729
@irobot12729
Aug 29 2015 05:10
@SaintPeter
thanks @SaintPeter
CamperBot
@camperbot
Aug 29 2015 05:10
irobot12729 sends brownie points to @saintpeter :sparkles: :thumbsup: :sparkles:
:star: 405 | @saintpeter | http://www.freecodecamp.com/saintpeter
justindobbs
@justindobbs
Aug 29 2015 05:19
music
CamperBot
@camperbot
Aug 29 2015 05:19
Abi Tyas Tunggal
@AbiTyasTunggal
Aug 29 2015 05:21
function palindrome(str) {
  // Good luck!
  var test = str.toLowerCase();
  var newString = test.split('').reverse().join('');
  if (newString == test) {
    return true;
  }
  else {
    return false;
  }
}



palindrome("eye");
How come that doesn’t work?
It works for eye I’m pretty sure
Steven Parker
@Philosophist
Aug 29 2015 05:23
Hello help room! Long time no see.
symmetric Difference 1.png
Rex Schrader
@SaintPeter
Aug 29 2015 05:25
@Philosophist The help room as missed you, too.
Here is how to post your code
wiki format
CamperBot
@camperbot
Aug 29 2015 05:25

:point_right: code formatting [wiki]

Inline code

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

Code Block

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

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

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

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

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

Steven Parker
@Philosophist
Aug 29 2015 05:25
Aren't the little red warning x's supposed to tell me where this ')' is? Is this abug I should report that I'm not getting those little warning signs anymore?
Will Seymour
@wseymour
Aug 29 2015 05:25
@AbiTyasTunggal I'm working on that one, too. I haven't worked it out yet, but I do notice in yours you haven't stripped out the punctuation
Rex Schrader
@SaintPeter
Aug 29 2015 05:26
@Philosophist The big red 'x' is currently telling you that you have broken your code beyond it's ability to determine/fix
Abi Tyas Tunggal
@AbiTyasTunggal
Aug 29 2015 05:26
How you strip punctionation @wseymour
I figured out how to remove the space
Steven Parker
@Philosophist
Aug 29 2015 05:27
@SaintPeter Ok, but I haven't been getting any little warning x's lately.
Rex Schrader
@SaintPeter
Aug 29 2015 05:27
@AbiTyasTunggal Regular Expressions are you friends: http://regex101.com to help develop one that does what you like.
@Philosophist They've been a bit off and on for me.
Will Seymour
@wseymour
Aug 29 2015 05:28
@AbiTyasTunggal As I say I'm still working on getting it right, but the key is to use the String.replace() function
Rex Schrader
@SaintPeter
Aug 29 2015 05:28
@Philosophist BTW, you should recognize that your code has 4 basically identical statements - you ought to be able to find a way to put those into a seperate function.
Steven Parker
@Philosophist
Aug 29 2015 05:28
symmetric Difference 2.png
Will Seymour
@wseymour
Aug 29 2015 05:29
@SaintPeter Thanks a lot for that link
CamperBot
@camperbot
Aug 29 2015 05:29
wseymour sends brownie points to @saintpeter :sparkles: :thumbsup: :sparkles:
:star: 407 | @saintpeter | http://www.freecodecamp.com/saintpeter
Rex Schrader
@SaintPeter
Aug 29 2015 05:29
@wseymour NP - it's a great site.
Steven Parker
@Philosophist
Aug 29 2015 05:30
@SaintPeter Thanks. I guess that could clean it up a bit
CamperBot
@camperbot
Aug 29 2015 05:30
philosophist sends brownie points to @saintpeter :sparkles: :thumbsup: :sparkles:
:star: 408 | @saintpeter | http://www.freecodecamp.com/saintpeter
Abi Tyas Tunggal
@AbiTyasTunggal
Aug 29 2015 05:30
Did it! Thanks @wseymour & @SaintPeter
CamperBot
@camperbot
Aug 29 2015 05:30
abityastunggal sends brownie points to @wseymour and @saintpeter :sparkles: :thumbsup: :sparkles:
:warning: abityastunggal already gave saintpeter points
:star: 162 | @wseymour | http://www.freecodecamp.com/wseymour
Abi Tyas Tunggal
@AbiTyasTunggal
Aug 29 2015 05:32
Oh wait, one result left :)
Will Seymour
@wseymour
Aug 29 2015 05:34
I got it!!!! I've been trying to get that syntax just right for hours, off and on
Abi Tyas Tunggal
@AbiTyasTunggal
Aug 29 2015 05:34
Compare answers @wseymour ?
I want to see if I can improve my code
Steven Parker
@Philosophist
Aug 29 2015 05:55
@SaintPeter Thanks again, cleaning it up happened to fix it, though I'm not sure why. Is there a logically determined general rule for the minimum number of uses or size of something before there should be a new function made for it?
CamperBot
@camperbot
Aug 29 2015 05:55
philosophist sends brownie points to @saintpeter :sparkles: :thumbsup: :sparkles:
:warning: philosophist already gave saintpeter points
Rex Schrader
@SaintPeter
Aug 29 2015 05:57
@Philosophist It's mostly just about compactness and cleanness. Imagine for a moment that instead of 3 arrays there were 20? Would you copy your code 20 times? Probably not. Try to solve to the general case, rather than to the specific case.
ronald
@ronstarcool
Aug 29 2015 06:01
who's in for: Bonfire: Symmetric Difference
@SaintPeter coach, can give me a hand? :) on Bonfire: Symmetric Difference
open up the gates for me
Alan Bares
@alanbares
Aug 29 2015 06:02
So is it normal being lost on starting bonfires? Cuz I blank out every time. For 2-5 in basic algorithm scripting I ended up just googling for the answer. And as a last resort I look through here lol. Rather than just moving on, I break down the code and try and figure out what everything is doing before moving onto the next bonfire.
ronald
@ronstarcool
Aug 29 2015 06:02
its normal beiing lost in every bf..
Rex Schrader
@SaintPeter
Aug 29 2015 06:04
@ronstarcool Did you watch the video?
Alan Bares
@alanbares
Aug 29 2015 06:04
ok so I'm not crazy haha
MD Arefin Saad
@arefinsaaad
Aug 29 2015 06:04
hlw //.... everyone
@alanbares Also: You might want to take care about how often you google for the answer. It can take dicipline to hammer on a problem for a day, but the reward is understanding.
@alanbares Also . . you might be crazy ;) Look at where you are!
ronald
@ronstarcool
Aug 29 2015 06:06
i did not..
i will!
Steven Parker
@Philosophist
Aug 29 2015 06:06
@SaintPeter Oh, I had accounted for that. The last two iterations of that process are in a loop to check each remaining argument. the first 2 were to start the arguments[0] and arguments[1] comparisons and put the result in arr, then test arr against each remaining argument.... but in retrospect I guess that wouldn't have fundamentally done the job either.
ronald
@ronstarcool
Aug 29 2015 06:06
i thought they were never information-wise
Alan Bares
@alanbares
Aug 29 2015 06:08
@SaintPeter Yeah some bonfires it takes me a day or 2 to figure out the right way to google until I find what I'm looking for. Then after I'm like ooo now I understand how the function works after looking at each part of the code and seeing how they all connect. But yeah some days I feel like a complete idiot for not being able to type out my own code without looking at a solution :worried:.
Rex Schrader
@SaintPeter
Aug 29 2015 06:11
@alanbares No doubt, it can be rough at times. You can feel totally lost. But that's pretty normal. I think the real value can be in trying to nail down what you don't know so you can ask a question about it. Don't see asking for help as a bad thing - it means you've gotten to a point where you are able to articulate what you don't know.
@alanbares "A wise man knows that he knows nothing" ;)
Alan Bares
@alanbares
Aug 29 2015 06:14
@SaintPeter thanks for advice and help!. Yeah I'm just stubborn sometimes since I like to try and figure out the the answer on my own. Then if I get hopelessly stuck or lost I finally decide ok time to ask for help lol.
CamperBot
@camperbot
Aug 29 2015 06:14
alanbares sends brownie points to @saintpeter :sparkles: :thumbsup: :sparkles:
:star: 409 | @saintpeter | http://www.freecodecamp.com/saintpeter
Abi Tyas Tunggal
@AbiTyasTunggal
Aug 29 2015 06:15
Hey @SaintPeter, how long do you suggest we struggle on a bf before asking for help
ronald
@ronstarcool
Aug 29 2015 06:15
@SaintPeter what video??
oh was confused with zips...i thought you meant that video
this is a bf. reduce and filter
Rex Schrader
@SaintPeter
Aug 29 2015 06:16
@AbiTyasTunggal Well, that's a bit of a personal preference, but I would say this: work the problem until you have a clear difference between what you think should be happening and what is actually happening and you can clearly describe it enough to ask a question about it. IE: I expect X, but I get Y, here is my code
Steven Parker
@Philosophist
Aug 29 2015 06:16
@SaintPeter Final product:
      if(arr2.indexOf(arr1[i]) === -1) {
        newArr.push(arr1[i]);
      }
    }
    for(var i = 0; i < arr2.length; i++) {
      if(arr1.indexOf(arr2[i]) === -1) {
        newArr.push(arr2[i]);
      }
    }
    return newArr;
  }
  var arr = [];
  if(arguments.length === 1){
    for(var i = 0; i < arguments[0].length; i++) {
      while(arguments[0].lastIndexOf(arguments[0][i]) !== i) {
        arguments[0].splice(arguments[0].lastIndexOf(arguments[0][i]), 1)
      }
    }
    return arguments[0];
  }
  arr = chk(arguments[0], arguments[1]);
  for(var i = 2; i < arguments.length; i++) {
    arr = chk(arr, arguments[i])
  }
  for(var i = 0; i < arr.length; i++) {
    while(arr.lastIndexOf(arr[i]) !== i) {
      arr.splice(arr.lastIndexOf(arr[i]), 1)
    }
  }
  return arr;
}

sym([1, 1, 2, 5], [2, 2, 3, 5], [3, 4, 5, 5]);
ronald
@ronstarcool
Aug 29 2015 06:27
whats that? thats not needed right?
thats the spagetti-version?
Craig McKenna
@craigdmckenna
Aug 29 2015 06:46
I am working on the Weater App Zipline and I have been looking into HTML 5 Geolocation API vs IP Geolocation. It seems that HTML 5 Geolocation API has limited support from browsers and that IP Geolocation is less intrusive. Which method should I use and why? Which will be a more valuable skill to have?
Rex Schrader
@SaintPeter
Aug 29 2015 06:48
@CraigMcKenna "Limited Support" is not THAT limited. For the purposes of these exercises you can assume that people have a modern browser.
@CraigMcKenna If you view "Relative USage" you'll see that the vast majority of web users have a compatible browser.
Craig McKenna
@craigdmckenna
Aug 29 2015 06:50
@SaintPeter Thank you!!!!!
CamperBot
@camperbot
Aug 29 2015 06:50
craigmckenna sends brownie points to @saintpeter :sparkles: :thumbsup: :sparkles:
:star: 412 | @saintpeter | http://www.freecodecamp.com/saintpeter
Mistereo
@Mistereo
Aug 29 2015 06:52
@CraigMcKenna you can use Geolocation API if possible and fallback to IP Geolocation if not :)
Rex Schrader
@SaintPeter
Aug 29 2015 06:52
@CraigMcKenna Huh, in the US it looks like 95.8% can support that feature. I'm wondering who uses Opera Mini anywhere. Man, I loves me some data.
Isaac Calvo
@Icalvo1
Aug 29 2015 06:54
hello everyone
Mistereo
@Mistereo
Aug 29 2015 06:55
@SaintPeter also user can deny access to geolocation, so it's good to have a fallback in this case too :)
Craig McKenna
@craigdmckenna
Aug 29 2015 06:55
Good point @Mistereo
Rex Schrader
@SaintPeter
Aug 29 2015 06:56
@Mistereo True - Personally I used an IP lookup, but it's six of one, half dozen of another. It was pretty amusing to have it show me about 2000 miles away based on my IP
Isaac Calvo
@Icalvo1
Aug 29 2015 06:56
http://freecodecamp.com/challenges/bonfire-truncate-a-string <-- can't get this one to pass.
function truncate(str, num) {
  if(str.length > num){
  num_v = parseInt( num - 3);  
  str = str.slice(0, num_v);
  return str + "...";;
}else if(str.length < num || str.length != num){
  console.log('truncate fail');
}else{
  console.log('truncate fail');
}

}

truncate('A-tisket a-tasket A green and yellow basket', 11);
passes all 4 conditions in mdn console
tavira
@tavira
Aug 29 2015 06:57
This message was deleted
DTing
@dting
Aug 29 2015 06:57
@Icalvo1 you should return the original string if the str.length is not > num
Craig McKenna
@craigdmckenna
Aug 29 2015 06:57
I think its a use case question.
someone wanting to see the weather is more likely to allow geolocation than someone who is being served advertising. @SaintPeter @Mistereo
tavira
@tavira
Aug 29 2015 06:57
This message was deleted
DTing
@dting
Aug 29 2015 06:59
@Icalvo1 also you can assume the num is a number
  str = str.slice(0, num -3);
@CraigMcKenna thats a good point but some people have navigator.geolocation off by default.
Craig McKenna
@craigdmckenna
Aug 29 2015 07:01
Sounds like I may be using both!
DTing
@dting
Aug 29 2015 07:01
fall back to an ip geolocation is nice but not really needed for a demo. depends on how polished you want the final app to be.
tavira
@tavira
Aug 29 2015 07:02

Hi! I'm working on the Basic JS Waypoint 40 "Give your JavaScript Slot Machine some stylish images"
I wrote the following code, but the system

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

However, this condition is not fulfilled

Use the provided code three times. One for each slot
These conditions are satisfied
You should have used the slotOne value at least once
You should have used the slotTwo value at least once
You should have used the slotThree value at least once

What am i doing wrong?

DTing
@dting
Aug 29 2015 07:02
@tavira remove the spaces
images[slotThree - 1]
Craig McKenna
@craigdmckenna
Aug 29 2015 07:02
@dting I'm anal retentive like that sometimes
DTing
@dting
Aug 29 2015 07:02
the regex doesnt pick up the answer as correct if you include those spaces.
Robert
@rc242
Aug 29 2015 07:03
mmm, peppermint tea.
Yan Kozlovskiy
@YanKozlovskiy
Aug 29 2015 07:03
anyone else feel like their brain is going to explode?
Mistereo
@Mistereo
Aug 29 2015 07:04
@CraigMcKenna I actually use both, IP Lookup with upgrade to Geolocation API, so on page load I can use IP Lookup and show the weather without delay, and then if user allows me to use Geolocation, I update this data.
Isaac Calvo
@Icalvo1
Aug 29 2015 07:04
thanks @dting ftw yet again, returning the original str was the problem when truncating is supposed to fail. I guess they need to add that bit in there. I assumed 'should not truncate...' meant do nothing/anthything but truncate
CamperBot
@camperbot
Aug 29 2015 07:04
icalvo1 sends brownie points to @dting :sparkles: :thumbsup: :sparkles:
:star: 800 | @dting | http://www.freecodecamp.com/dting
Craig McKenna
@craigdmckenna
Aug 29 2015 07:05
@Mistereo Thanks!!!!
CamperBot
@camperbot
Aug 29 2015 07:05
craigmckenna sends brownie points to @mistereo :sparkles: :thumbsup: :sparkles:
tavira
@tavira
Aug 29 2015 07:05
@dting Oh, many thanks, I understood. My code must be exactly the same as code in the example
CamperBot
@camperbot
Aug 29 2015 07:05
:star: 267 | @mistereo | http://www.freecodecamp.com/mistereo
tavira sends brownie points to @dting :sparkles: :thumbsup: :sparkles:
:star: 801 | @dting | http://www.freecodecamp.com/dting
Tersha
@tersha
Aug 29 2015 07:06
Hi Everyone! Looking for help on Bonfire 4 palindromes. My code works for all except the last case.
Robert
@rc242
Aug 29 2015 07:07
@tersha What do you have so far?
Samuel Plumppu
@Greenheart
Aug 29 2015 07:07
Bonfire palindrome
CamperBot
@camperbot
Aug 29 2015 07:07

:fire:Bonfire: Check for Palindromes :link:

function palindrome(str) {
  // Good luck!
  return true;
}



palindrome("eye");

Return true if the given string is a palindrome. Otherwise, return false.

more info:  bf details | bf links | hint

Jesse Croxford
@Jcroxford
Aug 29 2015 07:08
can someone please explain javascript array filters? stuck on bonfire 14
@Greenheart what are you stuck on?
Samuel Plumppu
@Greenheart
Aug 29 2015 07:08
@tersha whats The last test case?
Jesse Croxford
@Jcroxford
Aug 29 2015 07:08
can you post your code?
Samuel Plumppu
@Greenheart
Aug 29 2015 07:09
I'm just here to help :)
@AuricSlayer array.filter() takes a function as an argument
Tersha
@tersha
Aug 29 2015 07:09

@rc242

function palindrome(str) {
  // Good luck!
  var newstr = str.replace(/(\W+)/,"").toLowerCase();
  console.log(newstr);
  var n = newstr.length;
  for(var i = 0; i < ((n/2)+1); i++) {
    if(newstr.charAt(i) != newstr.charAt(n-i-1)) {
      return false;
    }else {
      return true;
    }
  }

}

@Greenheart The last case is "almostomla"

CamperBot
@camperbot
Aug 29 2015 07:09
:bulb: to format code use backticks! ``` more info
Samuel Plumppu
@Greenheart
Aug 29 2015 07:10
And that function will then be executed on each item in the array
Tersha
@tersha
Aug 29 2015 07:10
Hmm looks like I didn't use the markup right ... very new to this chat room ...
Jesse Croxford
@Jcroxford
Aug 29 2015 07:10
so your basically just supposed to write a function inside filter to check for different things?
Samuel Plumppu
@Greenheart
Aug 29 2015 07:10
To test if the item should stay or not
Jesse Croxford
@Jcroxford
Aug 29 2015 07:11
ok that should be inside the filter right?
just making sure
Samuel Plumppu
@Greenheart
Aug 29 2015 07:11
So you use it like this: arr.filter(someFuncThatShouldReturnTrueForItemsToKeepAndFalseForItemsToRemove)
Robert
@rc242
Aug 29 2015 07:12
@tersha looks like you have the "not equal" correct, but there's a problem if the first character is equal.
Samuel Plumppu
@Greenheart
Aug 29 2015 07:12
@AuricSlayer
Jesse Croxford
@Jcroxford
Aug 29 2015 07:12
ah ok thanks @Greenheart
CamperBot
@camperbot
Aug 29 2015 07:12
auricslayer sends brownie points to @greenheart :sparkles: :thumbsup: :sparkles:
:star: 295 | @greenheart | http://www.freecodecamp.com/greenheart
Samuel Plumppu
@Greenheart
Aug 29 2015 07:12
MDN got a great example on how to use filter
Mozilla developer networks - array filter
Check it out for details :)
And hope it helped!
Jesse Croxford
@Jcroxford
Aug 29 2015 07:13
do you just sit in here and help people in your free time?
Samuel Plumppu
@Greenheart
Aug 29 2015 07:14
Haha yeah :)
This is much more fun than Facebook or snapchat
Jesse Croxford
@Jcroxford
Aug 29 2015 07:15
thats awesome! kudos man maybe I will do that when I understand everything better xD
I agree I get bored with social network stuff
Samuel Plumppu
@Greenheart
Aug 29 2015 07:15
And you get the chance to help people too
You don't have to be good
Sometimes it's just enough to ask questions
Robert
@rc242
Aug 29 2015 07:16
@tersha Do you see the problem with your if / else block?
Samuel Plumppu
@Greenheart
Aug 29 2015 07:16
Like; hey why do you do like this?
And people might just solve the issues themselves :)
Jesse Croxford
@Jcroxford
Aug 29 2015 07:16
yeah maybe ill start hanging out here more often
maybe it will help keep me more productive anyways as apposed to netflix haha
Samuel Plumppu
@Greenheart
Aug 29 2015 07:17
And sometimes it's just about having someone that can guide them through the different steps in problem solving
But the No. 1 reason to hanging here is to learn stuff myself
Because I believe the best way to learn is to try and explain things to others
Jesse Croxford
@Jcroxford
Aug 29 2015 07:18
me to
Samuel Plumppu
@Greenheart
Aug 29 2015 07:18
Then you trick yourself that you know concepts that you really dont
In order to convince others ;)
Jesse Croxford
@Jcroxford
Aug 29 2015 07:19
hahaha and by doing so, sometimes learn them =P
Samuel Plumppu
@Greenheart
Aug 29 2015 07:19
And when you've done that several times, you'll learn it for real
Jesse Croxford
@Jcroxford
Aug 29 2015 07:19
right
Samuel Plumppu
@Greenheart
Aug 29 2015 07:19
Exactly :)
@tersha did you solve your problem? :)
Tersha
@tersha
Aug 29 2015 07:21
@rc242 I think I understand the problem ... when it hits the return, does that end the loop? In which case I should set the boolean value to a variable and return the boolean variable, right?
Robert
@rc242
Aug 29 2015 07:22
@tersha when you return a value, you leave that function/method. When do you think you should leave the function?
Henry Erickson
@henryed86
Aug 29 2015 07:24
@Greenheart @AuricSlayer @tersha https://twitter.com/ossia/status/565907210497040384
Tersha
@tersha
Aug 29 2015 07:25
@rc242 it was a bit unclear at first but now I see, it leaves at the return.
Robert
@rc242
Aug 29 2015 07:27
@tersha Right. So, you'll need to find when you have a palindrome and leave at the point. In your if-block, you're leaving when you know two chars aren't equal. This seems appropriate since you know that's the first point you know when there's no palindrome.
Tersha
@tersha
Aug 29 2015 07:27
@henryed86 funny thing is I got most of that part since I studied electrical engineering ... it's the actual coding that I've got to brush up on, which is why I'm here :)
Samuel Plumppu
@Greenheart
Aug 29 2015 07:28
@henryed86 Haha that's so fun an so true! :D
Jesse Croxford
@Jcroxford
Aug 29 2015 07:28
haha thats funny
Tersha
@tersha
Aug 29 2015 07:29
@rc242 thx for your help, I think I can rework it from here but I'll be back if I'm still stuck.
CamperBot
@camperbot
Aug 29 2015 07:29
tersha sends brownie points to @rc242 :sparkles: :thumbsup: :sparkles:
:star: 185 | @rc242 | http://www.freecodecamp.com/rc242
Henry Erickson
@henryed86
Aug 29 2015 07:29
@tersha so you know how to learn amazing things
Dmaa
@Dmaa
Aug 29 2015 07:30
is there a way to see what line the error is on?
Robert
@rc242
Aug 29 2015 07:30
@Dmaa Perhaps. What context?
Henry Erickson
@henryed86
Aug 29 2015 07:31
@Greenheart That's the only reason I can understand half of what i'm doing when coding. :smile:
Dmaa
@Dmaa
Aug 29 2015 07:31
This message was deleted
This message was deleted
oh GOD
oops
shame shame
god that's embarassing
Robert
@rc242
Aug 29 2015 07:32
Well, I didn't see it :smile:
Dmaa
@Dmaa
Aug 29 2015 07:33
@rc242 I'm getting an error that's says I have an unexpected token "[", but can't see what line it's on and I can't find it :/
waypoint challenge Bonfire: chunky monkey
Jesse Croxford
@Jcroxford
Aug 29 2015 07:33
@Dmaa I like wrting my code inside http://repl.it/languages/javascript
shows errors better than the embedded editor on fcc site
Dmaa
@Dmaa
Aug 29 2015 07:34
@AuricSlayer and can I see which line errors are on using it?
Robert
@rc242
Aug 29 2015 07:34
@Dmaa you can also paste the code into your javascript console.
Samuel Plumppu
@Greenheart
Aug 29 2015 07:35
@henryed86 haha I feel the same :)
Jesse Croxford
@Jcroxford
Aug 29 2015 07:36
it helps yes
should direct you to the error just as well as any other text editor
someone here might know of a better one that that I dont know this one is just free and conveniant
Dmaa
@Dmaa
Aug 29 2015 07:37
okay thanks!
CamperBot
@camperbot
Aug 29 2015 07:37
if you want to thank someone, put an @ before their name!
Robert
@rc242
Aug 29 2015 07:37
@AuricSlayer @Dmaa codepen does something similiar.
Jesse Croxford
@Jcroxford
Aug 29 2015 07:37
yes but isnt it a paid program after the demo?
Robert
@rc242
Aug 29 2015 07:38
codepen? no.
Jesse Croxford
@Jcroxford
Aug 29 2015 07:39
oh I must have misunderstood when someone else told me about that program then
might have been you actually I dont remember haha
Pardon me I was thinking coderpad
Dmaa
@Dmaa
Aug 29 2015 07:41
Also I'm wondering how many people here have completed the first 800 hours of learning, and how long it actually took
DTing
@dting
Aug 29 2015 07:43
@Dmaa theres probably like 15ish people right now on the non profits part.
Dmaa
@Dmaa
Aug 29 2015 07:44
15 people total or 15 people out of the 5000 in the chatroom?
DTing
@dting
Aug 29 2015 07:44
15 people total for this group with the current curriculum
it took me about two weeks to finish all the challenges. i'd say about 50-60 hours but i've had some javascript and programming experience.
Mike Bobadilla
@mikebobadilla
Aug 29 2015 07:46
yea ive been working on it for about 3 days
on the second bonfires
DTing
@dting
Aug 29 2015 07:47
ya the 800 hours is a generous estimate. I think for people that have never coded. really depends on a person's level of experience
Jesse Croxford
@Jcroxford
Aug 29 2015 07:47
I have been working on the stuff on this site for the past month committing a total of probably about 15-20 hours total and until the update I had the first 4 categories completed and was working on 5. now I am almost done with 5(it was condensed)
DTing
@dting
Aug 29 2015 07:48
@AuricSlayer nice
Jesse Croxford
@Jcroxford
Aug 29 2015 07:48
I agree with @dting I've heard the ziplines get harder but overall I think most people should complete everything before the 800 hour mark
DTing
@dting
Aug 29 2015 07:49
i updated my simon game! it gets faster now, yay http://codepen.io/dting/pen/KpJXZV
Jesse Croxford
@Jcroxford
Aug 29 2015 07:49
thanks @dting im hoping to commit to more time per week starting now I have been in the process of moving so I havent been able to work as hard as I would have liked
CamperBot
@camperbot
Aug 29 2015 07:49
auricslayer sends brownie points to @dting :sparkles: :thumbsup: :sparkles:
:star: 802 | @dting | http://www.freecodecamp.com/dting
DTing
@dting
Aug 29 2015 07:51
ya the ziplines are a bump up in difficulty from the bonfires. the zipline to basejump gap is kinda large. I think they are adding content to bridge that gap but requires putting everything together without much hand holding at that point.
Prashanth
@dgprashanth
Aug 29 2015 07:52
Yeah that's true.. I am on the ziplines now, and they take way more reading up and understanding than we were used to so far..
Not necessarily a bad thing! But yeah, if they could add a couple of modules in between them, it would be nice!
Jesse Croxford
@Jcroxford
Aug 29 2015 07:54
@dgprashanth I don't know that they could of. One think about coding that I have noticed is that at some point you need to make a plunge into the unknown without much hand holding and the difference between those that succeed and fail are the ones that put in the time to understand how to learn on their own
This message was deleted
Prashanth
@dgprashanth
Aug 29 2015 08:06
@AuricSlayer Yep! That's very true! You gotta start learning how to learn on your own. It's quite a jump, but I'm hoping that I'm one of the people who does to learn to teach himself :D
Ashraful Islam
@ashraful-islam
Aug 29 2015 08:08
uh
finally complete Nodejs waypoints :D
DTing
@dting
Aug 29 2015 08:08
@ashraful-islam nice. those were a pain
Ashraful Islam
@ashraful-islam
Aug 29 2015 08:09
I disagree, to be honest I enjoyed 'em more than the other waypoints(js algo)
it's nice to see something doing something, talking back and forth
@dting but, I understand you the master, so basic stuff feels pia :)
I felt pain during basic js
DTing
@dting
Aug 29 2015 08:10
i enjoyed the algorithms haha
and the ziplines and base jumps. but the learnyou<modules> seemed contrived.
like they did something but that something was kinda like nothing. haha
Ashraful Islam
@ashraful-islam
Aug 29 2015 08:11
yes, npm one burfed up quite a few times :D
DTing
@dting
Aug 29 2015 08:11
i think you'll enjoy the basejumps @ashraful-islam
ya that too =(
Ashraful Islam
@ashraful-islam
Aug 29 2015 08:11
looking forward to it
but I didn't complete the 'portfolio' zipline, am I allowed to continue?
am from old curriculum and didn't have that then
:)
DTing
@dting
Aug 29 2015 08:16
i went back and did the new stuff
i think they want all the ziplines so you probably should do it at some point
Ashraful Islam
@ashraful-islam
Aug 29 2015 08:23
:D
don't have anything useful to put on my portfolio
so am procrastinating on that one :)
Jesse Croxford
@Jcroxford
Aug 29 2015 08:24
so I am still stuck on basic algorithm scripting 14... callback functions are confusing me a bit does anybody know a good source to learn about call back functions or filtering?
Ashraful Islam
@ashraful-islam
Aug 29 2015 08:27
@AuricSlayer callbacks are just function which are called when the main function completes it's task
// prints hello
var myCallback = function(name) { console.log('Hello ' + name + '!'); };
var mySpecialFunction = function(some_param, myCallback) {
     /* do some complex stuff here */
    //all done, now callback
    myCallback(someones_name);
}
@AuricSlayer did I confuse you enough :smiling_imp:
Jesse Croxford
@Jcroxford
Aug 29 2015 08:31
maybe you can help explain how this works on this challenge? http://www.freecodecamp.com/challenges/bonfire-falsey-bouncer
CamperBot
@camperbot
Aug 29 2015 08:31
type bonfire name to get some info on that bonfire. And check HelpBonfires chatroom
Jesse Croxford
@Jcroxford
Aug 29 2015 08:31
This message was deleted
I dont understand what you are supposed to pass into the function to remove the false parameters
Ashraful Islam
@ashraful-islam
Aug 29 2015 08:33
bonfire falsey
CamperBot
@camperbot
Aug 29 2015 08:33

:fire:Bonfire: Falsey Bouncer :link:

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

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

Remove all falsey values from an array.

more info:  bf details | bf links | hint

Ashraful Islam
@ashraful-islam
Aug 29 2015 08:33
you don't need any callbacks
Jesse Croxford
@Jcroxford
Aug 29 2015 08:33
I must have misunderstood the article I was reading then haha
Ashraful Islam
@ashraful-islam
Aug 29 2015 08:33
or did you mean callback for the forEach of the input array(arr)
Jesse Croxford
@Jcroxford
Aug 29 2015 08:35
how do you add code again I forgot haha
Ill show you what I have so far
Mike Bobadilla
@mikebobadilla
Aug 29 2015 08:36
3 tildas
well
DTing
@dting
Aug 29 2015 08:36
help formatting
CamperBot
@camperbot
Aug 29 2015 08: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

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

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

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

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

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

Mike Bobadilla
@mikebobadilla
Aug 29 2015 08:36
`
backticks
TIL
DTing
@dting
Aug 29 2015 08:37
bf links
CamperBot
@camperbot
Aug 29 2015 08:37
Ashraful Islam
@ashraful-islam
Aug 29 2015 08:37
/* FCC: Falsy Bouncer */
function bouncer(arr) {
  var myArr = arr.slice(); // clone arr
// filter removes all elements for which the test is false
  myArr = myArr.filter(function(one_element_in_myArr) {
    return Boolean(one_element_in_myArr); // return false for all falsy elements
 }

  return myArr;
}
Jesse Croxford
@Jcroxford
Aug 29 2015 08:37
thanks @bitsandbytez thanks @dting
CamperBot
@camperbot
Aug 29 2015 08:37
auricslayer sends brownie points to @bitsandbytez and @dting :sparkles: :thumbsup: :sparkles:
:warning: auricslayer already gave dting points
:star: 230 | @bitsandbytez | http://www.freecodecamp.com/bitsandbytez
Ashraful Islam
@ashraful-islam
Aug 29 2015 08:37
@AuricSlayer I did this
ops!
missed a closing bracket
Mike Bobadilla
@mikebobadilla
Aug 29 2015 08:38
dont you need arguments in slice
DTing
@dting
Aug 29 2015 08:38
@ashraful-islam
function bouncer(arr) {
  return arr.filter(Boolean);
}
Mike Bobadilla
@mikebobadilla
Aug 29 2015 08:38
yea thats nice
filter and map are $$$
Ashraful Islam
@ashraful-islam
Aug 29 2015 08:38
@dting yes, possible, but I was trying to make it more verbose, I don't know AurieSlayer's knowledge level :)
DTing
@dting
Aug 29 2015 08:39
Boolean is a function that returns if the argument it is called with is a falsy or truthy value
Ashraful Islam
@ashraful-islam
Aug 29 2015 08:39
when I first started, I was like "whoa! what is this filter, how is my array element going inside that Boolean?"
DTing
@dting
Aug 29 2015 08:40
Array.Filter doesn't mutate the array so the slice isn't doing anything useful. It creates an extra shallow copy of the original array.
Ashraful Islam
@ashraful-islam
Aug 29 2015 08:41
@dting I learned, it's best practice to keep your input variable separate , so I make a shallow copy when I need to work with input :)
Jesse Croxford
@Jcroxford
Aug 29 2015 08:41
so just to make sure I understand, boolean inside filter essentially removes anything classified as false from the array?
Ashraful Islam
@ashraful-islam
Aug 29 2015 08:41
@dting am starting the express tut now, anything you'd like to mention?
@AuricSlayer no, Boolean will return a 'false' if the element is considered false by javascript
DTing
@dting
Aug 29 2015 08:41
@AuricSlayer Array.filter does the filtering
Jesse Croxford
@Jcroxford
Aug 29 2015 08:42
OOOOOHHH ok
DTing
@dting
Aug 29 2015 08:42
it takes a callback function and passes amongst other things each value of the array you are calling filter on to the callback function
var result = arr.filter(<callback function>);
Jesse Croxford
@Jcroxford
Aug 29 2015 08:43
awesome I think I totally get it now then thank @dting thanks @ashraful-islam so much! I have been so confused by this one haha
CamperBot
@camperbot
Aug 29 2015 08:43
auricslayer sends brownie points to @dting and @ashraful-islam :sparkles: :thumbsup: :sparkles:
:warning: auricslayer already gave dting points
:warning: could not find receiver for ashraful-islam
DTing
@dting
Aug 29 2015 08:43
the callback function is called with the first argument each element of the array. if that function returns a truthy value the element will be included in the returned result. if it is falsy it will not
function bouncer(arr) {
  return arr.filter(function(element) { return element;});
}
Jesse Croxford
@Jcroxford
Aug 29 2015 08:44
sad I cant give more brownie points xD
DTing
@dting
Aug 29 2015 08:44
this actually does the same thing because filter will evaluate the truthyness of the returned object
Mike Bobadilla
@mikebobadilla
Aug 29 2015 08:44
awesome youtube series
Ashraful Islam
@ashraful-islam
Aug 29 2015 08:44
^ this guy's videos are awesome
DTing
@dting
Aug 29 2015 08:44
using boolean as the function is a nice short cut so you dont have to create an anonymous function
Ashraful Islam
@ashraful-islam
Aug 29 2015 08:45
@AuricSlayer once you get a grasp on forEach/map/reduce/filter, you'll be doing ninja kicks in JS :)
Jesse Croxford
@Jcroxford
Aug 29 2015 08:45
im hyped. seem like basic concepts once you understand them
Ronald Ishak
@ronishak
Aug 29 2015 08:45
love that guys channel!
Jesse Croxford
@Jcroxford
Aug 29 2015 08:47
I will check him out later. Now that I have that done I need to head to bed so I can get started again first thing in the moring! (3 am here)
rjantos
@rjantos
Aug 29 2015 08:48
Hey guys, need some help and direction for the waypoint: create a slotmachine, anybody?
Ashraful Islam
@ashraful-islam
Aug 29 2015 08:50
@rjantos slotmachine, the jquery one?
rjantos
@rjantos
Aug 29 2015 08:50
no the js one
Ashraful Islam
@ashraful-islam
Aug 29 2015 08:56
random ones?
Math.random() * (3n+1)
rjantos
@rjantos
Aug 29 2015 08:57
yeah how to assign random numbers to the different variables
Ashraful Islam
@ashraful-islam
Aug 29 2015 08:57
:)
rjantos
@rjantos
Aug 29 2015 08:57
with Math.floor(Math.random() * (3 - 1 + 1)) + 1;
Mike Bobadilla
@mikebobadilla
Aug 29 2015 08:57
I dont understand that
why -1 + 1
Ashraful Islam
@ashraful-islam
Aug 29 2015 08:58
you just do var my_random_num = Math.floor(Math.random() * )3-1+1))+1
rjantos
@rjantos
Aug 29 2015 08:58
need a random number between 1 and 3
Mike Bobadilla
@mikebobadilla
Aug 29 2015 08:58
but thats what the 3 is foor
Ashraful Islam
@ashraful-islam
Aug 29 2015 08:59
@bitsandbytez I think it has something to do with the precedence of operation
Mike Bobadilla
@mikebobadilla
Aug 29 2015 08:59
-1 + 1 = 0 , no?
Ashraful Islam
@ashraful-islam
Aug 29 2015 08:59
no, it seems to do something in the exercise
Mike Bobadilla
@mikebobadilla
Aug 29 2015 08:59
its in () though
so thats always evaluated first
Ashraful Islam
@ashraful-islam
Aug 29 2015 08:59
I initially thought meh, -1+1 = 0 so why not remove it
but it seems to produce some effect in the waypoint
DTing
@dting
Aug 29 2015 09:00
@bitsandbytez its to be explicit in the last excercise they explain to get a range it is Math.floor(Math.random() *( max - min + 1)) + min;
Ashraful Islam
@ashraful-islam
Aug 29 2015 09:00
^
DTing
@dting
Aug 29 2015 09:00
it is basically just there to remind you thats what they are doing
rjantos
@rjantos
Aug 29 2015 09:00
true but i made way more complicated then it is. just needed to assign the mathfloor to the various values
Mike Bobadilla
@mikebobadilla
Aug 29 2015 09:00
ok that makes sense
DTing
@dting
Aug 29 2015 09:00
what various values?
Ashraful Islam
@ashraful-islam
Aug 29 2015 09:00
@rjantos you assign it like you do other variables
rjantos
@rjantos
Aug 29 2015 09:00
i meant variables
;)
Ashraful Islam
@ashraful-islam
Aug 29 2015 09:01
var x = Math.floor(....)
^
DTing
@dting
Aug 29 2015 09:02
slotOne = Math.floor(Math.random() * (3 - 1 + 1)) + 1;
same for slotTwo and slotThree
they are using regex to check so ya just copy paste the code from the left side
Ashraful Islam
@ashraful-islam
Aug 29 2015 09:03
@dting that explains why removing that -1+1 causes it to fail
dang regex
@dting (Math.random * 3)+1 <--- should suffice IMO
ah, (Math.random() * 3)+1
rjantos
@rjantos
Aug 29 2015 09:04
yup much clearer now, thanks
CamperBot
@camperbot
Aug 29 2015 09:04
if you want to thank someone, put an @ before their name!
DTing
@dting
Aug 29 2015 09:05
ya lot of people making comments about that. they should just make a comment themselves within the text to make it less confusing.
rjantos
@rjantos
Aug 29 2015 09:05
@ashraful-islam thanks
CamperBot
@camperbot
Aug 29 2015 09:05
rjantos sends brownie points to @ashraful-islam :sparkles: :thumbsup: :sparkles:
:warning: could not find receiver for ashraful-islam
Ashraful Islam
@ashraful-islam
Aug 29 2015 09:05
:D think I should change my github username, missing a lot of lovely brownies
rjantos
@rjantos
Aug 29 2015 09:05
ya lot of people making comments about that. they should just make a comment themselves within the text to make it less confusing. I agree
Ashraful Islam
@ashraful-islam
Aug 29 2015 09:06
did I just sound total selfish? :worried:
DTing
@dting
Aug 29 2015 09:08
or just change your fcc name
Ashraful Islam
@ashraful-islam
Aug 29 2015 09:09
hmm... is that possible?
wow! express is slightly more exciting that node :D so much possibilities I can think of
Mike Bobadilla
@mikebobadilla
Aug 29 2015 09:13
its nice
Ronald Ishak
@ronishak
Aug 29 2015 09:22
i want to get brownies! how do i get brownies?
Mike Bobadilla
@mikebobadilla
Aug 29 2015 09:22
thanks @ronishak
CamperBot
@camperbot
Aug 29 2015 09:22
bitsandbytez sends brownie points to @ronishak :sparkles: :thumbsup: :sparkles:
:star: 25 | @ronishak | http://www.freecodecamp.com/ronishak
Ronald Ishak
@ronishak
Aug 29 2015 09:22
cool!
rjantos
@rjantos
Aug 29 2015 09:23
easiest way to factorialize a number?
DTing
@dting
Aug 29 2015 09:23
recursion
Mike Bobadilla
@mikebobadilla
Aug 29 2015 09:24
yep
DTing
@dting
Aug 29 2015 09:25
or while loop. i guess it depends who you ask
haha
rjantos
@rjantos
Aug 29 2015 09:25
interesting ;)
Aleksandar B.
@aleksandar-b
Aug 29 2015 09:28
Why i am unable to push streamer in to an arrays streamers_offline and streamers_online?
Ashraful Islam
@ashraful-islam
Aug 29 2015 09:29
@samosale nice! :thumbsup:
not sure what you meant
Aleksandar B.
@aleksandar-b
Aug 29 2015 09:32
@ashraful-islam
this code doesn't work
 var streamers_online = [];
  var streamers_offline = [];
  users.forEach(function(streamer) {
    $.get("https://api.twitch.tv/kraken/streams/" + streamer + "?callback=?", function(ad) {
      if (ad['stream'] === null) {

        streamers_offline.push(streamer);
      } else {
        streamers_online.push(streamer);
      }
    }, "JSONP");
  });
  /// Why this don't work?
      console.log(streamers_online);
  console.log(streamers_offline);
Ashraful Islam
@ashraful-islam
Aug 29 2015 09:32
@samosale the ajax thing is asynchronous
the console.log gets called before the streamers_online/offline get populated
Arsalan Sabir
@aayanqazi
Aug 29 2015 09:33
assert(welcomeToBooleans() === true, 'welcomeToBooleans() should return true.');
What Is Assert ?
Ashraful Islam
@ashraful-islam
Aug 29 2015 09:33
@aayanqazi test
Aleksandar B.
@aleksandar-b
Aug 29 2015 09:33
@ashraful-islam is my arrays then populated?
Ashraful Islam
@ashraful-islam
Aug 29 2015 09:33
`assert(<test-code>,message_if_test_failed)
@samosale you should use console.log inside your if/else or immediately after if/else
:) then you'll see what you are trying to see
@samosale but, my devkit-console shows two arrays of online/offline users here
blob
Aleksandar B.
@aleksandar-b
Aug 29 2015 09:36
@ashraful-islam yeah, now suddenly works
Ashraful Islam
@ashraful-islam
Aug 29 2015 09:37
:)
but, when dealing with async stuff, you better examine them in execution scope
Aleksandar B.
@aleksandar-b
Aug 29 2015 09:38
@ashraful-islam but, my arrays get populated, even if console.log doesn't show nothing, right?
Ashraful Islam
@ashraful-islam
Aug 29 2015 09:38
ofcourse, arrays will get populated
Aleksandar B.
@aleksandar-b
Aug 29 2015 09:39
I need that for my search box on keybackspace event. I have tried with ajax but doesnt work;
Ashraful Islam
@ashraful-islam
Aug 29 2015 09:40
@samosale async = blessing/curse at the same time, depending on how you handle it :)
Aleksandar B.
@aleksandar-b
Aug 29 2015 09:40
@ashraful-islam tnx
CamperBot
@camperbot
Aug 29 2015 09:40
samosale sends brownie points to @ashraful-islam :sparkles: :thumbsup: :sparkles:
:warning: could not find receiver for ashraful-islam
Aleksandar B.
@aleksandar-b
Aug 29 2015 09:42
@ashraful-islam is there some method like .when to display arrays when ajax get finished?
i can do on success?
Ashraful Islam
@ashraful-islam
Aug 29 2015 09:42
yes
jquery has .success(), .fail()
Davis
@ajdavis56
Aug 29 2015 09:43
can anyone walk me through making a cors reqeust?
Ashraful Islam
@ashraful-islam
Aug 29 2015 09:43
@ajdavis56 is this the wikipedia one?
Davis
@ajdavis56
Aug 29 2015 09:44
@ashraful-islam forismatic.com actually
any direction would be appreciated. I'm stuck.
Ashraful Islam
@ashraful-islam
Aug 29 2015 09:46
@ajdavis56 forismatic doesn't have allow-origin-.... header
it also doesn't take kindly to jsonp
@ajdavis56 may I see your codepen?
Soumya Rauth
@soumyaRauth
Aug 29 2015 09:47
Why cant I see my FCC profile if i search it on google.???? What went wrong????
Ashraful Islam
@ashraful-islam
Aug 29 2015 09:48
?
DTing
@dting
Aug 29 2015 09:49
@ashraful-islam it can use jsonp
Ashraful Islam
@ashraful-islam
Aug 29 2015 09:49
@ajdavis56 if you use jsonp, you'll get russina quotes I believe
@dting wow!
this could've saved me a lot of headache when I did this
@dting thanks!
CamperBot
@camperbot
Aug 29 2015 09:52
ashraful-islam sends brownie points to @dting :sparkles: :thumbsup: :sparkles:
:star: 806 | @dting | http://www.freecodecamp.com/dting
Soumya Rauth
@soumyaRauth
Aug 29 2015 09:57
how do i change my profile name on FCC. ?
Clearwood
@Clearwood
Aug 29 2015 10:13
where's the problem with that?
function chunk(arr, size) {
  // Break it up.
  var arrTemp = arr
  var MeinArray = [];
  var ll = arr.length / size;
  var temp=[];
  var tnum = size;
  while (ll > 0){
    if (tnum > 0){
      temp.push(arrTemp[0]);
      arrTemp.shift();
      tnum--;
    }
    else {
      ll--;
      tnum = size;
      MeinArray.push(temp);
      while (temp.length > 0){
      temp.shift();
      }
    }
  }
  return MeinArray;


}

chunk(['a', 'b', 'c', 'd'], 2);
Mike Bobadilla
@mikebobadilla
Aug 29 2015 10:13
variables cant be numbers I dont think
oh is that ll
haha im dumb
Clearwood
@Clearwood
Aug 29 2015 10:14
@bitsandbytez of course variables can be numbers
Mike Bobadilla
@mikebobadilla
Aug 29 2015 10:14
really?
I thought that was restricted? or is that id's in html
im confused
Clearwood
@Clearwood
Aug 29 2015 10:15
@bitsandbytez variables in jscript can be numbers http://www.w3schools.com/js/js_variables.asp
Mike Bobadilla
@mikebobadilla
Aug 29 2015 10:16
oh ok
thanks
CamperBot
@camperbot
Aug 29 2015 10:16
if you want to thank someone, put an @ before their name!
soumyaRauth @soumyaRauth
soumyaRauth @soumyaRauth Howdyyy!!!
Mike Bobadilla
@mikebobadilla
Aug 29 2015 10:18
whoa purple
Soumya Rauth
@soumyaRauth
Aug 29 2015 10:19
I need help...
Chris Jones
@cmjchrisjones
Aug 29 2015 10:20
@vanityinsanity @parnelandr Try using the .target instead of .well @spramp you need to seperate the animated and bounce classes, eg addClass('animated bounce');
DTing
@dting
Aug 29 2015 10:20
@Clearwood you are shifting off elements for the array you just pushed into the Main array
Clearwood
@Clearwood
Aug 29 2015 10:21
@dting i wanted to shift off the elements off the temp array where i didn't want them to be
DTing
@dting
Aug 29 2015 10:21
that changes that array since it is the same object
you can either reassign temp to a new array
or push a copy to Main array
Soumya Rauth
@soumyaRauth
Aug 29 2015 10:22
I can't see my FCC portfolio while i searched it on the google. it is written "404: We couldn't find path /"
Clearwood
@Clearwood
Aug 29 2015 10:23
@dting but i thought when i first push the variables to the target array i then have to delete them from the source array
DTing
@dting
Aug 29 2015 10:30
var a = [];
var b = [];
a.push(1);
console.log(JSON.stringify(a));
// [1]
b.push(a);
console.log(JSON.stringify(b));
// [[1]]
a.shift();
console.log(JSON.stringify(a));
// []
console.log(JSON.stringify(b));
// [[]]
Clearwood
@Clearwood
Aug 29 2015 10:31
@dting i see so how can i push a copy to the main array?
DTing
@dting
Aug 29 2015 10:32
you could slice it. but since you are just throwing away the values. you would just do temp = [];
assign temp to a new array. leaving the object that temp originally pointed to intact and in your main array
Clearwood
@Clearwood
Aug 29 2015 10:35
@dting but do i have to reassign temp?
Soumya Rauth
@soumyaRauth
Aug 29 2015 10:35
Going to start the POMODORO ZIPLINE... Any suggestion in advance??
DTing
@dting
Aug 29 2015 10:36
you dont have to but you should
you could push (temp.slice())
then shift off all the elements in temp or temp.length = 0 after but theres no benefit in doing that
Clearwood
@Clearwood
Aug 29 2015 10:49
@dting thx got it know
CamperBot
@camperbot
Aug 29 2015 10:49
clearwood sends brownie points to @dting :sparkles: :thumbsup: :sparkles:
:star: 808 | @dting | http://www.freecodecamp.com/dting
Arsalan Sabir
@aayanqazi
Aug 29 2015 10:59
Sift through Text with Regular Expressions
i Stuck On THis
Kelvin O
@kerukelw
Aug 29 2015 11:02
chunky monkey
Arsalan Sabir
@aayanqazi
Aug 29 2015 11:03
??
Kelvin O
@kerukelw
Aug 29 2015 11:06
im working on the same challenge (chunks) too
Arsalan Sabir
@aayanqazi
Aug 29 2015 11:08
So You Have Done ?? @kerukelw
Kelvin O
@kerukelw
Aug 29 2015 11:09
im work-ing on it
Arsalan Sabir
@aayanqazi
Aug 29 2015 11:10
Ok
I Have Done It
Kelvin O
@kerukelw
Aug 29 2015 11:15
cool
im still stuck
Arsalan Sabir
@aayanqazi
Aug 29 2015 11:15
:P
Ashraful Islam
@ashraful-islam
Aug 29 2015 11:17
oh dang!
am stuck in the last challenge of expressjs
Shoumya Kanti Das
@shoumyadas
Aug 29 2015 11:18
how do i replace all non alphabetic characters in javascript??
Ashraful Islam
@ashraful-islam
Aug 29 2015 11:18
regexp with \W
Shoumya Kanti Das
@shoumyadas
Aug 29 2015 11:19
This message was deleted

function palindrome(str) {
var a=str.replace(/\s+/,"").split('').reverse().join('');
if(str.toLowerCase()==a.toLowerCase())
return true;
else
return false;
}

i did this but this can only replace blankspaces .right?

Kelvin O
@kerukelw
Aug 29 2015 11:19
cool i just finished the zipline
Marie Pelletier
@Marie000
Aug 29 2015 11:19
Can anyone figure out why my variable myLocation does not work outside of the function:
function getLocation() {
$.get("http://ipinfo.io", function(response) {
    myLocation = response.city
    //alert(myLocation);
}, "jsonp");
}
alert(myLocation);
Ashraful Islam
@ashraful-islam
Aug 29 2015 11:20
@Marie000 scope
Shoumya Kanti Das
@shoumyadas
Aug 29 2015 11:20
@Marie000 because you declared it inside the {
Ashraful Islam
@ashraful-islam
Aug 29 2015 11:20
did you declare myLocation outside of the $.get() ?
Kelvin O
@kerukelw
Aug 29 2015 11:20
@shoumyadas youn can try this `` .replace(/['~!@#$%^&*()_|+-=?;:'",.<>{}[]\\/]/gi, "");
see if it helps
Shoumya Kanti Das
@shoumyadas
Aug 29 2015 11:20
ok.. and what is \W for?
Marie Pelletier
@Marie000
Aug 29 2015 11:21
I tried declaring the variable before the function, but it didn't change anything. I thought not using the "var" to create a variable meant it would be a global variable
Ashraful Islam
@ashraful-islam
Aug 29 2015 11:21
@Marie000 may be your $.get() is being called after the alert()
Marie Pelletier
@Marie000
Aug 29 2015 11:22
maybe. I'll check that. Thanks @ashraful-islam
CamperBot
@camperbot
Aug 29 2015 11:22
marie000 sends brownie points to @ashraful-islam :sparkles: :thumbsup: :sparkles:
:warning: could not find receiver for ashraful-islam
Ashraful Islam
@ashraful-islam
Aug 29 2015 11:22
@dting here is my lovely express stuff
// dependencies
var express = require('express'),
    fs      = require('fs'),
    serv    = express();

serv.get('/books', function (req, res) {

    fs.readFile(process.argv[3],{ encoding: "utf8" }, function(err, data){

        if (err) throw err;

        var dataObj = JSON.parse(data);

        res.json(dataObj);
    });

}).listen(process.argv[2]);
gives some lovely JSON too
but test is always giving me this error
blob
looks like my JSON is getting misformatted somehow
DTing
@dting
Aug 29 2015 11:26
try without the {encoding: 'utf8'} object
Ashraful Islam
@ashraful-islam
Aug 29 2015 11:28
@dting nah, it gives me a bunch of numbers
buffer stream
DTing
@dting
Aug 29 2015 11:32
no idea
Ashraful Islam
@ashraful-islam
Aug 29 2015 11:33
:(
Marie Pelletier
@Marie000
Aug 29 2015 11:36
ok, I fixed my variable problem, but why is this not working now? shouldn't it give me the location when the page loads?
$(document).ready(function getLocation() {
$.get("http://ipinfo.io", function(response) {
    myLocation = response.city
    //alert(myLocation);
}, "jsonp");
  alert(myLocation);
  })
Ashraful Islam
@ashraful-islam
Aug 29 2015 11:40
@Marie000 $.get is asynchronous
Shoumya Kanti Das
@shoumyadas
Aug 29 2015 11:40
@ashraful-islam did it! used the /\W+/gi :)
Ashraful Islam
@ashraful-islam
Aug 29 2015 11:40
@shoumyadas :thumbsup:
Shoumya Kanti Das
@shoumyadas
Aug 29 2015 11:40
how do i give brownies?
Ashraful Islam
@ashraful-islam
Aug 29 2015 11:41
@dting it appears that, my data is having some \n in them which is acting up to mess my json
@iashraful thanks!
CamperBot
@camperbot
Aug 29 2015 11:41
ashraful-islam sends brownie points to @iashraful :sparkles: :thumbsup: :sparkles:
:star: 272 | @iashraful | http://www.freecodecamp.com/iashraful
Ashraful Islam
@ashraful-islam
Aug 29 2015 11:41
my id is iashraful
Giacomo
@Jack1618
Aug 29 2015 11:42
Hi guys, can anyone help me? I'm developing my portfolio page, and I don't understand why all elements under the navbar are link-like highlighted.
codepen debug here: http://s.codepen.io/Jack1618/debug/KpObzd?
Jose M Viloria
@josevill
Aug 29 2015 11:43
@Jack1618 Line 25, you pressed Intro and left the clossing tag behind by mistake
Deep2322
@Deep2322
Aug 29 2015 11:43
can anyone explain me this code
function end(str, target) {
if(str.substr((str.length - target.length ),(str.length)) == target){
return true;
}
else{
return false;
}
}
end('Bastian', 'n');
Ashraful Islam
@ashraful-islam
Aug 29 2015 11:45
@dting solved it, the instruction was wrong, using res.json messedup my result
instead used res.end(data), and test passed
@dting thanks!
CamperBot
@camperbot
Aug 29 2015 11:45
ashraful-islam sends brownie points to @dting :sparkles: :thumbsup: :sparkles:
:star: 810 | @dting | http://www.freecodecamp.com/dting
Shoumya Kanti Das
@shoumyadas
Aug 29 2015 11:45
thanks @ashraful-islam
CamperBot
@camperbot
Aug 29 2015 11:45
shoumyadas sends brownie points to @ashraful-islam :sparkles: :thumbsup: :sparkles:
:warning: could not find receiver for ashraful-islam
Giacomo
@Jack1618
Aug 29 2015 11:45
@josevill thank you!! =)
Shoumya Kanti Das
@shoumyadas
Aug 29 2015 11:46
thanks @iashraful
CamperBot
@camperbot
Aug 29 2015 11:46
shoumyadas sends brownie points to @iashraful :sparkles: :thumbsup: :sparkles:
:star: 273 | @iashraful | http://www.freecodecamp.com/iashraful
Giacomo
@Jack1618
Aug 29 2015 11:46
thanks @josevill
CamperBot
@camperbot
Aug 29 2015 11:46
jack1618 sends brownie points to @josevill :sparkles: :thumbsup: :sparkles:
:star: 244 | @josevill | http://www.freecodecamp.com/josevill
Ashraful Islam
@ashraful-islam
Aug 29 2015 11:46
@Deep2322 it checks if a particular string is present in your test string
I mean it checks if your test string ends with a particular stringset
like "Bastian","tian" would return true
"Bastian","rando", returns false
:)
Jose M Viloria
@josevill
Aug 29 2015 11:47
@Jack1618 you should use a text editor with syntax highlighting so you can debug easier :)
Try reading each block of code when you stumble upon some issues
Deep2322
@Deep2322
Aug 29 2015 11:48
(str.length-target.length) would be 6 and again str.length is 7
Ashraful Islam
@ashraful-islam
Aug 29 2015 11:48
that one
assuming str = "Bastian"
and target = "ian"
Deep2322
@Deep2322
Aug 29 2015 11:49
if(str.substr((6 ),(7)) == target) i just cant undesrtand
Ashraful Islam
@ashraful-islam
Aug 29 2015 11:49
string.substr(start, end) will give a part of the string from char start to end
Jose M Viloria
@josevill
Aug 29 2015 11:49
@Deep2322 There's no need to put those arguments within parenthesis
Omar
@oab00
Aug 29 2015 11:49
@Marie000 change the url to 'http://ipinfo.io/json' and the data type to 'json'
Deep2322
@Deep2322
Aug 29 2015 11:50
target is n ryt..?
Ashraful Islam
@ashraful-islam
Aug 29 2015 11:50
"Deep".substr(0,2) gives "De"
^
"Deep".substr(1,4) gives "eep"
Deep2322
@Deep2322
Aug 29 2015 11:51
it gives Dee ryt..?
Ashraful Islam
@ashraful-islam
Aug 29 2015 11:51
:)
no, the ending point is excluded
upto "end", not including "end"
Deep2322
@Deep2322
Aug 29 2015 11:52
thank u very much..:-)
CamperBot
@camperbot
Aug 29 2015 11:52
if you want to thank someone, put an @ before their name!
Deep2322
@Deep2322
Aug 29 2015 11:52
@ashraful-islam
Ashraful Islam
@ashraful-islam
Aug 29 2015 11:53
@Deep2322 my id is iashraful, not "ashraful-islam"
Deep2322
@Deep2322
Aug 29 2015 11:53
thank u very much @ashraful-islam
CamperBot
@camperbot
Aug 29 2015 11:53
deep2322 sends brownie points to @ashraful-islam :sparkles: :thumbsup: :sparkles:
:warning: could not find receiver for ashraful-islam
Ashraful Islam
@ashraful-islam
Aug 29 2015 11:53
:D
Green
@moringasystem
Aug 29 2015 11:53
Hello campers i think i need help with the javascript slot machine
Ashraful Islam
@ashraful-islam
Aug 29 2015 11:53
@moringasystem we have a few for sale, what's your offer :D
Jose M Viloria
@josevill
Aug 29 2015 11:53
@moringasystem show us the problem
Green
@moringasystem
Aug 29 2015 11:53
:)
Ashraful Islam
@ashraful-islam
Aug 29 2015 11:54
@moringasystem where are you stuck?
jquery/random number?
Deep2322
@Deep2322
Aug 29 2015 11:56
"Deep".substr(1,4) gives "eep"
i am getting confused
it starts from 0 ryt ?
Jose M Viloria
@josevill
Aug 29 2015 11:57
@Deep2322 Yes.
Deep2322
@Deep2322
Aug 29 2015 11:57
D = 0 , e = 1 , e = 2 , p = 3
Jose M Viloria
@josevill
Aug 29 2015 11:57
@Deep2322 But let's try to think "out of the box"
@Deep2322 What if you try passing out a negative number into substr?
Deep2322
@Deep2322
Aug 29 2015 11:57
where does 4 come from..?
Jose M Viloria
@josevill
Aug 29 2015 11:58
@Deep2322 in the 2nd argument they'll start countring from 1, so p becomes 4
@Deep2322 try using negative values. When you pass a negative value to substr it starts from the end.
@Deep2322 i won't tell you more :angel:
Deep2322
@Deep2322
Aug 29 2015 11:59
ok sorry
Jose M Viloria
@josevill
Aug 29 2015 12:00
@Deep2322 Try a little more with what i've told you. If you don't come out with an answer, come back and we can sort it out :)
Green
@moringasystem
Aug 29 2015 12:00
@ashraful-islam yes i am in the jquery section
Ashraful Islam
@ashraful-islam
Aug 29 2015 12:00
@josevill nice
Deep2322
@Deep2322
Aug 29 2015 12:00
ok :+1:
Clearwood
@Clearwood
Aug 29 2015 12:00
where'S the problem with that?
function mutation(arr) {
  var source = arr.slice(1,2);
  source = source.toString().split("");
  var target = arr.slice(0,1);
  target = target.toString().split("");
  var index = target.indexOf(source);
  if (index >= 0){
    return true;
  }
  else {
    return false;
  }

}

mutation(['hello', 'hey']);
Ashraful Islam
@ashraful-islam
Aug 29 2015 12:00
@Deep2322 I like your style, I often show the solution first, which spoil people
sorry meant for @josevill
Green
@moringasystem
Aug 29 2015 12:01
@ashraful-islam generate random number, idon't know if i have to tie in a for loop in there too
Deep2322
@Deep2322
Aug 29 2015 12:01
i was happy for moment :smile:
Arsalan Sabir
@aayanqazi
Aug 29 2015 12:01
Reverse a String
Can Any One Help Me ????
Ashraful Islam
@ashraful-islam
Aug 29 2015 12:01
@Deep2322 just think of the syntax "....".substr(start_index, end_index)
if the "end_index" is negative, it'll start counting from the end
:)
Nnxoxo
@Nnxoxo
Aug 29 2015 12:02
@aayanqazi yes, show the solution
Clearwood
@Clearwood
Aug 29 2015 12:02
@aayanqazi sure where exactly is your problem?
Betsey Biggs
@betsbillabong
Aug 29 2015 12:02
In case anyone else is just starting the javascript waypoints and feeling lost, I found this explanation of for, while, and do…. while loops to be really helpful
http://www.kirupa.com/html5/loops_in_javascript.htm
Ashraful Islam
@ashraful-islam
Aug 29 2015 12:02
"Meh".substr(-2) gives me "eh"
Nicholas
@nick88p
Aug 29 2015 12:02
Hi guys, I am working on a program where I need to change the variable in a function and then use that variable elsewhere ... it is not working. I was under the impression that so long as I declare the variable globally, I could access it and change it anywhere as I have the global scope.
Is that not so?
Ashraful Islam
@ashraful-islam
Aug 29 2015 12:02
"Meh".substr(-1), gives me "h"
:)
Nnxoxo
@Nnxoxo
Aug 29 2015 12:03
@nick88p show what u have
Ashraful Islam
@ashraful-islam
Aug 29 2015 12:03
+1
Nicholas
@nick88p
Aug 29 2015 12:03
@Nnutthowze here it is:
$(document).ready(function(){
var userLocation;
var unitsTemp;

$.getJSON('//ipinfo.io',function(location){
  userLocation = location.city;
  $('#location').html(userLocation);
});

$('#unit').click(function(){
   var pCont = $('#unit').html();
    if (pCont === 'C') {
    $('#unit').html('F'); //pCont ='C' assigns C to var
    unitsTemp = "imperial";
    } else {
    $('#unit').html('C');
    unitsTemp = "metric";
    }
});

$.getJSON('//api.openweathermap.org/data/2.5/weather?q=' + userLocation + '&units=' + unitsTemp + '&callback=?',function(result){

$('#temperature').html(JSON.stringify(result.main.temp));

});
});
The variable I am talking about it uitsTemp
Nnxoxo
@Nnxoxo
Aug 29 2015 12:04
@nick88p so what's the problem
Green
@moringasystem
Aug 29 2015 12:04
hello campers i need help with jquery generate random numbers for slot machine
Nicholas
@nick88p
Aug 29 2015 12:05
I want to change it to either "metric" or "imperial" based on the contents of my ID= units
Jose M Viloria
@josevill
Aug 29 2015 12:05
@ashraful-islam Programming is about thinking in a logical way. I did struggle too with some stuff. I you give away the answer how will those who struggle come up with an answer if you've already given them one? :( That's why i sometimes sound "rude", lol
Nicholas
@nick88p
Aug 29 2015 12:05
if I set unitsTemp equal to metric or imperial in the beginning, i.e. when declaring it the program works perfectly
Jose M Viloria
@josevill
Aug 29 2015 12:05
@moringasystem Alright... You're in the Slot machines, right?
Deep2322
@Deep2322
Aug 29 2015 12:06
Meh.substring(3) will this give "h"..?
Nicholas
@nick88p
Aug 29 2015 12:06
@Nnutthowze but I want the user to be able to decide the units and that doesn't work
Green
@moringasystem
Aug 29 2015 12:06
@josevill yes theats where i am
Ashraful Islam
@ashraful-islam
Aug 29 2015 12:06
@Deep2322 open your devkit console and knock yourself out
@Deep2322 I mostly learned these using devkit console and few experiments
Green
@moringasystem
Aug 29 2015 12:07
@josevill I want to know if i should generate the rondom number and pass it to the slot machine variable above
Jose M Viloria
@josevill
Aug 29 2015 12:07
@Deep2322 I've sent you some Private messages, go and check those out
Deep2322
@Deep2322
Aug 29 2015 12:07
sorry for being like this ..unless i understand i am not going forward..?
Nnxoxo
@Nnxoxo
Aug 29 2015 12:08
@nick88p u have 2 ajax calls, which start when the document is ready, so u need to nest ur ajax call somewhere for example in $("#unit").click(function() {)
@Nnutthowze
Jose M Viloria
@josevill
Aug 29 2015 12:09
@moringasystem Tell me which waypoint you're currently stuck in, so i can go there and check out for reference
Nnxoxo
@Nnxoxo
Aug 29 2015 12:09
@nick88p u need to put in this event only the last one ajax call
Green
@moringasystem
Aug 29 2015 12:09
@josevill I am on the jquery waypoint number 37
Nicholas
@nick88p
Aug 29 2015 12:10
@Nnutthowze I tried what you suggested and it worked!
@Nnutthowze Thank you
CamperBot
@camperbot
Aug 29 2015 12:10
nick88p sends brownie points to @nnutthowze :sparkles: :thumbsup: :sparkles:
:star: 298 | @nnutthowze | http://www.freecodecamp.com/nnutthowze
Nnxoxo
@Nnxoxo
Aug 29 2015 12:10
@nick88p np
Nicholas
@nick88p
Aug 29 2015 12:10
So I understand. It didn't work because it made the ajax call once upon loading the DOM and then didn't renew it when the user changed F to C or vice versa?
Samuel Plumppu
@Greenheart
Aug 29 2015 12:11
@about @greenheart
Jose M Viloria
@josevill
Aug 29 2015 12:11
@moringasystem ok, so you want to know how to approach a solution? You gotta set those 3 variables: slotOne slotTwo and slotThree to a Math random function
Samuel Plumppu
@Greenheart
Aug 29 2015 12:11
about @greenheart
CamperBot
@camperbot
Aug 29 2015 12:11
:star: 296 | @greenheart | http://www.freecodecamp.com/greenheart
Jose M Viloria
@josevill
Aug 29 2015 12:11
@moringasystem they give you an example use of the math random function
Ashraful Islam
@ashraful-islam
Aug 29 2015 12:12
@josevill is it better to complete my ajax calls before $(document).ready(..) ?
Nnxoxo
@Nnxoxo
Aug 29 2015 12:12
@nick88p so the ajax calls started andwhen u click the button after that wasn't no ajax calls, beacause ajax is asynchronous
Ashraful Islam
@ashraful-islam
Aug 29 2015 12:12
I think it's convenient
Clearwood
@Clearwood
Aug 29 2015 12:12
can anyone help me with that one?
function mutation(arr) {
  var source = arr.slice(1,2);
  source = source.toString().split("");
  var target = arr.slice(0,1);
  target = target.toString().split("");
  var index = target.indexOf(source);
  if (index >= 0){
    return true;
  }
  else {
    return false;
  }

}

mutation(['hello', 'hey']);
Green
@moringasystem
Aug 29 2015 12:12
@josevill I thought so. Thanks for your help. I will do that now. I'll be right back.
CamperBot
@camperbot
Aug 29 2015 12:12
moringasystem sends brownie points to @josevill :sparkles: :thumbsup: :sparkles:
:star: 245 | @josevill | http://www.freecodecamp.com/josevill
Nnxoxo
@Nnxoxo
Aug 29 2015 12:12
@Clearwood what's the problem?
Nicholas
@nick88p
Aug 29 2015 12:12
@Nnutthowze Thanks man
CamperBot
@camperbot
Aug 29 2015 12:12
nick88p sends brownie points to @nnutthowze :sparkles: :thumbsup: :sparkles:
:warning: nick88p already gave nnutthowze points
Clearwood
@Clearwood
Aug 29 2015 12:13
@Nnutthowze for some reasons it won't work
Nnxoxo
@Nnxoxo
Aug 29 2015 12:13
@nick88p read about it in the NET
Clearwood
@Clearwood
Aug 29 2015 12:13
about @Nnutthowze
CamperBot
@camperbot
Aug 29 2015 12:13
:star: 298 | @nnutthowze | http://www.freecodecamp.com/nnutthowze
Nnxoxo
@Nnxoxo
Aug 29 2015 12:14
@Clearwood u need a loop to traverse over all characters in ur array
Ashraful Islam
@ashraful-islam
Aug 29 2015 12:16
about @ashraful-islam
CamperBot
@camperbot
Aug 29 2015 12:16
:warning: no user found for ashraful-islam
Ashraful Islam
@ashraful-islam
Aug 29 2015 12:16
:(
Green
@moringasystem
Aug 29 2015 12:16
@josevill Yes, that worked. I should have taken the risk of trying what i thought first before coming on here to ask questions. Trying Code doesn't kill anyone or anything. Thx mate
CamperBot
@camperbot
Aug 29 2015 12:16
moringasystem sends brownie points to @josevill :sparkles: :thumbsup: :sparkles:
:warning: moringasystem already gave josevill points
Clearwood
@Clearwood
Aug 29 2015 12:16
@Nnutthowze thx hope this will do it
CamperBot
@camperbot
Aug 29 2015 12:16
clearwood sends brownie points to @nnutthowze :sparkles: :thumbsup: :sparkles:
:star: 299 | @nnutthowze | http://www.freecodecamp.com/nnutthowze
Jose M Viloria
@josevill
Aug 29 2015 12:16
@moringasystem It's not like you're going to break the internet trying in a sandbox enviroment :p hehe
Nicholas
@nick88p
Aug 29 2015 12:18
@Nnutthowze I will. Thanks
CamperBot
@camperbot
Aug 29 2015 12:18
nick88p sends brownie points to @nnutthowze :sparkles: :thumbsup: :sparkles:
:warning: nick88p already gave nnutthowze points
Ashraful Islam
@iashraful
Aug 29 2015 12:20
nice!
my c9 almost blewup trying to install learnyoumongo
:)
Jose M Viloria
@josevill
Aug 29 2015 12:26
@iashraful Keep it up, lol !
Green
@moringasystem
Aug 29 2015 12:27
@josevill you're right. Anyway tell me what level are you on?
Jose M Viloria
@josevill
Aug 29 2015 12:28
@moringasystem I'm at 245, almost finishing Javascript's Basic Algorithms
Ashraful Islam
@iashraful
Aug 29 2015 12:29
@josevill thanks! :)
CamperBot
@camperbot
Aug 29 2015 12:29
iashraful sends brownie points to @josevill :sparkles: :thumbsup: :sparkles:
:star: 246 | @josevill | http://www.freecodecamp.com/josevill
Green
@moringasystem
Aug 29 2015 12:32
@josevill Not that far off. I think the points 245 is misleading. Because I have 242 points because i restarted FCC challenges after the update few days ago,and the points didn't restart from zero but kept adding on.
Jose M Viloria
@josevill
Aug 29 2015 12:36
@moringasystem Aight, i'm at Bonfire: Where art thou
Green
@moringasystem
Aug 29 2015 12:36
@josevill I am at Bonfire no. 2
@josevill Trying to reverse a string here...:)
Jose M Viloria
@josevill
Aug 29 2015 12:38
@moringasystem Cool, keep it up. They'll eventually get a lil tricky. But there's always a way, and you can even come up with a different approach from everyone else :)
Specially in Bonfire - Mutations, you'll see it :p A lot of people cheated in that one hehe
Ashraful Islam
@iashraful
Aug 29 2015 12:39
bonfire mutation
CamperBot
@camperbot
Aug 29 2015 12:39

:fire:Bonfire: Mutations :link:

function mutation(arr) {
  return arr;
}

mutation(['hello', 'hey']);

Return true if the string in the first element of the array contains all of the letters of the string in the second element of the array.

more info:  bf details | bf links | hint

Ashraful Islam
@iashraful
Aug 29 2015 12:39
think regexp is fine :)
nah, .each will be best candidate on this one :D
Green
@moringasystem
Aug 29 2015 12:41
@josevill I am sure it will get tricky. But cheating on Mutations bonfire. I dunno. I will definitely come up with something...lets soo what happens within a couple of mins from now...lol
Kelvin O
@kerukelw
Aug 29 2015 12:43
im in mutations too
Green
@moringasystem
Aug 29 2015 12:43
@josevill I think FCC is sooo easy. If i campare it to the tut+ and pluralsight video tutorials that i have. Without the NGO website practical components FCC won't be worth it.
Jose M Viloria
@josevill
Aug 29 2015 12:45
FCC is dope. The way they challenge you it's the best so far (at least for me)
I'll see how i go with the rest of the js challenges and then the Angular part.. In a couple weeks maybe, it's taking me forever to finish those challenges
Ashraful Islam
@iashraful
Aug 29 2015 12:48
@josevill my solution for mutation
function mutation(arr) {
  var main = arr[0];
  var test = arr[1].split('');

  return test.every(function(e){
      return (main.indexOf(e) > -1);
  })
}
Kelvin O
@kerukelw
Aug 29 2015 12:49
@iashraful hate to be a little off topic
Ashraful Islam
@iashraful
Aug 29 2015 12:49
ah, forgot to toLowerCase() there
Green
@moringasystem
Aug 29 2015 12:49
@josevill You mean the js bonfire challenges are taking you a while to finish? Well you need to supplement your learning on FCC with others. I can recommend these video tutorials from tutsplus.com 1. javascript fundamentals 2. javascript fundamentals advanced 3. javascript object oriented
Ashraful Islam
@iashraful
Aug 29 2015 12:49
@kerukelw how may I help? :smiley:
Kelvin O
@kerukelw
Aug 29 2015 12:49
@iashraful but i assume you did chunky monkey not too long agoright
@moringasystem well FCC never claimed to be a university. Teach the basics so you can go further with it
Ashraful Islam
@iashraful
Aug 29 2015 12:50
@kerukelw am doing mongodb :)
so technically it's pretty long
bonfire chunky
CamperBot
@camperbot
Aug 29 2015 12:50

:fire:Bonfire: Chunky Monkey :link:

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

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

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

more info:  bf details | bf links | hint

Green
@moringasystem
Aug 29 2015 12:50
@josevill I think youtube also has amazing hour length tutorials covering everything you need to know in javascript.
Kelvin O
@kerukelw
Aug 29 2015 12:50
my chunky monkey seems to be too long
function chunk(arr, size) {
  ;
  var arrayCounter = arr.length/size; 
  var chunkCounter = arr.length/size;  var i;var j; var curarr = []; newarr =[];
  arrayCounter = Math.floor(arrayCounter);
  var lastCounter = arr.length % size;
  if(lastCounter > 0){
        arrayCounter =  arrayCounter + 1;

    }
  var runcounter = 0;
  var turncounter =1;
  for(i=0; i<arrayCounter; i++){
    var countingcounter = runcounter+size;

    if((lastCounter > 0) && (i == arrayCounter-1)){

        countingcounter = arr.length;
    }

      for(j=runcounter;j<countingcounter ;j++){

          curarr.push(arr[j]);
      }

    runcounter = size + runcounter;
    newarr.push(curarr);
    curarr =[];


  }
  return newarr;

}

chunk([0,1,2,3,4], 2);
Ashraful Islam
@iashraful
Aug 29 2015 12:51
:open_mouth:
Kelvin O
@kerukelw
Aug 29 2015 12:51
not an expert in coding but just doing it the hard way :( have yet to think algorithmically .
Thanks for your mutations advice @iashraful
CamperBot
@camperbot
Aug 29 2015 12:51
kerukelw sends brownie points to @iashraful :sparkles: :thumbsup: :sparkles:
:star: 275 | @iashraful | http://www.freecodecamp.com/iashraful
Ashraful Islam
@iashraful
Aug 29 2015 12:53
@kerukelw let me try the chunky monkey
Green
@moringasystem
Aug 29 2015 12:54
@kerukelw You are right and I agree with you. But i enjoyed the old javascript tutorial from curated by FCC from udacity and the intro the computer science tutorial curated from harvard (and its in JS). Allthese went away after the update. Thats why i had to restart FCC a few days ago, so as to have a feel of the new curriculum and changes.
Kelvin O
@kerukelw
Aug 29 2015 12:56
@moringasystem agreed. yeah udacity was nice, i did lyndas OOP tutorial
last year
@moringasystem they trying their own built JS systems and relying less on external resources, I wish they could have have had an index of all the old links they used to use. Im pretty sure they put it there for a reason
Kelvin O
@kerukelw
Aug 29 2015 13:01
@iashraful your mutations is great but there are some requirements there were not met
Ashraful Islam
@iashraful
Aug 29 2015 13:03
bf chunky
CamperBot
@camperbot
Aug 29 2015 13:03

:fire:Bonfire: Chunky Monkey :link:

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

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

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

more info:  bf details | bf links | hint

Ashraful Islam
@iashraful
Aug 29 2015 13:03
bf details
CamperBot
@camperbot
Aug 29 2015 13:03

:fire:Bonfire: Chunky Monkey :link:

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

chunk(['a', 'b', 'c', 'd'], 2);
Write a function that splits an array (first argument) into groups the length of size (second argument) and returns them as a multidimensional array.
Remember to use RSAP if you get stuck. Try to pair program. Write your own code.
links:
Green
@moringasystem
Aug 29 2015 13:03
@kerukelw having an index of old resources for campers who want further learning would be great. Otherwise new campers would miss out on a lot being used as "lab rabbits" whole FCC build its own JS learning system from scratch.
Ashraful Islam
@iashraful
Aug 29 2015 13:03
err sorry
@kerukelw what requirements?
Ashraful Islam
@iashraful
Aug 29 2015 13:11
bf mutation
CamperBot
@camperbot
Aug 29 2015 13:11

:fire:Bonfire: Mutations :link:

function mutation(arr) {
  return arr;
}

mutation(['hello', 'hey']);

Return true if the string in the first element of the array contains all of the letters of the string in the second element of the array.

more info:  bf details | bf links | hint

Ashraful Islam
@iashraful
Aug 29 2015 13:13
@kerukelw oh, I see, here's the fixed version
// Mutation v0.0.1
function mutation(arr) {
  var main = arr[0].toLowerCase();
  var test = arr[1].toLowerCase().split('');

  return test.every(function(e){
      return (main.indexOf(e) > -1);
  })
}
passes all test :)
Ashraful Islam
@iashraful
Aug 29 2015 13:21
@kerukelw here is my lovely chunky monkey with some nice loopy soup
```
function chunk(arr, size) {
  // Break it up.
  var myArr = arr.slice(),
      counter = Math.ceil(arr.length/size);
      tmp_arr = [],
      md_arr = []; // multi-dimension array, final result
  while(counter) {

    if(tmp_arr.length < size && myArr.length) tmp_arr.push(myArr.shift());      
   else {
        counter--;
        md_arr.push(tmp_arr);
        tmp_arr = [];
    }
   }

  return md_arr;
}
ops!
correction
function chunk(arr, size) {
  // Break it up.
  var myArr = arr.slice(),
      counter = Math.ceil(arr.length/size),
      tmp_arr = [],
      md_arr = []; // multi-dimension array, final result


  while(counter) {
    if(tmp_arr.length < size && myArr.length) tmp_arr.push(myArr.shift());
    else {
        counter--;
        md_arr.push(tmp_arr);
        tmp_arr = [];
    }
  }
  return md_arr;
}
Aleksandar B.
@aleksandar-b
Aug 29 2015 13:28
Can someone help me. I am trying to code the search algorithm on Twitch zipline... But everytime i click on Offline and type mon it throws me the user that is online
Ashraful Islam
@iashraful
Aug 29 2015 13:28
@samosale codepen?
@iashraful it's on the botom $('.inputText').on('keyup', function(){
Soumya Rauth
@soumyaRauth
Aug 29 2015 13:32
anyone there?
Ashraful Islam
@iashraful
Aug 29 2015 13:32
@samosale looking at it
Soumya Rauth
@soumyaRauth
Aug 29 2015 13:33
Should I use an API for pomodoro zipline.
Ashraful Islam
@iashraful
Aug 29 2015 13:33
@soumyaRauth why do you need an API?
its just setTimeout/SetInterval :)
Soumya Rauth
@soumyaRauth
Aug 29 2015 13:34
@iashraful Ok.... Thats a great help.
thanks
CamperBot
@camperbot
Aug 29 2015 13:34
if you want to thank someone, put an @ before their name!
Ashraful Islam
@iashraful
Aug 29 2015 13:35
@samosale my head = blown :smiley:
Aleksandar B.
@aleksandar-b
Aug 29 2015 13:36
@iashraful it seems that if indexOf returns -1 it somehow start looking on another place, but where
@iashraful yes, i have complicated a lot, it have a lot of functions
Ashraful Islam
@iashraful
Aug 29 2015 13:36
@samosale what is this part doing?
if(flag == 0){
      $('.content').html(" ");
      filter = [];
      users.filter(function (user, index) {
      if(user.indexOf(val) == index){
        filter.push(user);
      }

    });
what is this == index?
John Sanchez
@john8801
Aug 29 2015 13:37
Is anyone able to assist me?
Aleksandar B.
@aleksandar-b
Aug 29 2015 13:37
strange, filter method should not be there, i deleted him
John Sanchez
@john8801
Aug 29 2015 13:38
I'm having bootstrap problemts
Aleksandar B.
@aleksandar-b
Aug 29 2015 13:38
@iashraful
@iashraful where did you find that line ?
Ashraful Islam
@iashraful
Aug 29 2015 13:39
I refreshed and now it changed to forEach :D
@samosale I think you are filtering the whole list
Aleksandar B.
@aleksandar-b
Aug 29 2015 13:41
@iashraful maybe i forgot to save.
Ashraful Islam
@iashraful
Aug 29 2015 13:41
try detecting which tab('users','online','offline') is active, then filter that array instead
:)
for example, if I'm in 'online' tab, only filter 'online_users' array
if am 'offline' tab, filter 'offline_users' array :)
problem solved
online_users is your streamers_online that is
:)
Aleksandar B.
@aleksandar-b
Aug 29 2015 13:43
it returns me the flag 0 even though i pressed Offline tab which is suposed to change the flag to 2
Ashraful Islam
@iashraful
Aug 29 2015 13:44
change the flag variable in your [user|online|offline] tab click events
:)
also, 'm','n','r' are your [user|online|offline] tab click events right?
Aleksandar B.
@aleksandar-b
Aug 29 2015 13:47
@iashraful the problem was that my fireAjax() has a flag set to 0
Ashraful Islam
@iashraful
Aug 29 2015 13:48
yes
your flag is stuck into 0, so only users is being used for search :)
Aleksandar B.
@aleksandar-b
Aug 29 2015 13:48
so i change it to a paramether in function
now it's ok
Samuel Plumppu
@Greenheart
Aug 29 2015 13:48
@john8801 hey are you still in need of help? : )
Aleksandar B.
@aleksandar-b
Aug 29 2015 13:49
@iashraful now i must figure it out how to search on backspace! tnx!
CamperBot
@camperbot
Aug 29 2015 13:49
samosale sends brownie points to @iashraful :sparkles: :thumbsup: :sparkles:
:star: 277 | @iashraful | http://www.freecodecamp.com/iashraful
Aleksandar B.
@aleksandar-b
Aug 29 2015 14:20
@iashraful something is wrong. it usually is ok, but when i click fast,then it somethimes throws me duplicates. Is it because of Ajax?
Abdelaziz Mokhnache
@Abdelaziz18003
Aug 29 2015 14:26
hey campers, how to tweet a quote in zipline 2 : Random quote machine
Clayton
@cjg040103
Aug 29 2015 14:42
anyone know whats wrong with this? i'm working on a school project and i'm trying to create a survey. only problem ins that when u click the button it should write yes or no depending on the button u click, but nothing happens! also, how do i make it have the class btn-primary/danger? is not doing that either.
Abdelaziz Mokhnache
@Abdelaziz18003
Aug 29 2015 14:48
hi @cjg040103 .. to style you buttons, don't link to bootstrap int the head section but go to settings > css > quick add .. and add bootstrap then press close
Vanja Valent
@walent021
Aug 29 2015 14:49
Hey. can i pop my whole palindrome code here for a question?
Clayton
@cjg040103
Aug 29 2015 14:50
@Abdelaziz18003 k thx!
CamperBot
@camperbot
Aug 29 2015 14:50
cjg040103 sends brownie points to @abdelaziz18003 :sparkles: :thumbsup: :sparkles:
Abdelaziz Mokhnache
@Abdelaziz18003
Aug 29 2015 14:50
yes you can @walent021
CamperBot
@camperbot
Aug 29 2015 14:50
:star: 209 | @abdelaziz18003 | http://www.freecodecamp.com/abdelaziz18003
Vanja Valent
@walent021
Aug 29 2015 14:51
function palindrome(str) {

  str.toLowerCase();
  var str1 = str.replace(/[.,-\/#!$%\^&\*;:{}=\-_`~()]/g,"")
  str1 = str.replace(/ /g,"")

  var str2 = str1.split('');
  str2.reverse();
  var str3 = str2.join('');
  if (str1 === str3) {

  return true;
  }
  else {
    return false;
  }
}



palindrome("eye");
Every waypoint is ok except the "palindrome("A man, a plan, a canal. Panama"), true);expected false to deeply equal true"
Abdelaziz Mokhnache
@Abdelaziz18003
Aug 29 2015 14:51
you are welcome @cjg040103
Cristián Berríos
@crisberrios
Aug 29 2015 14:56
@walent021 there are shortcuts for regex like \W for non alphanumeric characters
the logic is not wrong
Clayton
@cjg040103
Aug 29 2015 14:59
i got it figured out!
Cristián Berríos
@crisberrios
Aug 29 2015 15:00
but you 'd like to call the temp array "arr" since str2 is misleading, or just don't use it as you can chain the split, reverse and join methods
Vanja Valent
@walent021
Aug 29 2015 15:00
@crisberrios like \W instead all of the #"$!%()?
yeah i tried some chaining but kinda didn't work
Cristián Berríos
@crisberrios
Aug 29 2015 15:00
@walent021 yes but it has some caveats so you might want to read what \W targets first
Vanja Valent
@walent021
Aug 29 2015 15:01
still not sure why everything else works just that one sentence
there's a "," there and not in the other checkpoints
Abdelaziz Mokhnache
@Abdelaziz18003
Aug 29 2015 15:06
@walent021 your problem may be in the letter case "toLowerCase" return a new new string and don't effect the original
@walent021 this is your code with some modifications :smile:
function palindrome(str) { str1 = str.toLowerCase(); var str1 = str1.replace(/[.,-\/#!$%\^&\*;:{}=\-_`~() ]/g,""); var str2 = str1.split('').reverse().join(''); if (str1 === str2) { return true; } else { return false; } }
Vanja Valent
@walent021
Aug 29 2015 15:14
i see now @Abdelaziz18003 thank you so much
CamperBot
@camperbot
Aug 29 2015 15:14
walent021 sends brownie points to @abdelaziz18003 :sparkles: :thumbsup: :sparkles:
:star: 210 | @abdelaziz18003 | http://www.freecodecamp.com/abdelaziz18003
Vanja Valent
@walent021
Aug 29 2015 15:14
i'll try it from scratch again
Abdelaziz Mokhnache
@Abdelaziz18003
Aug 29 2015 15:15
you are welcome @walent021 .. good luck
Ammar Ali Shah
@AmmarAliShah
Aug 29 2015 15:25
Need help...
Kelvin O
@kerukelw
Aug 29 2015 15:27
@iashraful just saw your codes
looking nice!
Danny Fritz
@dannyfritz
Aug 29 2015 15:37
bg friendly
bf friendly
CamperBot
@camperbot
Aug 29 2015 15:37

:fire:Bonfire: Friendly Date Ranges :link:

function friendly(str) {
  return str;
}

friendly(['2015-07-01', '2015-07-04']);

Implement a way of converting two dates into a more friendly date range that could be presented to a user.

more info:  bf details | bf links | hint

Danny Fritz
@dannyfritz
Aug 29 2015 15:38
bf details
CamperBot
@camperbot
Aug 29 2015 15:38

:fire:Bonfire: Friendly Date Ranges :link:

function friendly(str) {
  return str;
}

friendly(['2015-07-01', '2015-07-04']);
Implement a way of converting two dates into a more friendly date range that could be presented to a user.
It must not show any redundant information in the date range.
For example, if the year and month are the same then only the day range should be displayed.
Secondly, if the starting year is the current year, and the ending year can be inferred by the reader, the year should be omitted.
Input date is formatted as YYYY-MM-DD
Remember to use <a href='//github.com/FreeCodeCamp/freecodecamp/wiki/How-to-get-help-when-you-get-stuck' target='_blank'>RSAP</a> if you get stuck. Try to pair program. Write your own code.
links:
Danny Fritz
@dannyfritz
Aug 29 2015 15:38
bf hint