These are chat archives for FreeCodeCamp/Help

7th
Nov 2015
jpjenkins
@jpjenkins
Nov 07 2015 00:02
function destroyer(arr) {
  // Remove all the values (2 & 3)
  var newArr = [];
  for(i = 1; i < arguments.length; i++){
    newArr.push(arguments[i]);
  } // pushes the values of the arguments into an array.

arr = arr.filter(function(val){
  if(

}); // end map function.
return arr;

}
destroyer([1, 2, 3, 1, 2, 3], 2, 3);
if someone could help me with this I'd really appreciate it, I'm at what should be an easy bit but for some reason my brain isn't processing it.
bonfre seek and destroy
Bonfire: Seek and Destroy
CamperBot
@camperbot
Nov 07 2015 00:03

:fire:Bonfire: Seek and Destroy :link:

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

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

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

more info:  bf details | bf links | hint

jpjenkins
@jpjenkins
Nov 07 2015 00:03
if 'val != what's in newArr
return val
can someone push me in the right direction please, am I missing something here?
jpjenkins
@jpjenkins
Nov 07 2015 00:20
I DID IT!
My word I feel like a moron, so many functions to wrap my brain around.
m-farooqui
@m-farooqui
Nov 07 2015 00:22

var ourArray = ["Stimpson", "J", ["cat"]];

removedFromOurArray = ourArray.shift(); // removedFromOurArray now equals "Stimpson" and ourArray now equals ["J", ["cat"]].

var myArray = [23, ["dog", 3]];

// Only change code below this line.

var removedFromMyArray;
removedFromMyArray=myArray.shift()
// Only change code above this line.

(function(y, z){return 'myArray = ' + JSON.stringify(y) + ' & removedFromMyArray = ' + JSON.stringify(z);})(myArray, removedFromMyArray);

hi this is my code and i am in waypoint 141
i am havingtrouble with the .shift function
jpjenkins
@jpjenkins
Nov 07 2015 00:22
what waypoint is that?
They're not listed numerically like that
the '141' in the corner is how many points you have
m-farooqui
@m-farooqui
Nov 07 2015 00:24
waypoint 23 in basic java script
jpjenkins
@jpjenkins
Nov 07 2015 00:25
it may be that it doesn't like non spaces
the code is correct
though you have missed a semicolon at the end
also, you don't have to do 2 lines:
var removedFromMyArray = myArray.shift();
practically, what you wrote is acceptable, just not in freecodecamp's editor
Jan Dvorak
@hohnzy
Nov 07 2015 00:27
/help
CamperBot
@camperbot
Nov 07 2015 00:27

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

Jan Dvorak
@hohnzy
Nov 07 2015 00:27
This message was deleted
jpjenkins
@jpjenkins
Nov 07 2015 00:28
@m-farooqui success?
Jan Dvorak
@hohnzy
Nov 07 2015 00:34
can anyone help me with palindrome bonfire?
CamperBot
@camperbot
Nov 07 2015 00:34
type bonfire name to get some info on that bonfire. And check HelpBonfires chatroom
jpjenkins
@jpjenkins
Nov 07 2015 00:34
sure
Jan Dvorak
@hohnzy
Nov 07 2015 00:34
why is this not working?
function palindrome(str) {
// Good luck!
var malaPismena = str.toLowerCase();
var bezMezer = malaPismena.replace(/\s/g, "");
var bezCarek = bezMezer.replace(/,/g, "");
var pole = bezCarek.split("");
var obracenePole = pole.reverse();
var opetString = obracenePole.join("");
if (pole === obracenePole) {
return true;
}
else {
return false;
}
}
jpjenkins
@jpjenkins
Nov 07 2015 00:34
wiki code
CamperBot
@camperbot
Nov 07 2015 00:34

:point_right: -----

undefined
:pencil: -----
jpjenkins
@jpjenkins
Nov 07 2015 00:35
if you enclose your code in back quotes that'd be easier
``` <--- top and bottom
Jan Dvorak
@hohnzy
Nov 07 2015 00:36
function palindrome(str) {
  // Good luck!
  var malaPismena = str.toLowerCase();
  var bezMezer = malaPismena.replace(/\s/g, "");
  var bezCarek = bezMezer.replace(/,/g, "");
  var pole = bezCarek.split("");
  var obracenePole = pole.reverse();
  var opetString = obracenePole.join("");
  if (pole === obracenePole) {
    return true;
  } 
  else {
    return false;
  }
}
jpjenkins
@jpjenkins
Nov 07 2015 00:37
your variables are mightily confusing
Jan Dvorak
@hohnzy
Nov 07 2015 00:37
yea they czech :/
jpjenkins
@jpjenkins
Nov 07 2015 00:37
.splt().toLowerCase().join();
that should really be all that's needed
one line, 3 functions
Rory Smith
@alanbuchanan
Nov 07 2015 00:38
@hohnzy you are comparing an array (pole) to a string (obracenePole)
jpjenkins
@jpjenkins
Nov 07 2015 00:38
or join lower case split actually
@alanbuchanan that's the least of his problems at the moment no?
Jan Dvorak
@hohnzy
Nov 07 2015 00:39
.reverse make string from array?
Rory Smith
@alanbuchanan
Nov 07 2015 00:39
@hohnzy no, join("") turns an array into a string
jpjenkins
@jpjenkins
Nov 07 2015 00:39
look at it logically
Jan Dvorak
@hohnzy
Nov 07 2015 00:39
my problem is that if i document.write pole and obracenePole they are same
jpjenkins
@jpjenkins
Nov 07 2015 00:39
the line of functions
forget about that for now hohnzy, sorry. Focus on your functions, you're going to make it impossible if you write all your functions out like that
later on anyway
so
if we took one
newArray = str.split('').toLowerCase('').join('');
it would split it... then lowercase it... then join it back together
they work one after the other, it's a beautiful thing
Rory Smith
@alanbuchanan
Nov 07 2015 00:42
@hohnzy sorry, i was wrong, you are comparing two arrays
if you chain the methods as he said ^ you will find it easier
jpjenkins
@jpjenkins
Nov 07 2015 00:42
@hohnzy are you following?
Jan Dvorak
@hohnzy
Nov 07 2015 00:43
yea i was trying but it wasnt working so I wanted to print on screen every step
Rory Smith
@alanbuchanan
Nov 07 2015 00:43
although toLowerCase() shouldn't really have an argument passed into it
jpjenkins
@jpjenkins
Nov 07 2015 00:43
true that
Jan Dvorak
@hohnzy
Nov 07 2015 00:43
@jpjenkins yea i got it
jpjenkins
@jpjenkins
Nov 07 2015 00:44
just an example just now, it's not really possible to help when you have to decipher multiple czech
variables
:)
keep working on it, experiment with the different arrangements of functions
Rory Smith
@alanbuchanan
Nov 07 2015 00:44
@hohnzy you are nearly there though
jpjenkins
@jpjenkins
Nov 07 2015 00:45
www.repl.it - this is good to test your javascript too when you're trying to work on something and need feedback instead of the console inside your browser
Rory Smith
@alanbuchanan
Nov 07 2015 00:46
Screen Shot 2015-11-07 at 00.45.49.png
chrome dev tools may be useful too ^
Jan Dvorak
@hohnzy
Nov 07 2015 00:49
well i just dont get why ''pole'' and ''obracenePole'' are the same
if not a palindrome
im using codepen and document.write function
brb
Rory Smith
@alanbuchanan
Nov 07 2015 00:52

@hohnzy try

var reversedStr = bezCarek.split("").reverse().join("");

and then compare it to the str

jpjenkins
@jpjenkins
Nov 07 2015 00:55
lowercase...
Rory Smith
@alanbuchanan
Nov 07 2015 00:55
he's done it on a previous line in his code
Jan Dvorak
@hohnzy
Nov 07 2015 01:00
function palindrome(str) {
  // Good luck!
  var lowerCase = str.toLowerCase();
  var withoutSpaces = lowerCase.replace(/\s/g, "");
  var withoutCommas = withoutSpaces.replace(/,/g, "");
  var reversedStr = withoutCommas.split("").reverse().join("");
  //var toArray = withoutCommas.split("");
  //var reversedArray = toArray.reverse();
  //var stringAgain = reversedArray.join("");
  if (withoutCommas === reversedStr) {
    return true;
  } 
  else {
    return false;
  }
}
like this? I changed variables to english
Rory Smith
@alanbuchanan
Nov 07 2015 01:02
does it pass all the test cases?
Jan Dvorak
@hohnzy
Nov 07 2015 01:03
no
Rory Smith
@alanbuchanan
Nov 07 2015 01:04
well check the ones it is failing on and try to adjust your regex accordingly
Jan Dvorak
@hohnzy
Nov 07 2015 01:05
yea i see the dots are still there now
but dunno why \ is removed...
Rory Smith
@alanbuchanan
Nov 07 2015 01:08
are you referring to the last test case
Jan Dvorak
@hohnzy
Nov 07 2015 01:08
yes
Rory Smith
@alanbuchanan
Nov 07 2015 01:09
ok, here's a clue: it's got nothing to do with the \
Jan Dvorak
@hohnzy
Nov 07 2015 01:11
I think i see it, gimme a sec
ok i have all tests passed except the last one
lol
Rory Smith
@alanbuchanan
Nov 07 2015 01:15
good, keep going :)
it is tricky
Jan Dvorak
@hohnzy
Nov 07 2015 01:18
i dont know hot to get rid off _
Rory Smith
@alanbuchanan
Nov 07 2015 01:19
you know how to get rid of the other things though...
Jan Dvorak
@hohnzy
Nov 07 2015 01:20
/W+/g
Anders Bengtsson
@anders462
Nov 07 2015 01:24
Just checking, starting the camper news zipline. Given info >> >Hint: Here's the Camper News Hot Stories API endpoint: (http://www.freecodecamp.com/news/hot) <<< I assume that this raw json is all there is in form of "documentation"?
Jan Dvorak
@hohnzy
Nov 07 2015 01:28
OK I got it. thanks @alanbuchanan and @jpjenkins
CamperBot
@camperbot
Nov 07 2015 01:28
hohnzy sends brownie points to @alanbuchanan and @jpjenkins :sparkles: :thumbsup: :sparkles:
:star: 490 | @alanbuchanan | http://www.freecodecamp.com/alanbuchanan
:star: 211 | @jpjenkins | http://www.freecodecamp.com/jpjenkins
Rory Smith
@alanbuchanan
Nov 07 2015 01:28
@hohnzy nice :thumbsup:
Johnathon Sykes
@seesykescode
Nov 07 2015 01:29

Need a bit of help here. On Waypoint 176: Iterate oer Arrays with map.

This feels right to me and if I use Atom + Node.js to run the same script, it seems to work, however the waypoint won't pass. Am I missing the point here?

var oldArray = [1,2,3,4,5];

// Only change code below this line.


var newArray = oldArray;

var timesThree = newArray.map(function(val){
  return val * 3;
});


// Only change code above this line.

(function() {return newArray;})();
jpjenkins
@jpjenkins
Nov 07 2015 01:29
you're returning the new value to times three
Rory Smith
@alanbuchanan
Nov 07 2015 01:30

@hohnzy in the future, for your last statement:

  if (a === b) {
    return true;
  } else {
    return false;
  }

instead of this, you can simply say:

return a === b;

and it will give the same result

jpjenkins
@jpjenkins
Nov 07 2015 01:30
oldArray = oldArray.map should suffice
Jan Dvorak
@hohnzy
Nov 07 2015 01:30
ahh good to know
uff I can go sleep finally :) gnite all
kelvintantono
@kelvintantono
Nov 07 2015 01:34
morning :)
anyone ?
Hans van Riet
@hansinla
Nov 07 2015 01:34
@hohnzy Except you need to do newArray = newArray etc, because the test looks for newArray.
Johnathon Sykes
@seesykescode
Nov 07 2015 01:34
ahhhh
kelvintantono
@kelvintantono
Nov 07 2015 01:35
hi guys, got a problem on Object Oriented and Functional Programming waypoint 9

the instruction: You can use the reverse method to reverse the elements of an array.

reverse is another array method that alters the array in place, but it also returns the reversed array.

Add a line of code that uses reverse to reverse the array variable.

my code:

var array = [1,2,3,4,5,6,7];

// Only change code below this line.

newarray = array.reverse(array);

// Only change code above this line.

(function() {return array;})();

help anyone?
CamperBot
@camperbot
Nov 07 2015 01:35
no wiki entry for: anyone
:pencil: click here to create one now!after creating your page type update to reload it here
kelvintantono
@kelvintantono
Nov 07 2015 01:35
:)
Johnathon Sykes
@seesykescode
Nov 07 2015 01:37
Thanks @hansinla that's exactly what it was. Also, it said add, not multiple. Derp.
CamperBot
@camperbot
Nov 07 2015 01:37
johndsykes86 sends brownie points to @hansinla :sparkles: :thumbsup: :sparkles:
:star: 571 | @hansinla | http://www.freecodecamp.com/hansinla
kelvintantono
@kelvintantono
Nov 07 2015 01:37
'''
CamperBot
@camperbot
Nov 07 2015 01:37
:bulb: to format code use backticks! ``` more info
Johnathon Sykes
@seesykescode
Nov 07 2015 01:37
also thanks to you too @jpjenkins
CamperBot
@camperbot
Nov 07 2015 01:37
johndsykes86 sends brownie points to @jpjenkins :sparkles: :thumbsup: :sparkles:
:star: 212 | @jpjenkins | http://www.freecodecamp.com/jpjenkins
kelvintantono
@kelvintantono
Nov 07 2015 01:38

'''
var array = [1,2,3,4,5,6,7];

// Only change code below this line.

newarray = array.reverse(array);

// Only change code above this line.

(function() {return array;})();

CamperBot
@camperbot
Nov 07 2015 01:38
:bulb: to format code use backticks! ``` more info
Johnathon Sykes
@seesykescode
Nov 07 2015 01:38
@kelvintantono use the tilde key instead
jpjenkins
@jpjenkins
Nov 07 2015 01:38
any time :)
kelvintantono
@kelvintantono
Nov 07 2015 01:38
```
jpjenkins
@jpjenkins
Nov 07 2015 01:38
except in the next few hours, when I sleep... good night!
kelvintantono
@kelvintantono
Nov 07 2015 01:38
var array = [1,2,3,4,5,6,7];

// Only change code below this line.

newarray = array.reverse(array);

// Only change code above this line.

(function() {return array;})();
Johnathon Sykes
@seesykescode
Nov 07 2015 01:38
boom
kelvintantono
@kelvintantono
Nov 07 2015 01:38
alraight
so, can you help me please @johndsykes86
Johnathon Sykes
@seesykescode
Nov 07 2015 01:39
I can give it a shot.
kelvintantono
@kelvintantono
Nov 07 2015 01:39
yeayyy :clap:
@johndsykes86 john??
Johnathon Sykes
@seesykescode
Nov 07 2015 01:41
yep here, sorry. sneezing all over the place
kelvintantono
@kelvintantono
Nov 07 2015 01:42
:smile:
Johnathon Sykes
@seesykescode
Nov 07 2015 01:42
take out the (array) should read
newArray = array.reverse()
kelvintantono
@kelvintantono
Nov 07 2015 01:42
aha. will try. wait a second
Johnathon Sykes
@seesykescode
Nov 07 2015 01:42
you're adding an argument to .reverse when it doesn't really need one.
will do, im about to hit that lesson actually lol
kelvintantono
@kelvintantono
Nov 07 2015 01:43
hooyahhh thank you @johndsykes86
CamperBot
@camperbot
Nov 07 2015 01:43
kelvintantono sends brownie points to @johndsykes86 :sparkles: :thumbsup: :sparkles:
:star: 177 | @johndsykes86 | http://www.freecodecamp.com/johndsykes86
Johnathon Sykes
@seesykescode
Nov 07 2015 01:44
any time :)
Hans van Riet
@hansinla
Nov 07 2015 01:44
@kelvintantono the test looks for array not for new array, so you need to assign the changed array to array.
Elliott McNary
@bighitbiker3
Nov 07 2015 01:44
Anyone have any good documentation on how to implement APIs? I'm on the Random quote zipline and am so incredibly lost
Johnathon Sykes
@seesykescode
Nov 07 2015 01:44
^^ this too, but it seemed to pass anyway.
kelvintantono
@kelvintantono
Nov 07 2015 01:44
@hansinla thank you . looks like you suggestion work too :)
CamperBot
@camperbot
Nov 07 2015 01:44
kelvintantono sends brownie points to @hansinla :sparkles: :thumbsup: :sparkles:
:star: 572 | @hansinla | http://www.freecodecamp.com/hansinla
DJ
@qualitymanifest
Nov 07 2015 01:49
@bighitbiker3 i struggled a lot with that. they've since added this http://www.freecodecamp.com/map#json-apis-and-ajax
i haven't checked it out yet but i imagine it should be good help
Elliott McNary
@bighitbiker3
Nov 07 2015 01:50
@qualitymanifest thanks so much...i'll give it a shot!
CamperBot
@camperbot
Nov 07 2015 01:50
bighitbiker3 sends brownie points to @qualitymanifest :sparkles: :thumbsup: :sparkles:
:star: 339 | @qualitymanifest | http://www.freecodecamp.com/qualitymanifest
MACELON LIMA
@macelonlima
Nov 07 2015 01:58
hello
I do not understand
the purpose of the site
Can anyone help me
MirkaG
@MirkaG
Nov 07 2015 02:02
@macelonlima Hi, this site is for getting help when you get stuck on your modules
Speaking of help, I need some. Can anyone explain the .remove jQuery to me? I need to remove #target4 using jQuery. I put in the code but am unsure what I should write inside the () after .remove
anyone out there?
ronaldrdguez
@ronaldrdguez
Nov 07 2015 02:07
@MirkaG nothing, .remove takes no arguments
@MirkaG oh nvm
MirkaG
@MirkaG
Nov 07 2015 02:07
@ronaldrdguez I tried that. it didn't work :'(
ronaldrdguez
@ronaldrdguez
Nov 07 2015 02:08
@MirkaG it takes an optional selector as a parameter check here http://api.jquery.com/remove/
MirkaG
@MirkaG
Nov 07 2015 02:09
@ronaldrdguez Thank you! looks like I left out the #when I wrote it out. That's why it didn't work
CamperBot
@camperbot
Nov 07 2015 02:09
mirkag sends brownie points to @ronaldrdguez :sparkles: :thumbsup: :sparkles:
:star: 364 | @ronaldrdguez | http://www.freecodecamp.com/ronaldrdguez
MACELON LIMA
@macelonlima
Nov 07 2015 02:10
ok @ronaldrdguuez Thank you
CamperBot
@camperbot
Nov 07 2015 02:10
macelonlima sends brownie points to @ronaldrdguuez :sparkles: :thumbsup: :sparkles:
:warning: could not find receiver for ronaldrdguuez
li ang
@LALH
Nov 07 2015 02:25
"You should use the reverse method."
how?
array.reverse(function(a,b){
return b - a;
});
is wrong?
but the result i think is right
Jeremy Roe
@jeremyroe
Nov 07 2015 02:28
@DBZDXW I dont think you need the function - It woudl be just array.reverse(); - see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/reverse
I dont have the full details of the challenge though in front mof me
li ang
@LALH
Nov 07 2015 02:29
thank you
CamperBot
@camperbot
Nov 07 2015 02:29
if you want to thank someone, put an @ before their name!
cherielum
@cherielum
Nov 07 2015 02:51
This is silly by I don't know how to run the "Kitty Ipsum text." What does it mean to "replace the text inside your P element?
"Replace the text inside your p element with the first few words of this kitty ipsum 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."
ilovecode3434
@ilovecode3434
Nov 07 2015 02:55
I am stuck on this challenge. Does anybody have a fix to this
<form action="/submit-cat-photo">
<h2 id="cat-photo-app">CatPhotoApp</h2>
<label><input type="radio" name="indoor-outdoor" checked> Indoor</label>
<label><input type="radio" name="indoor-outdoor"> Outdoor</label>
<label><input type="checkbox" name="personality" checked> Loving</label>
<label><input type="checkbox" name="personality"> Lazy</label>
<label><input type="checkbox" name="personality"> Energetic</label>
<input type="text" placeholder="cat photo URL" required>
<button type="submit">Submit</button>
</form>
cherielum
@cherielum
Nov 07 2015 02:56
hey ilovecode3434 you're ahead of me so I cannot help you, but could you help me out? haha >_M
ilovecode3434
@ilovecode3434
Nov 07 2015 03:01
lol but do you need help with
you need to just take parts from it and place it in your p element like this
<p>Kitty ipsum dolor sit amet, shed everywhere shed everywhere stretching attack</p>
Jeremy Roe
@jeremyroe
Nov 07 2015 03:10
@ilovecode3434 what are you stuck on?
Yemi
@yemovii
Nov 07 2015 03:23
I need help... To get started, we should nest all of our HTML in a div element with the class container-fluid.

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

<p>Click here for <a href="#">cat photos</a>.</p>

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

<p>Things cats love:</p>

<ul>
<li>cat nip</li>
<li>laser pointers</li>
<li>lasagna</li>
</ul>

<p>Top 3 things cats hate:</p>

<ol>
<li>flea treatment</li>
<li>thunder</li>
<li>other cats</li>
</ol>

<form action="/submit-cat-photo">
<label><input type="radio" name="indoor-outdoor"> Indoor</label>
<label><input type="radio" name="indoor-outdoor"> Outdoor</label>
<label><input type="checkbox" name="personality"> Loving</label>
<label><input type="checkbox" name="personality"> Lazy</label>
<label><input type="checkbox" name="personality"> Crazy</label>
<input type="text" placeholder="cat photo URL" required>
<button type="submit">Submit</button>
</form>

How to do it?
Kevin Dessely
@kevindessely
Nov 07 2015 03:29
put all those code ...

like the following

<div class="contrainer-fluid">
...
</div>

@yemovii
<div class="container-fluid">
<h2 class="red-text">CatPhotoApp</h2>
<p>Click here for <a href="#">cat photos</a>.</p>
<a href="#"><img class="smaller-image thick-green-border" src="https://bit.ly/fcc-relaxing-cat"></a>
<p>Things cats love:</p>
<ul>
<li>cat nip</li>
<li>laser pointers</li>
<li>lasagna</li>
</ul>
<p>Top 3 things cats hate:</p>
<ol>
<li>flea treatment</li>
<li>thunder</li>
<li>other cats</li>
</ol>
<form action="/submit-cat-photo">
<label><input type="radio" name="indoor-outdoor"> Indoor</label>
<label><input type="radio" name="indoor-outdoor"> Outdoor</label>
<label><input type="checkbox" name="personality"> Loving</label>
<label><input type="checkbox" name="personality"> Lazy</label>
<label><input type="checkbox" name="personality"> Crazy</label>
<input type="text" placeholder="cat photo URL" required>
<button type="submit">Submit</button>
</form>
</div>
Yemi
@yemovii
Nov 07 2015 03:33
@ouphana I get it now. thanks
CamperBot
@camperbot
Nov 07 2015 03:33
yemovii sends brownie points to @ouphana :sparkles: :thumbsup: :sparkles:
:star: 6 | @ouphana | http://www.freecodecamp.com/ouphana
Elliott McNary
@bighitbiker3
Nov 07 2015 03:37
how can I convert this to an array: http://api.icndb.com/jokes.json...my current code looks like but it's spitting out all jokes. My idea was to convert to an array so i can randomize the array and then choose one specific output in the map function...is that a good idea?
http://codepen.io/bighitbiker3/pen/NGOxbj
D/S
@dantesolis
Nov 07 2015 03:43
Hey peeps good morning
can someone help me with the truncate a string challenge>
?
here is my code:
function truncate(str, num) {
  // Clear out that junk in your trunk
  if (str.length <= num) {
    return str;
  } else if (num <= 3) {
    return str.substr(0,num) + '...';
  } else {
    return 'cannot truncate str';
  }
}

truncate("A-tisket a-tasket A green and yellow basket", 11);
Andrés
@am3lla
Nov 07 2015 03:47
bighitbiker3 html += "<p>" + json.value[0].joke + "</p>";
h4r1m4u
@h4r1m4u
Nov 07 2015 03:48
@dantesolis why strings that are longer than num cannot be truncated?
D/S
@dantesolis
Nov 07 2015 03:49
@h4r1m4u I get 3 of my tests to pass except the first two
Jeremy Roe
@jeremyroe
Nov 07 2015 03:50
@dantesolis This one threw me for a loop on the … logic - I don’t remember exaactly where it fell apart though. Does it pass any of your tests?
D/S
@dantesolis
Nov 07 2015 03:50
truncate("A-tisket a-tasket A green and yellow basket", 11) should return "A-tisket...".
truncate("Peter Piper picked a peck of pickled peppers", 14) should return "Peter Piper…"
Jeremy Roe
@jeremyroe
Nov 07 2015 03:51
Have you tried some console.log to see what it is returning?
Elliott McNary
@bighitbiker3
Nov 07 2015 03:52
@am3lla that worked to show that specific number [0], but it shows it 500 times (the amount of jokes that are in the JSON api). Any tips?
D/S
@dantesolis
Nov 07 2015 03:52
@jeremyroe I tried, put it somewhere, but I’m also having trouble understanding where to put the console.log. Should I put it outside my the if conditional?
Jeremy Roe
@jeremyroe
Nov 07 2015 03:52
I woudl put it right before any returns
so if you have a “return substring…” right before do a console.log(substring…);
then view it in your developer console
h4r1m4u
@h4r1m4u
Nov 07 2015 03:53
@dantesolis i understand. i'm giving you a hint. why, according to your code, str longer than num cannot be truncated? does that make sense?
Jeremy Roe
@jeremyroe
Nov 07 2015 03:53
it looks like you’ve got the basics down it’s just a matter of tinkering to make the output meet the test requriements - I remember fighting it for a good 30-45 minutes to make it work for all tests
Andrés
@am3lla
Nov 07 2015 03:54

$.getJSON("http://api.icndb.com/jokes.json", function(json) {

    var html = "";               
      html += "<div class = 'joke'>";
      // Only change code below this line.
      html += "<p>" + json.value[0].joke + "</p>";
      // Only change code above this line.
      html += "</div>";

     $(".message").html(html);

D/S
@dantesolis
Nov 07 2015 03:54
function truncate(str, num) {
  // Clear out that junk in your trunk
  if (str.length <= num) {
    console.log(str);
    return str;
  } else if (num <= 3) {
    return str.substr(0,num) + '...';
  } else {
    return 'cannot truncate str';
  }
}

truncate("A-tisket a-tasket A green and yellow basket", 11);
"cannot truncate str”
Jeremy Roe
@jeremyroe
Nov 07 2015 03:55
@dantesolis return dumps out of the program so it needs to go before your return statement
and it won’t display in the web UI only in the console
Kevin Dessely
@kevindessely
Nov 07 2015 03:56
@bighitbiker3
@bighitbiker3
i have update ur codepen with the right soln
Elliott McNary
@bighitbiker3
Nov 07 2015 03:57
@am3lla that's the code I currently have..
Andrés
@am3lla
Nov 07 2015 03:57
mm let me change it
D/S
@dantesolis
Nov 07 2015 03:58
@jeremyroe updated the code with the console.log but still can’t get anything to display (using google chrome console)
Andrés
@am3lla
Nov 07 2015 03:59
sorry i am new so just check the changes

$(document).ready(function() {

$("#getMessage").on("click", function() {

  $.getJSON("http://api.icndb.com/jokes.json", function(json) {
var html = "";
html += "<div class = 'joke'>";
// Only change code below this line.
html += "<p>" + json.value[0].joke + "</p>";
// Only change code above this line.
html += "</div>";
     $(".message").html(html);
});
});
});

Jeremy Roe
@jeremyroe
Nov 07 2015 03:59
@dantesolis hmm not even an undefined? It will of course only console.log when it hits the logic in the if then statement . . .
can you post current code?
Elliott McNary
@bighitbiker3
Nov 07 2015 04:00
@ouphana thank you...i'm studying it right now to understand what you did :)
CamperBot
@camperbot
Nov 07 2015 04:00
bighitbiker3 sends brownie points to @ouphana :sparkles: :thumbsup: :sparkles:
:star: 8 | @ouphana | http://www.freecodecamp.com/ouphana
D/S
@dantesolis
Nov 07 2015 04:01
@jeremyroe Here is my updated code
function truncate(str, num) {
  // Clear out that junk in your trunk
  if (str.length <= num) {
    console.log(str);
    return str;
  } else if (num <= 3) {
    return str.substr(0,num) + '...';
  } else {
    return 'cannot truncate str';
  }
}

truncate("A-tisket a-tasket A green and yellow basket", 11);
"cannot truncate str”
Jeremy Roe
@jeremyroe
Nov 07 2015 04:02
@dantesolis so whats happening is its checking if the string is shorter or equal to 11 which it isn’t - then checking if it’s shorter or equal to 3 which it isn’t then falling into the else section - because of this its never hitting your console.log
Theo Martin
@theosdesigns
Nov 07 2015 04:03
hi im checking the length of the string variable
here is my code

var firstNameLength = 0;
var firstName = "Ada";

firstNameLength = firstName.length;

var lastName = "Lovelace";

// Only change code below this line.
var lastNameLength = 8;
lastNameLength = lastName.length;

// Only change code above this line.

if(typeof(lastNameLength) !== "undefined"){(function(){return lastNameLength;})();}

i think i have it but i still get an error
Jeremy Roe
@jeremyroe
Nov 07 2015 04:05
@theosdesigns your variables will never be undefined because you are giving them a value when you instantiate them - whats the error?
D/S
@dantesolis
Nov 07 2015 04:05
@jeremyroe thank you. I still not geting it. Let me drink some coffee and wake up to see if I can get this too pass
CamperBot
@camperbot
Nov 07 2015 04:05
dantesolis sends brownie points to @jeremyroe :sparkles: :thumbsup: :sparkles:
:star: 255 | @jeremyroe | http://www.freecodecamp.com/jeremyroe
Theo Martin
@theosdesigns
Nov 07 2015 04:06
it just says you should be using correct index to modify the value in myArray.
Jeremy Roe
@jeremyroe
Nov 07 2015 04:06
@dantesolis sounds good - you’re on the right track the code logic is just not quite right - syntax appears good though
Theo Martin
@theosdesigns
Nov 07 2015 04:06
@jeremyroe it just says you should be using correct index to modify the value in myArray.
Jeremy Roe
@jeremyroe
Nov 07 2015 04:07
hmm @theosdesigns I’m not seeing where the array is coming from in your code - I’m not sure you need to use “typeOf” in there my guess is you coudl boil this down to if (lastNameLength) { return lastNameLength; };
undefined if I”m not mistaken is = to false so if you just check truthiness it accomplishes your test
but you might instantiate your variables like var variable; with no value set so that it IS undefined if lenght doesn’t work
@theosdesigns I guess they say not to change that code so disregard my above - I would ditch attaching the value of i to your variable though
8 not i
Theo Martin
@theosdesigns
Nov 07 2015 04:19
@jeremyroe i got it it was an error on freecodecamp what i was doing was correct but i had to clear the 8 after i got the green check and add the length then hit the button again
Jeremy Roe
@jeremyroe
Nov 07 2015 04:19
@theosdesigns Nice work - sorry if I confused you at all - overthought it
MirkaG
@MirkaG
Nov 07 2015 04:20
Waypoint: Modify Array Data With Indexes I don't understand what I'm supposed to do here. CAn someone please explain?
Jeremy Roe
@jeremyroe
Nov 07 2015 04:22
@MirkaG In an array like [1,2,3] each of these numbers “location” is called an index - they start from 0 so it would be Index # 0, 1 , 2 for the above locations - they are asking you to replace the data in one of the indexes (locations) with a different value
Basically you are taking their example and reworking it to match the task
MirkaG
@MirkaG
Nov 07 2015 04:23
@jeremyroe so, if I need to make myArray to the value of 3, what exactly am I supposed to do?

This is the code so far:
var ourArray = [1,2,3];

ourArray[1] = 3; // ourArray now equals [1,3,3].

var myArray = [1,2,3];

// Only change code below this line.

// Only change code above this line.

if(typeof(myArray) !== "undefined"){(function(){return myArray;})();}

Jeremy Roe
@jeremyroe
Nov 07 2015 04:24
@MirkaG If I have an array of [1,2,3] I can replace my first number by saying array[0] = 3;
Kevin Dessely
@kevindessely
Nov 07 2015 04:24
// supposed you have
var cars = ["Saab", "Volvo", "BMW"];

// using indexes
cars[0] = "Hyundai";
Jeremy Roe
@jeremyroe
Nov 07 2015 04:24
@MirkaG the [0] tells the index location - does that help?
MirkaG
@MirkaG
Nov 07 2015 04:25
@jeremyroe Meep! Still getting an error message :worried:
Jeremy Roe
@jeremyroe
Nov 07 2015 04:26
@MirkaG what error are you getting? Can you post your code? - see @ouphana example above also if that helps
MirkaG
@MirkaG
Nov 07 2015 04:27

@jeremyroe and @ouphana unfortunately it doesn't help as I have no idea what I'm looking at (maybe coding isn't for me?) Here is my code so far:
var ourArray = [1,2,3];

ourArray[1] = 3; // ourArray now equals [1,3,3].

var myArray[0] = 3;

// Only change code below this line.

// Only change code above this line.

if(typeof(myArray) !== "undefined"){(function(){return myArray;})();}

Andrew Bresee
@AndrewBresee
Nov 07 2015 04:28
Hey! I am working on Inherit Style from the Body Element. Can someone help?
Jeremy Roe
@jeremyroe
Nov 07 2015 04:29
@MirkaG don’t give up - It’s all part of learning. It looks like maybe you changed the intial array on accident - You want to leave var myArray = [1,2,3]; and then add your code myArray[0]=3; after - you essentially deleted the array instead of changing it
Andrew Bresee
@AndrewBresee
Nov 07 2015 04:29
I can not figure out how to make an <h1></h1> element within the body{} that is within the <stytle></style> elements

This does not work:

<style>
body {
background-color: black;
<h1>Hello World</h1>
}
</style>

bruglesco
@bruglesco
Nov 07 2015 04:31
@zebracoder you cant make html tags in css
Jeremy Roe
@jeremyroe
Nov 07 2015 04:31
@zebracoder I’m not greate with CSS but I think you’d want to <h1 style=…> rather than putting it inside a style element - Yes what @bruglesco said
Andrew Bresee
@AndrewBresee
Nov 07 2015 04:31
I am working with"Waypoint: Inherit Styles from the Body Element" it seems to imply that I put the h1 element within the style tags
MirkaG
@MirkaG
Nov 07 2015 04:31
@jeremyroe so, I reset the code to the original and added myArray under the var myArray.... it tells me that myArray should be [3,2,3]. How do I make that happen?
Kevin Dessely
@kevindessely
Nov 07 2015 04:32
@MirkaG try to remove typeof
ur code should be as follow, try to indent ur code
Jeremy Roe
@jeremyroe
Nov 07 2015 04:33
@MirkaG if your initial array is [1,2,3] and your end result array needs to be [3,2,3] then you’re looking to change that first digit in index 0 to a 3 by reassigning it using the examples above - does that help?
Kevin Dessely
@kevindessely
Nov 07 2015 04:34
var ourArray = [1,2,3];
// ourArray[1] = 3; // ourArray now equals [1,3,3]. <--- This is wrong, indexed based start from '0'

var myArray[0] = 3;

if(myArray !== "undefined"){
    return myArray;
}
remove ourArray1
Jeremy Roe
@jeremyroe
Nov 07 2015 04:34
Thanks @ouphana - @MirkaG check out line 4 here in @ouphana’s example in particular
CamperBot
@camperbot
Nov 07 2015 04:34
jeremyroe sends brownie points to @ouphana and @mirkag and @ouphana :sparkles: :thumbsup: :sparkles:
Kevin Dessely
@kevindessely
Nov 07 2015 04:34
my bade it should use ourArray for all not myArray
CamperBot
@camperbot
Nov 07 2015 04:34
:star: 23 | @ouphana | http://www.freecodecamp.com/ouphana
:star: 23 | @ouphana | http://www.freecodecamp.com/ouphana
:star: 146 | @mirkag | http://www.freecodecamp.com/mirkag
MirkaG
@MirkaG
Nov 07 2015 04:35

@ouphana That didn't work

@jeremyroe looks like you are heading in the right direction. I got one green check mark out of the 2

Rex Schrader
@SaintPeter
Nov 07 2015 04:35

@zebracoder There are two seperate things:
The css declaration, which goes inside the style tags, like this:

<style>
h2 {
/* Style delcaration goes here */
} 
</style>

and the actual USAGE of the element:

<h2>I am text, hear me roar</h2>
Kevin Dessely
@kevindessely
Nov 07 2015 04:35
which challenge is that ?
i am new to freecode but have experience, trying out freecode
Jeremy Roe
@jeremyroe
Nov 07 2015 04:36

@MirkaG Here’s what I ended up with in my example - see if you can locate the differences and understand what’s happening before moving on

```var ourArray = [1,2,3];
ourArray[1] = 3;
// ourArray now equals [1,3,3].
var myArray = [1,2,3];
// Only change code below this line.
myArray[0] = 3;

// Only change code above this line.
// We use this function to show you the value of your variable in your output box.
// You'll learn about functions soon.
if(typeof(myArray) !== "undefined"){(function(){return myArray;})();}```

Kevin Dessely
@kevindessely
Nov 07 2015 04:37
@MirkaG
var ourArray = [1,2,3];

ourArray[1] = 3; // ourArray now equals [1,3,3].

var myArray = [1,2,3];

// Only change code below this line.

myArray[0] = 3; //  <----- This is what I ADDED

// Only change code above this line.

if(typeof(myArray) !== "undefined"){(function(){return myArray;})();}
MirkaG
@MirkaG
Nov 07 2015 04:37
@ouphana and @jeremyroe Thank you! it worked!!!!!!!!
CamperBot
@camperbot
Nov 07 2015 04:37
mirkag sends brownie points to @ouphana and @jeremyroe :sparkles: :thumbsup: :sparkles:
:star: 256 | @jeremyroe | http://www.freecodecamp.com/jeremyroe
:star: 24 | @ouphana | http://www.freecodecamp.com/ouphana
Kevin Dessely
@kevindessely
Nov 07 2015 04:37
that should work, I tried the challenge
Jeremy Roe
@jeremyroe
Nov 07 2015 04:38
@MirkaG Anytime - It just takes repitition for this to click - keep at it
Andrew Bresee
@AndrewBresee
Nov 07 2015 04:40

@SaintPeter The instructions say "Now we've proven that every HTML page has a body element, and that its body element can also be styled with CSS.

Remember, you can style your body element just like any other HTML element, and all your other elements will inherit your body element's styles.

First, create a h1 element with the text Hello World"

Rex Schrader
@SaintPeter
Nov 07 2015 04:42
@zebracoder Yes, you will need to create that below the style tags.
Andrew Bresee
@AndrewBresee
Nov 07 2015 04:42
@SaintPeter Gotcha! Thank you
CamperBot
@camperbot
Nov 07 2015 04:42
zebracoder sends brownie points to @saintpeter :sparkles: :thumbsup: :sparkles:
:star: 1424 | @saintpeter | http://www.freecodecamp.com/saintpeter
Rex Schrader
@SaintPeter
Nov 07 2015 04:43
@zebracoder That could be made clearer. I'll file an issue and get it fixed.
Andrew Bresee
@AndrewBresee
Nov 07 2015 04:44
@SaintPeter Thank you. Yeah, it was a little confusing. Reading it twice made me think that the <h1></h1> were supposed to go inside the body{}
CamperBot
@camperbot
Nov 07 2015 04:44
zebracoder sends brownie points to @saintpeter :sparkles: :thumbsup: :sparkles:
:warning: zebracoder already gave saintpeter points
Rex Schrader
@SaintPeter
Nov 07 2015 04:45
@zebracoder Got it - filing an issue now :D
Matthew Mun
@mattmun
Nov 07 2015 04:45
Good Evening All
DJ
@qualitymanifest
Nov 07 2015 04:46
@SaintPeter while you're here, i think the json waypoints should be moved to before beginner ziplines
Matthew Mun
@mattmun
Nov 07 2015 04:46
Im stuck on the Factorialize Bonfire
can someone explain the math behind it
Rex Schrader
@SaintPeter
Nov 07 2015 04:46
@qualitymanifest /agree
Matthew Mun
@mattmun
Nov 07 2015 04:47
i know its iterations
ex 5 : 44321 = 120
54321
Rex Schrader
@SaintPeter
Nov 07 2015 04:47
@mattmun You need to use backticks to keep the *
Matthew Mun
@mattmun
Nov 07 2015 04:47
ah gotcha thanks
CamperBot
@camperbot
Nov 07 2015 04:47
if you want to thank someone, put an @ before their name!
Rex Schrader
@SaintPeter
Nov 07 2015 04:47
@mattmun ok, so you know how to count from 5 to 1 in Javascript, right?
Matthew Mun
@mattmun
Nov 07 2015 04:48
negative iterations?
like i--
Rex Schrader
@SaintPeter
Nov 07 2015 04:50
@mattmun In terms of some sort of looping structure?
Matthew Mun
@mattmun
Nov 07 2015 05:02
i was thinking of a while loop
while i !== 0 do xxxxxx i--
Alem
@alemneh
Nov 07 2015 05:05
Can someone help me with my pomodoro clock I am using FlipClock.js librbary link to api documentation
--> http://flipclockjs.com/api I cant seem to get increment funtion to work this is a link to gist github
--> https://gist.github.com/alemneh/ebc7680f5d6a7c444ce2#file-flipclock-html
Rex Schrader
@SaintPeter
Nov 07 2015 05:06
@mattmun A while loop would certainly work. A for loop might be easier to control.
@mattmun What you need to think about is how you're going to keep track of the running total.
Jeremy Roe
@jeremyroe
Nov 07 2015 05:13
@alemneh here’s what I have for my pomodoro so far - I’m hung up on the animation and css but my JS is close to what I need I think - maybe it will help you out http://codepen.io/jeremyroe/pen/dYKdve?editors=010
I don’t recall how much I’ve tinkered from when I had it semi functional have been hammering on my css the little I’ve had to work on it this week
Tim
@Georift
Nov 07 2015 05:19
@alemneh Just quickly I found one error. On line 39 you are missing a ',' after the }.
Matthew Mun
@mattmun
Nov 07 2015 05:23

function factorialize(num) {

for (num !== 0 ){


  return num * factorialize(num - 1)
};

}

factorialize(5);

can someone tell me whats wrong with my code

function factorialize(num) {

for (num !== 0 ){

return num * factorialize(num - 1)

};

}

factorialize(5);

Tim
@Georift
Nov 07 2015 05:24
Once you return something, the function ends.
Which is fine, but you should be using if not for
DJ
@qualitymanifest
Nov 07 2015 05:25
@mattmun also, factorialize is just the name of the function. it does nothing
Tim
@Georift
Nov 07 2015 05:26
'''
CamperBot
@camperbot
Nov 07 2015 05:26
:bulb: to format code use backticks! ``` more info
Matthew Mun
@mattmun
Nov 07 2015 05:27

'''function factorialize(num) {

if (num !== 0 ){

return num * factorialize(num - 1);

}else{

return 1;

}

}

factorialize(5);

CamperBot
@camperbot
Nov 07 2015 05:27
:bulb: to format code use backticks! ``` more info
Tim
@Georift
Nov 07 2015 05:29
function factorialize(num){
    if (num == 0)
    {
        return 1;
    }
    else
    {
        return (num * factorialize(num - 1));
    }
}

alert(factorialize(3));
@mattmun beat me to it.
Matthew Mun
@mattmun
Nov 07 2015 05:31
thanks guys
CamperBot
@camperbot
Nov 07 2015 05:31
if you want to thank someone, put an @ before their name!
DJ
@qualitymanifest
Nov 07 2015 05:40
interesting. that is a new version to me that i wouldn't have guessed would work.
Jose E. Pimentel
@jedpimentel
Nov 07 2015 05:41
That recursive function is actually the mathematical definition
DJ
@qualitymanifest
Nov 07 2015 05:42
alas, the concept of recursion still eludes me
Akshat Oswal
@akshat01
Nov 07 2015 07:14
can someone help me with the public and private methods?
EmotionlessRock
@EmotionlessRock
Nov 07 2015 07:14
On the same boat as you quality heh
Doppelhertz
@Doppelhertz
Nov 07 2015 07:15
Hello everyone :)
I was working away on my lessons when suddenly freecodecamp.com stopped loading. The only thing on the page is: $1
It loads up on my phone just fine but working from my phone is rather awkward. Anyone have some insight as to why this may be happening?
Markus Kiili
@Masd925
Nov 07 2015 07:15
@akshat01 yeah.
Akshat Oswal
@akshat01
Nov 07 2015 07:15
@Masd925 : So I am on the waypoint make-object -properties-private
How do I make getSpeed accessible from outside aka public?
I understand the concept of public and private but have difficulty with the exact syntax
Markus Kiili
@Masd925
Nov 07 2015 07:17
@akshat01 using this.propertyName=... makes it public.
Aleksander Gębicki
@Takumar
Nov 07 2015 07:17
@akshat01 if you want to make function public you have to add this. before name of function.
Akshat Oswal
@akshat01
Nov 07 2015 07:19
this.getSpeed = function () {
return addUnit(this.speed);
};
This is what makes it public
Right?
I do I overcome "myBike.speed should be undefined."
Aleksander Gębicki
@Takumar
Nov 07 2015 07:20
because you have to make 'speed' property private
this.speed=... just type speed=.. in your property declaration.
Akshat Oswal
@akshat01
Nov 07 2015 07:21
Perfect
Markus Kiili
@Masd925
Nov 07 2015 07:21
@akshat01 Private properties are created using var x =... or function...
Akshat Oswal
@akshat01
Nov 07 2015 07:21
Thanks @Takumar and @Masd925
CamperBot
@camperbot
Nov 07 2015 07:21
akshat01 sends brownie points to @takumar and @masd925 :sparkles: :thumbsup: :sparkles:
:star: 264 | @masd925 | http://www.freecodecamp.com/masd925
:star: 642 | @takumar | http://www.freecodecamp.com/takumar
Akshat Oswal
@akshat01
Nov 07 2015 07:22
:clap:
so to summarize this.property // public ;
var prop = 100 // private
Doppelhertz
@Doppelhertz
Nov 07 2015 07:44
fixed my problem... it's the wifi I'm using :)
Vikram Rajput
@csbug
Nov 07 2015 07:46
facebook feed dialog not woking on ajax request element ( i used FB.XFBML.parse() but having same problem)
how to solve this??
MirkaG
@MirkaG
Nov 07 2015 08:04

Waypoint: Manipulate Arrays With push

can anyone help?

Markus Kiili
@Masd925
Nov 07 2015 08:06
@MirkaG yes.
MirkaG
@MirkaG
Nov 07 2015 08:06

This is the code:

var ourArray = ["Stimpson", "J", ["cat"]];

ourArray.pop(); // ourArray now equals ["Stimpson", "J"]

ourArray.push(["happy", "joy"]); // ourArray now equals ["Stimpson", "J", ["happy", "joy"]]

var myArray = ["John", 23, ["cat", 2]];

myArray.pop();

// Only change code below this line.

// Only change code above this line.

(function(z){return 'myArray = ' + JSON.stringify(z);})(myArray);

I need to Push ["dog", 3] onto the end of the myArray variable.

@Masd925 I tried to change cat and 2 to dog and 3 but that gives me an error message
Viktor Zo
@ViktorZo
Nov 07 2015 08:07
myArray.push(['dog', 3]);
MirkaG
@MirkaG
Nov 07 2015 08:08
@ViktorZo I tried that, it gives me an error message
Viktor Zo
@ViktorZo
Nov 07 2015 08:08
what error?
MirkaG
@MirkaG
Nov 07 2015 08:10
@ViktorZo "Program Execution Failure"
Viktor Zo
@ViktorZo
Nov 07 2015 08:11
maybe u lose any charcter, brackets or ';'
blob
MirkaG
@MirkaG
Nov 07 2015 08:12

@ViktorZo Here is what I wrote out:

var ourArray = ["Stimpson", "J", ["cat"]];

ourArray.pop(); // ourArray now equals ["Stimpson", "J"]

ourArray.push(["happy", "joy"]); // ourArray now equals ["Stimpson", "J", ["happy", "joy"]]

var myArray = ["John", 23, ["cat", 2]];

myArray.pop();

myArray.push(["John", 23, ["dog", 3]])
// Only change code below this line.

// Only change code above this line.

(function(z){return 'myArray = ' + JSON.stringify(z);})(myArray);

Viktor Zo
@ViktorZo
Nov 07 2015 08:14
just make it myArray.push(/* only one element, add to end of array */);
MirkaG
@MirkaG
Nov 07 2015 08:14
@ViktorZo I forgot to put in the ; Thank you!
CamperBot
@camperbot
Nov 07 2015 08:14
mirkag sends brownie points to @viktorzo :sparkles: :thumbsup: :sparkles:
:star: 200 | @viktorzo | http://www.freecodecamp.com/viktorzo
Viktor Zo
@ViktorZo
Nov 07 2015 08:14
you welcome
Randy Goldsmith
@Dueldrawer8
Nov 07 2015 08:19
anyone know why when i link my linkIn site on my html page it wont go to it?
nothing happens when i click on LinkIn button at bottom of page even though i did link it using href
Pavan
@pavanp73
Nov 07 2015 08:23
http://codepen.io/pavanp73/pen/epLowo when i click star it will display and reload the page..... please help
@Dueldrawer8 use <a> instead of button
Matthew Mun
@mattmun
Nov 07 2015 08:30
good evening fellow sufferers
do you guys mind giving me a hand
Randy Goldsmith
@Dueldrawer8
Nov 07 2015 08:34
@pavanp73 thank you!
CamperBot
@camperbot
Nov 07 2015 08:34
dueldrawer8 sends brownie points to @pavanp73 :sparkles: :thumbsup: :sparkles:
:star: 209 | @pavanp73 | http://www.freecodecamp.com/pavanp73
when i click on start button, it displays and again reloads the page again.. what is wrong ? please help.
mattcoder
@MattWebCoder
Nov 07 2015 08:49
Hi all
chermandu
@chermandu
Nov 07 2015 09:24
Hi guys, I have an unanswered question yesterday, I hope somebody can help me. I'm currently doing the CatApp thing, and I was asked to paste a link on top of the code (which I assumed is Bootstrap) before adding "container-fluid" on an element. On the very next exercise, I was asked to add img-responsive, but I noticed that the link that I pasted earlier on top of the code was gone, but img-responsive still worked!?
Now I'm confused on what exactly does Bootstrap do :worried:
jpjenkins
@jpjenkins
Nov 07 2015 09:34
I just finished the basic algorithm scripting... thanks for all your help people :)
CamperBot
@camperbot
Nov 07 2015 09:34
if you want to thank someone, put an @ before their name!
jpjenkins
@jpjenkins
Nov 07 2015 09:36
@chermandu what's the waypoint called that you're doing?
Pranay Kothapalli
@kotAPI
Nov 07 2015 09:43
@jeremyroe nice clock :D

I managed to finish mine, what a sleepless night it has been

http://codepen.io/kotAPI/pen/QjZwNg

PeterGabriel2
@PeterGabriel2
Nov 07 2015 09:49
Hi guys, can you please recommend some good sites with free images for portfolio web page background ?
Kevin Dessely
@kevindessely
Nov 07 2015 09:49
@PeterGabriel2
http://thestocks.im/
PeterGabriel2
@PeterGabriel2
Nov 07 2015 09:51
@ouphana great thank you! :+1:
CamperBot
@camperbot
Nov 07 2015 09:51
petergabriel2 sends brownie points to @ouphana :sparkles: :thumbsup: :sparkles:
:star: 46 | @ouphana | http://www.freecodecamp.com/ouphana
h4r1m4u
@h4r1m4u
Nov 07 2015 09:51
@chermandu the first waypoint shows you how it's done (what you'll need to be doing when building your own site and wanting to use bootstrap). the next waypoint imports the bootstrap.css for you behind the scenes, so that you don't need to worry about it.
chermandu
@chermandu
Nov 07 2015 09:52
@h4r1m4u Hey thanks! I already figured it out :D I overlooked it and got confused :shipit:
CamperBot
@camperbot
Nov 07 2015 09:52
chermandu sends brownie points to @h4r1m4u :sparkles: :thumbsup: :sparkles:
:star: 567 | @h4r1m4u | http://www.freecodecamp.com/h4r1m4u
h4r1m4u
@h4r1m4u
Nov 07 2015 09:53
@chermandu it was a valid question. good observation skills
chermandu
@chermandu
Nov 07 2015 09:54
On that topic, I assume you need to have an internet connection for Bootstrap to work?
h4r1m4u
@h4r1m4u
Nov 07 2015 09:54
try again?
Kevin Dessely
@kevindessely
Nov 07 2015 09:55
@chermandu let's say if you have local environment development - Localhost.
You could download the bootstrap.min.css file into your computer and link it directly instead of grabbing it using the CDN link.
Abhisek Pattnaik
@abhisekp
Nov 07 2015 09:56
. @SaintPeter . DELETED
chermandu
@chermandu
Nov 07 2015 09:56
@ouphana Ooohh yah yah got it. I kinda visualize how that works. Thanks!
CamperBot
@camperbot
Nov 07 2015 09:56
chermandu sends brownie points to @ouphana :sparkles: :thumbsup: :sparkles:
:star: 47 | @ouphana | http://www.freecodecamp.com/ouphana
Kevin Dessely
@kevindessely
Nov 07 2015 09:57
great. anytime
Abhisek Pattnaik
@abhisekp
Nov 07 2015 10:01
@ouphana what about midnight? :P
Kevin Dessely
@kevindessely
Nov 07 2015 10:02
@abhisekp haha. LOL! Nice one
Elizabeth Hatleli
@TheHighPriestess
Nov 07 2015 10:17
What does the forward slash mean here?
a/= Math.pow(10, 2);
where a is variable holding some number
Abhisek Pattnaik
@abhisekp
Nov 07 2015 10:20
@TheHighPriestess
a /= Math.pow(10, 2); 
// is same as
a = a / Math.pow(10, 2)
This message was deleted
@TheHighPriestess You can also do this
a /= 1e2; // exponential operator = 1 x 10^2
Elizabeth Hatleli
@TheHighPriestess
Nov 07 2015 10:27
@abhisekp ah......thank you
CamperBot
@camperbot
Nov 07 2015 10:27
thehighpriestess sends brownie points to @abhisekp :sparkles: :thumbsup: :sparkles:
:star: 884 | @abhisekp | http://www.freecodecamp.com/abhisekp
Elizabeth Hatleli
@TheHighPriestess
Nov 07 2015 10:28
I got confused because I'm not used to seeing the / sign used this way....or at all for that matter
Abhisek Pattnaik
@abhisekp
Nov 07 2015 10:28
@TheHighPriestess also
3 << 10; // 3072
// is same as
3 * Math.pow(2, 10); // 3072
Elizabeth Hatleli
@TheHighPriestess
Nov 07 2015 10:29
interesting
@TheHighPriestess but it's not recommended to use shortcuts. Use readable codes. Although the bitwise shortcut is faster performance-wise.
Nice read by Eric Elliot https://medium.com/javascript-scene/the-single-biggest-mistake-programmers-make-every-day-62366b432308
KISS :kiss: (Keep It Stupid Simple)
Elizabeth Hatleli
@TheHighPriestess
Nov 07 2015 10:38
I don't like these shortcuts for that reason. They make it harder to read the code.
Kevin Dessely
@kevindessely
Nov 07 2015 10:45
@abhisekp thanks for e links!
CamperBot
@camperbot
Nov 07 2015 10:45
ouphana sends brownie points to @abhisekp :sparkles: :thumbsup: :sparkles:
:star: 885 | @abhisekp | http://www.freecodecamp.com/abhisekp
Abhisek Pattnaik
@abhisekp
Nov 07 2015 10:47
@ouphana e links?? :confused:
Kevin Dessely
@kevindessely
Nov 07 2015 10:50
@abhisekp devdocs and KISS
article*
Abhisek Pattnaik
@abhisekp
Nov 07 2015 10:50
@ouphana eu... I won't KISS :kiss:
gts00k
@gts00k
Nov 07 2015 10:50
hey
how do I check if an array has numbers in it or not
?
Abhisek Pattnaik
@abhisekp
Nov 07 2015 10:52
@gts00k arr.indexOf(num) !== -1
gts00k
@gts00k
Nov 07 2015 10:52
@abhisekp thx
CamperBot
@camperbot
Nov 07 2015 10:52
gts00k sends brownie points to @abhisekp :sparkles: :thumbsup: :sparkles:
:star: 886 | @abhisekp | http://www.freecodecamp.com/abhisekp
Abhisek Pattnaik
@abhisekp
Nov 07 2015 10:52
@gts00k or try http://devdocs.io/#q=js+Array+some Array.prototype.some
jpjenkins
@jpjenkins
Nov 07 2015 10:52
  .thick-green-border {
    border-color: green;

    border-width: 10px;

    border-style: solid;
  }
doesn't pass 'give your image a border-width of 10 pixels... what's going on?
Kevin Dessely
@kevindessely
Nov 07 2015 10:53
@abhisekp ..
Abhisek Pattnaik
@abhisekp
Nov 07 2015 10:54
@ouphana :question:
Michael Bomholt
@bomholtm
Nov 07 2015 10:54
@abhisekp ...
Abhisek Pattnaik
@abhisekp
Nov 07 2015 10:55
@bomholt :question:
Michael Bomholt
@bomholtm
Nov 07 2015 10:55
xD just saw a lot people mention you this days.. just thought i join the club :D
Kevin Dessely
@kevindessely
Nov 07 2015 10:56
@jpjenkins try reloading the page ? and do the same thing again ?
Abhisek Pattnaik
@abhisekp
Nov 07 2015 10:56
@bomholt lol
Kevin Dessely
@kevindessely
Nov 07 2015 10:56
@bomholt yea.. join us to KISS KISS him.
jpjenkins
@jpjenkins
Nov 07 2015 10:56
@ouphana nope :/ I typed it out myself and then tried to copy and paste and change
the other 2 pass, but this doesn't, I've done this before and was just taking a refresh... I can't see anything wrong at all
Kevin Dessely
@kevindessely
Nov 07 2015 10:57
@jpjenkins that seems to be correct let me try the challenge and get back to u
jpjenkins
@jpjenkins
Nov 07 2015 10:57
thanks @ouphana
CamperBot
@camperbot
Nov 07 2015 10:57
jpjenkins sends brownie points to @ouphana :sparkles: :thumbsup: :sparkles:
:star: 66 | @ouphana | http://www.freecodecamp.com/ouphana
Kevin Dessely
@kevindessely
Nov 07 2015 11:00
@jpjenkins I literally copy-pasted ur css into it and it's correct solution.
Could you paste your entire code here ?
jpjenkins
@jpjenkins
Nov 07 2015 11:00
<link href="http://fonts.googleapis.com/css?family=Lobster" rel="stylesheet" type="text/css">
<style>
  .red-text {
    color: red;
  }

  .thick-green-border {

    border-color: green;

    border-width: 10px;

    border-style: solid;

  }

  h2 {
    font-family: Lobster, Monospace;
  }

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

  .smaller-image {
    width: 100px;
  }
</style>

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

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

<p class="red-text">Kitty ipsum dolor sit amet, shed everywhere shed everywhere stretching attack your ankles chase the red dot, hairball run catnip eat the grass sniff.</p>
<p class="red-text">Purr jump eat the grass rip the couch scratched sunbathe, shed everywhere rip the couch sleep in the sink fluffy fur catnip scratched.</p>
Kevin Dessely
@kevindessely
Nov 07 2015 11:02
@jpjenkins I did the same copy-pasted. And it's right.
Weird. Could you try this in incognito mode ?
jpjenkins
@jpjenkins
Nov 07 2015 11:04
same again @ouphana
:/
very strange
I guess I'll just skip this one then, it's just a refresher for me anyway. It looks right, the border changes it's width at the side too so it is the correct code. FCC says no
cheers for trying though
Kevin Dessely
@kevindessely
Nov 07 2015 11:06
Yea. It's weird. Try reporting is as a bug? It could help someone later on.
jpjenkins
@jpjenkins
Nov 07 2015 11:07
i don't want to be too hasty, it may just be my computer
If I have more problems with css I'll dig in deeper
hmm. next one fails too 'border-radius'
I'll restart and hope for the best, then I'll install firefox
Kevin Dessely
@kevindessely
Nov 07 2015 11:12
ah.. I see. Update me. Interested to know what happened.
jpjenkins
@jpjenkins
Nov 07 2015 11:15
aaand
now it works
weird
Kevin Dessely
@kevindessely
Nov 07 2015 11:16
u r using the same browser or ?
u installed a new one ? (a different one)
jpjenkins
@jpjenkins
Nov 07 2015 11:17
no I just restarted
I've been messing around with editors and whatnot
Kevin Dessely
@kevindessely
Nov 07 2015 11:18
well that's definitely weird.
jpjenkins
@jpjenkins
Nov 07 2015 11:18
I'm using chromium for arch linux, it's not the best on my machine to be honest
extensions and webgl brilliance force my loyalty though :/
Kevin Dessely
@kevindessely
Nov 07 2015 11:22
ah i see
Michael Bomholt
@bomholtm
Nov 07 2015 11:29
@jpjenkins you make me wanna try an arch setup again :)
jpjenkins
@jpjenkins
Nov 07 2015 11:29
doooo it!
:)
irc #archlinux will be there to hold your hand if needed
tonich8
@tonich8
Nov 07 2015 11:29
Hello
Can anyone help with freecodecamp tutorial
"Delete your jquery functions"
Michael Bomholt
@bomholtm
Nov 07 2015 11:31
@jpjenkins yeah last time i tried was quite a time ago... and i used ubuntu back then and had fiddled around with some other debian based distros
and i took me like 3 days to get it working correctly :D
jpjenkins
@jpjenkins
Nov 07 2015 11:31
what are you using now?
Michael Bomholt
@bomholtm
Nov 07 2015 11:32
right now im on opensuse tumbleweed ... i also have fedora installed.
tumbleweed is a rolling release distro and i really like it
jpjenkins
@jpjenkins
Nov 07 2015 11:34
having a rolling release is the best thing about arch tbh
Michael Bomholt
@bomholtm
Nov 07 2015 11:34
nowadays arch should be no problem to install but i am anxious somehow because of that last experience ^^
jpjenkins
@jpjenkins
Nov 07 2015 11:34
and the community
yeah arch can be quite a pain to get around, but really, the wiki is so good now it's rare that you have any extreme problem
Michael Bomholt
@bomholtm
Nov 07 2015 11:34
yeah i believe that. i like everything about that distro... but coming from ubuntu it was like hell
jpjenkins
@jpjenkins
Nov 07 2015 11:34
unless you have super strange hardware
Michael Bomholt
@bomholtm
Nov 07 2015 11:35
its like i didnt know a thing about linux back then
jpjenkins
@jpjenkins
Nov 07 2015 11:35
:) that's the beauty of it though isn't it? Jumping into it with 2 feet with something like arch is a breath of fresh air
If you need something to boost your confidence read this book: linux command line - a complete introduction
A brilliant book
Takes you from your very first pwd all the way to bash scripts
Michael Bomholt
@bomholtm
Nov 07 2015 11:37
a cool i will look into that
but most of the stuff should be familiar
jpjenkins
@jpjenkins
Nov 07 2015 11:38
very inviting, not written by a guy with social inneptitudes for a change
Michael Bomholt
@bomholtm
Nov 07 2015 11:38
since i used a lot of distros my linux knowledge really got better
jpjenkins
@jpjenkins
Nov 07 2015 11:39
yeah same, I managed okay on the command line, but then being on the irc channel all the time, it became apparent that they needed a boost
Michael Bomholt
@bomholtm
Nov 07 2015 11:40
ahhh you got me excited over arch all again
now i have to format :(
jpjenkins
@jpjenkins
Nov 07 2015 11:41
hehe, prepare to set aside a couple of days to experiment ;)
sign up to the forum, get on the irc channel. You'll never look back.
Michael Bomholt
@bomholtm
Nov 07 2015 11:47
i will... maybe getting it to run on my old laptop first so i a rig for coding still ^^
jpjenkins
@jpjenkins
Nov 07 2015 11:56
could always experiment with vm...
louisnetzler
@louisnetzler
Nov 07 2015 11:59
Hello
dainramnauth
@dainramnauth
Nov 07 2015 11:59
yo
Elliott McNary
@bighitbiker3
Nov 07 2015 12:00
hey @louisnetzler
henry22
@henry22
Nov 07 2015 12:10
This message was deleted

Waypoint: Link to External Pages with Anchor Elements
When I put this

<p>
<a href="http://freecatphotoapp.com">
cat photo
</a>
</p>
then I run test, it shows Your a element should have the anchor text of "cat photos".
Why can't I pass it?

Arnis Jaundzeikars
@SangSatori
Nov 07 2015 12:16
@henry22: Right now it has cat photo in singular form, right? Tests can do some nit-picking at times.
Elliott McNary
@bighitbiker3
Nov 07 2015 12:16
you have "cat photo"...missing an s
henry22
@henry22
Nov 07 2015 12:18
@bighitbiker3 thank you, I forget to add a s and ""
CamperBot
@camperbot
Nov 07 2015 12:18
henry22 sends brownie points to @bighitbiker3 :sparkles: :thumbsup: :sparkles:
:star: 204 | @bighitbiker3 | http://www.freecodecamp.com/bighitbiker3
Roma Storozhuk
@RomaSto
Nov 07 2015 12:18

Hello, can you help me with this?

Nest two div class="col-xs-6" elements within your div class="row" element.

<div class="container-fluid">
<h3 class="text-primary text-center">jQuery Playground</h3>
<div class="row">
<div class="col-xs-6">
<div class="col-xs-6">

</div>
</div>

</div>
</div>

Elliott McNary
@bighitbiker3
Nov 07 2015 12:20
right now you have a col-xs-6 inside of a col-xs-6
end those divs on the same line like this
<div class="col-xs-6"></div>
<div class="col-xs-6"></div>
Roma Storozhuk
@RomaSto
Nov 07 2015 12:31
@bighitbiker3
Aleksander Gębicki
@Takumar
Nov 07 2015 12:36
Add thanks to it :-)
CamperBot
@camperbot
Nov 07 2015 12:36
if you want to thank someone, put an @ before their name!
Elliott McNary
@bighitbiker3
Nov 07 2015 12:37
@RomaSto yes?
oh haha I see wha tyou were trying to ...not problem :)
Kevin Dessely
@kevindessely
Nov 07 2015 12:41
@camperbot thanks
CamperBot
@camperbot
Nov 07 2015 12:42
ouphana sends brownie points to @camperbot :sparkles: :thumbsup: :sparkles:
:star: 509 | @camperbot | http://www.freecodecamp.com/camperbot
Kevin Dessely
@kevindessely
Nov 07 2015 12:42
LOL
Elliott McNary
@bighitbiker3
Nov 07 2015 12:42
hahaha
Kevin Dessely
@kevindessely
Nov 07 2015 12:42
hi there @bighitbiker3
Elliott McNary
@bighitbiker3
Nov 07 2015 12:43
@ouphana hello
iprogrammer15
@iprogrammer15
Nov 07 2015 13:02
hi all
Edwina Muir
@edgmuir
Nov 07 2015 13:03
Hello
iprogrammer15
@iprogrammer15
Nov 07 2015 13:03
hi edgmuir
Edwina Muir
@edgmuir
Nov 07 2015 13:04
Hi iprogrammer15, how are you doing today?
iprogrammer15
@iprogrammer15
Nov 07 2015 13:04
i have been doing these practice lesson .. and I have a doubt with this logic " var flip = Math.floor(Math.random() * (1 - 0 + 1)) + 0; " what will the value of flip be ?
i m good @edgmuir .. how about you ?
wont the flip value always be zero ?
Edwina Muir
@edgmuir
Nov 07 2015 13:05
I'm doing well. Thanks for asking. What programming language are you learning right now?
CamperBot
@camperbot
Nov 07 2015 13:05
if you want to thank someone, put an @ before their name!
Aleksander Gębicki
@Takumar
Nov 07 2015 13:06
@iprogrammer15 flip will have value 0 or 1.
random() gives you values from range [0, 1) i.e. 0.2354362
iprogrammer15
@iprogrammer15
Nov 07 2015 13:07
how is that ?? anything multiplied by zero is zero rite?
but 1 - 0 + 1 = 0 ?
Aleksander Gębicki
@Takumar
Nov 07 2015 13:08
no, it's the same as 1 + 1 - 0 === 2
so random() * 2 gives you values from [0, 2)
iprogrammer15
@iprogrammer15
Nov 07 2015 13:08
lool.... yea... apologies got confused
:D
brain freeze for a minute
lol
Aleksander Gębicki
@Takumar
Nov 07 2015 13:09
and with Math.floor() you round values down to 0 or 1.
iprogrammer15
@iprogrammer15
Nov 07 2015 13:09
thanks @Takumar
CamperBot
@camperbot
Nov 07 2015 13:09
iprogrammer15 sends brownie points to @takumar :sparkles: :thumbsup: :sparkles:
:star: 647 | @takumar | http://www.freecodecamp.com/takumar
jpjenkins
@jpjenkins
Nov 07 2015 13:48
@Takumar this question has been asked a few times and it's stumped me too. Math logic would say that
0+1 = 1
1-1 = 0
and then there's an addition of zero outside of the arguments
var flip = Math.floor(Math.random() * (1 - 0 + 1)) + 0;
Would you mind explaining how this translate to rounding down to 0 or 1 for heads or tails?
Pranay Kothapalli
@kotAPI
Nov 07 2015 14:01
Hey guys, suppose i have a class div with over 100 children divs, how do i check which div has been clicked?
jpjenkins
@jpjenkins
Nov 07 2015 14:04
id's?
Pranay Kothapalli
@kotAPI
Nov 07 2015 14:17
$(this).attr('id');
this seem to have worked, thanks
CamperBot
@camperbot
Nov 07 2015 14:17
if you want to thank someone, put an @ before their name!
Craig Morrison
@frogmorton
Nov 07 2015 14:28
can anyone here link me to the zipline help chatroom?
apparently one exists
jpjenkins
@jpjenkins
Nov 07 2015 14:30
/help
CamperBot
@camperbot
Nov 07 2015 14:30

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

jpjenkins
@jpjenkins
Nov 07 2015 14:30
maybe you can search the wiki
I was on it yesterday but forgot the name, if you search for 'freecodecamp' on gitter, it will show you all the available chat rooms for that git
anthonygallina1
@anthonygallina1
Nov 07 2015 14:31
@frogmorton sent link
jpjenkins
@jpjenkins
Nov 07 2015 14:31
@frogmorton :point_up:
Craig Morrison
@frogmorton
Nov 07 2015 14:32
i got it, thanks @jpjenkins Thank YOU @anthonygallina1
CamperBot
@camperbot
Nov 07 2015 14:32
frogmorton sends brownie points to @jpjenkins and @anthonygallina1 :sparkles: :thumbsup: :sparkles:
:star: 215 | @jpjenkins | http://www.freecodecamp.com/jpjenkins
:star: 377 | @anthonygallina1 | http://www.freecodecamp.com/anthonygallina1
jpjenkins
@jpjenkins
Nov 07 2015 14:32
no problem
Joe Tierney
@JT1972
Nov 07 2015 14:47
This message was deleted
psicogod
@psicogod
Nov 07 2015 15:07
hey all! i have problem with the 34exercise from JS any help?
nmv got it x
Tiffany Grevious
@DevchamploO
Nov 07 2015 15:18
@psicogod what is your problem?
gts00k
@gts00k
Nov 07 2015 15:36
why this doesnt work ?
This message was deleted
Ray Nobles
@ds863
Nov 07 2015 15:46
i think waypoint 5 in basic js is broken i am doing what it asks but it keeps telling me the lastNameLength should be equal to 8 which it is
Samantha Medeiros
@samanthamed
Nov 07 2015 15:49
@ds863 can you show us some of your code?
Ray Nobles
@ds863
Nov 07 2015 15:50

var firstNameLength = 0;
var lastNameLength = 0;
var firstName = "Ada";

firstNameLength = firstName.length;

var lastName = "Lovelace";

// Only change code below this line.

lastNameLength = lastName;

LastNameLength.length;

// Only change code above this line.

Samantha Medeiros
@samanthamed
Nov 07 2015 15:53
Try changing the lastNameLength part so that its formatted the same as the firstNameLength line
Ray Nobles
@ds863
Nov 07 2015 15:53
oh ok
yeah that did it
ty!
i misunderstood what it wanted me to do
Samantha Medeiros
@samanthamed
Nov 07 2015 15:54
Glad that did the trick!
darrynwu29
@darrynwu29
Nov 07 2015 15:54
how do you insert a button? lol
i forgot
nm got it
Nick Trull
@nicktrull
Nov 07 2015 16:04
how to post code
01just
@01just
Nov 07 2015 16:07
helo
Nick Trull
@nicktrull
Nov 07 2015 16:07
how do you post code
camper bot!

'''var singleVal = array.reduce(function(previousVal, currentVal) {

return previousVal - currentVal;

}, 0);

CamperBot
@camperbot
Nov 07 2015 16:07
:bulb: to format code use backticks! ``` more info
Nick Trull
@nicktrull
Nov 07 2015 16:08

```var singleVal = array.reduce(function(previousVal, currentVal) {

return previousVal - currentVal;

}, 0);

```var singleVal = array.reduce(function(previousVal, currentVal) {

return previousVal - currentVal;

}, 0);

Coira Ellison
@Coira
Nov 07 2015 16:10
wiki format
CamperBot
@camperbot
Nov 07 2015 16:10

:point_right: code format [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 and then press [shift + enter ⏎]

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

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

How to Code

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

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

Nick Trull
@nicktrull
Nov 07 2015 16:10

```var singleVal = array.reduce(function(previousVal, currentVal) {

return previousVal - currentVal;

}, 0);```

var singleVal = array.reduce(function(previousVal, currentVal) {

  return previousVal - currentVal;

}, 0);
yay!!!
Coira Ellison
@Coira
Nov 07 2015 16:11
:)
Nick Trull
@nicktrull
Nov 07 2015 16:12
so if i type wiki + question camperbot will throw stuff like that out?
Coira Ellison
@Coira
Nov 07 2015 16:12
there are certain keywords that it responds to
Nick Trull
@nicktrull
Nov 07 2015 16:13
that's pretty neat thanks @Coira
CamperBot
@camperbot
Nov 07 2015 16:13
nicktrull sends brownie points to @coira :sparkles: :thumbsup: :sparkles:
:star: 293 | @coira | http://www.freecodecamp.com/coira
Coira Ellison
@Coira
Nov 07 2015 16:13
i don't know what those keywords are tho, i'm going to have a look
Herman Fassett
@HermanFassett
Nov 07 2015 16:13
Also wiki, explain, help, number of ways
Nick Trull
@nicktrull
Nov 07 2015 16:13
any idea what the zero at the end of the code i posted is for?
Herman Fassett
@HermanFassett
Nov 07 2015 16:14
Provides an initial previous value I think
Nick Trull
@nicktrull
Nov 07 2015 16:16
i erased it and the code still ran fine. i'll change it to 5 and see if it omits the 4. initial value makes sense now that you say it.
cheers @Coira
Coira Ellison
@Coira
Nov 07 2015 16:16
np :)
Molbee
@Molbee
Nov 07 2015 16:18
Good Afternoon Coders,need wee bit help here
Waypoint: Make Instances of Objects with a Constructor Function

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

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

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

Where do i put engines var
Herman Fassett
@HermanFassett
Nov 07 2015 16:19
Right below the myCar declaration
Molbee
@Molbee
Nov 07 2015 16:20
its ok got it thanks
CamperBot
@camperbot
Nov 07 2015 16:20
if you want to thank someone, put an @ before their name!
Molbee
@Molbee
Nov 07 2015 16:20
myCar.engines = 1
Herman Fassett
@HermanFassett
Nov 07 2015 16:20
;)
Molbee
@Molbee
Nov 07 2015 16:20
thanks @HermanFassett
CamperBot
@camperbot
Nov 07 2015 16:20
molbee sends brownie points to @hermanfassett :sparkles: :thumbsup: :sparkles:
:star: 543 | @hermanfassett | http://www.freecodecamp.com/hermanfassett
Tyler
@teesloane
Nov 07 2015 16:29
hey folks - did anybody find the nodeschool challenges pretty confusing? I feel like it's jumping into the deep end without discussing some of the core concepts ...anybody have any suggested beginner readings / links?
Ben
@benflinn
Nov 07 2015 16:32
hey could anyone give me feedback on this game i made? thanks! https://habitman.herokuapp.com/#/
CamperBot
@camperbot
Nov 07 2015 16:32
if you want to thank someone, put an @ before their name!
Herman Fassett
@HermanFassett
Nov 07 2015 16:32
Kinda cool @benflinn :P
Some things aren't positioned well on my screen though
like
Adole Samuel
@int-elligentSam
Nov 07 2015 16:36
@HermanFassett hello
Herman Fassett
@HermanFassett
Nov 07 2015 16:36
@samconnor hi
Ben
@benflinn
Nov 07 2015 16:36
oh darn..hmm... need to work on my bootstrap skills
Adole Samuel
@int-elligentSam
Nov 07 2015 16:38
@HermanFassett how long have you been coding?
Herman Fassett
@HermanFassett
Nov 07 2015 16:38
Wrote my first python program 6 years or so ago, and have been coding off and on since then.
jpjenkins
@jpjenkins
Nov 07 2015 16:40
function factorialize(num) {

  var i;
  var fac = num;
  if(num === 0){
    return 1;
  }
  for(i = 1; i < num  ; i++){
      fac = fac * (num - i);
    }

  return fac;
}

factorialize(0);
Bonfire: Factorialise a Number
Bonfire: factorialize a number
CamperBot
@camperbot
Nov 07 2015 16:41

:fire:Bonfire: Factorialize a Number :link:

function factorialize(num) {
  return num;
}

factorialize(5);

Return the factorial of the provided integer.

more info:  bf details | bf links | hint

jpjenkins
@jpjenkins
Nov 07 2015 16:41
I was just wondering if there's a simpler way to do this, I'm going over the algorithms again and I'm sure I had an easier solution the first time I did this
Herman Fassett
@HermanFassett
Nov 07 2015 16:47
@jpjenkins recursive makes the solution look a bunch shorter
Throw in a ternary with recursive and it's a one liner
jpjenkins
@jpjenkins
Nov 07 2015 16:49
I've only just come across the concept of ternary in my javascript book, can you elaborate a little please? Is it the on with the question mark that takes the left side and decides on the 2 right solutions. I didn't understand it too well at the time
Ben
@benflinn
Nov 07 2015 16:50
@HermanFassett fixed it! thanks for pointing that out
CamperBot
@camperbot
Nov 07 2015 16:50
benflinn sends brownie points to @hermanfassett :sparkles: :thumbsup: :sparkles:
:star: 544 | @hermanfassett | http://www.freecodecamp.com/hermanfassett
jpjenkins
@jpjenkins
Nov 07 2015 16:58
@HermanFassett I've read up on the ternary concept now, I understand it but I can't wrap my head around how you would reduce '5' in one line and store it while counting down. Care to reveal the mystery? :)
Herman Fassett
@HermanFassett
Nov 07 2015 16:58
well the real magic is in the recursion, but the ternary helps reduce the if base case
help ternary
CamperBot
@camperbot
Nov 07 2015 16:58

:point_right: js ternary [wiki]

The Ternary operator replaces an if/then block in a very small compact way.
It's mostly used in one liners for simple tests and replacements, like this:

var x = false;
var s = x ? "yes" : "no";
console.log(s);  //→ "no"

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

jpjenkins
@jpjenkins
Nov 07 2015 16:59
that's handy
but how do you do a recursion in only one line? Surely it's messy
Herman Fassett
@HermanFassett
Nov 07 2015 16:59

For instance:

function factorialize(num) {
  return num == 0 ? 1 : num * factorialize(num - 1);
}

Like that

Should probably test deep equal but I'm lazy
jpjenkins
@jpjenkins
Nov 07 2015 17:00
something to ponder, thanks @HermanFassett
CamperBot
@camperbot
Nov 07 2015 17:00
jpjenkins sends brownie points to @hermanfassett :sparkles: :thumbsup: :sparkles:
:star: 545 | @hermanfassett | http://www.freecodecamp.com/hermanfassett
Herman Fassett
@HermanFassett
Nov 07 2015 17:00
Yep
Markus Kiili
@Masd925
Nov 07 2015 17:03
@jpjenkins This is also very beautiful example and efficient too:
function reverseString(str) {
  return (str === '') ? '' : reverseString(str.substr(1)) + str.charAt(0);
}
jpjenkins
@jpjenkins
Nov 07 2015 17:07
I don't understand how the logic works though... how can n * n-1 recurse in that line? :/
and where is it storing the variable after each iteration
Completely new concept for me here, appears to go beyond the simple true/false that mozilla examples show
or in this case, is the 'return' the variable?
no, ugh
Rory Smith
@alanbuchanan
Nov 07 2015 17:11
recursion makes my brain melt a little
Aleksander Gębicki
@Takumar
Nov 07 2015 17:11

@jpjenkins you asked :point_up: 7 listopada 2015 14:48
about "Math logic".
Math logic is such, that you cannot change order of operations. When you have first subtraction and then addition, you first make subtraction, so in your case when you have 1 - 0 + 1 you cannot do something like that 1 - (0 + 1) because it is not the same! You do operations from left to right side, so first 1-0 which equals to 1 and then 1+1 which equals 2!

Sorry for late answer but it is better than none :-)

jpjenkins
@jpjenkins
Nov 07 2015 17:12
ah so the computer reads it in a stream
no no, thanks @Takumar :)
CamperBot
@camperbot
Nov 07 2015 17:12
jpjenkins sends brownie points to @takumar :sparkles: :thumbsup: :sparkles:
:star: 649 | @takumar | http://www.freecodecamp.com/takumar
Cynthia O'Donnell
@MimiBambino
Nov 07 2015 17:12
I hear you, @alanbuchanan!
Aleksander Gębicki
@Takumar
Nov 07 2015 17:12
@jpjenkins but not only computer, you study such math in primary school.
jpjenkins
@jpjenkins
Nov 07 2015 17:14
it's been a while ;) I was under the impression: brackets > (power)of > division > multiply > addition > subtraction
the order of priority in maths no? what's that for?
Markus Kiili
@Masd925
Nov 07 2015 17:16
@jpjenkins The given factorialize function returns 1 for 0 and for other values it substitutes F(n) -> n*F(n-1), so during solving that factored number gets smaller and smaller until it hits zero. F(4) -> 4xF(3) -> 4x3xF(2) -> 4x3x2xF(1) -> 4x3x2x1xF(0) -> 4x3x2x1x1 -> 24
jpjenkins
@jpjenkins
Nov 07 2015 17:17
so, it's like there are multiple hidden variables until it returns?
jpjenkins
@jpjenkins
Nov 07 2015 17:26
sometimes the level of ignorance is just too immense to bother helping I guess :P
Markus Kiili
@Masd925
Nov 07 2015 17:31
@jpjenkins There are differences on how languages handle recursion. There is one article on it https://medium.com/functional-javascript/recursion-282a6abbf3c5
cbgesbocker
@cbgesbocker
Nov 07 2015 17:34

stuck on the factorial, heres what I have,' function factorialize(num) {

var fac = 1;

while (fac < num)
{
num *= fac;
fac++;
}
return num;
}

factorialize(5);

jpjenkins
@jpjenkins
Nov 07 2015 17:36
@cbgesbocker ternaries man, have you been living under a rock?
:P
bcaustin
@bcaustin
Nov 07 2015 17:36
Hello
jpjenkins
@jpjenkins
Nov 07 2015 17:37
bonjour
cbgesbocker
@cbgesbocker
Nov 07 2015 17:37
not sure how thats supposed to help
jpjenkins
@jpjenkins
Nov 07 2015 17:38
:) sorry, I just asked the same question a few minutes ago, people are trying to explain the ternary operation to me and it's flying over my head
@Masd925 thanks for the link, looks quite useful. I'm thinking about it more, since the operation is essentially a boolean, is that why it recurses down to 0 so then it can return?
CamperBot
@camperbot
Nov 07 2015 17:39
jpjenkins sends brownie points to @masd925 :sparkles: :thumbsup: :sparkles:
:star: 265 | @masd925 | http://www.freecodecamp.com/masd925
cbgesbocker
@cbgesbocker
Nov 07 2015 17:40
my code seems logical to me is there any admins here that can take a look
Markus Kiili
@Masd925
Nov 07 2015 17:40
@jpjenkins Yes.
jpjenkins
@jpjenkins
Nov 07 2015 17:40
@cbgesbocker looks like you are multiplying the wrong way round:
5 1
20
2
40 * 3
that's supposed to have a multiplication between there.
Markus Kiili
@Masd925
Nov 07 2015 17:41
@cbgesbocker You cannot store the running result on num because it is used in the loop condition too.
jpjenkins
@jpjenkins
Nov 07 2015 17:41
you almost have it, but remember, num will increase
changing your condition on each iteration
change the loop, get the multiplication the right way round and you'll be heading in the right direction
Markus Kiili
@Masd925
Nov 07 2015 17:42
@cbgesbocker Just make another variable for the running total and return it at the end.
jpjenkins
@jpjenkins
Nov 07 2015 17:43
@Masd925 so that's the gold right there, that's where the recursion comes from
but since you can set the condition, it's only valid on math that can end at 0... am I right in saying that?
can't*
cbgesbocker
@cbgesbocker
Nov 07 2015 17:44

var fac = 1;

for (var i = 1; i <= num; i++){
fac *= i;
}
num = fac;
return num;
}

heres how you do it
jpjenkins
jpjenkins
@jpjenkins
Nov 07 2015 17:45
close
Markus Kiili
@Masd925
Nov 07 2015 17:45
@jpjenkins well, you can return such a value from a function that has a call to another function. Javascript will call it and get the return value from there and proceed. On recursion the function just happends to be the same function.
Arnis Jaundzeikars
@SangSatori
Nov 07 2015 17:45
Well, ternary operator allows to do the heavy lifting in a single line if using recursion. Also, add ``` (three backticks) before and after code while posting here - it will ensure nicer formating.
jpjenkins
@jpjenkins
Nov 07 2015 17:46
It's probably something that I'm not going to fully understand in one night but it's good to have it in the box of possible tricks for a later date anyway
@cbgesbocker again, you need to watch your method of multiplying
you're still doing:
5 times 1
20 times 2
the wrong way round, you see?
Markus Kiili
@Masd925
Nov 07 2015 17:48
@cbgesbocker Just return fac instead of last two lines.
jpjenkins
@jpjenkins
Nov 07 2015 17:49
actually, have I got that mixed up too? ...
no no, just my math is wrong in the example
Rex Schrader
@SaintPeter
Nov 07 2015 17:50
@abhisekp Not sure why you mentioned me and then struck my name out?
Abhisek Pattnaik
@abhisekp
Nov 07 2015 17:51
@SaintPeter lol just testing :P
DELETE
jpjenkins
@jpjenkins
Nov 07 2015 17:52
testing his hacks more like, are your passwords still secure @SaintPeter ;)
Rex Schrader
@SaintPeter
Nov 07 2015 17:52
Dangit, I knew I shouldn't use password123 anymore
SaintPeter @SaintPeter changes his password to abhisekpStinks
Rex Schrader
@SaintPeter
Nov 07 2015 17:54
This message was deleted
Abhisek Pattnaik
@abhisekp
Nov 07 2015 17:55
@SaintPeter lol won't work that way
. @SaintPeter .
Rex Schrader
@SaintPeter
Nov 07 2015 17:55
Darnit, my "list" will have to wait :D
jpjenkins
@jpjenkins
Nov 07 2015 17:57
:)
bcaustin
@bcaustin
Nov 07 2015 18:04
if anyone lives in Memphis I have a new Code Camp.Memphis page on Facebook, https://www.facebook.com/free.code.camp.memphis/
navya-polishetti
@navya-polishetti
Nov 07 2015 18:17
hello, could anyone help me with the code explanation for this snippet... How does the compiler know that the expression it has to use is the above string
return testString.match(expression).length;
roadlesstraveled
@roadlesstraveled
Nov 07 2015 18:18
Can anyone help me with something?
navya-polishetti
@navya-polishetti
Nov 07 2015 18:18

var test = (function() {

var testString = "There are 3 cats but 4 dogs.";

// Only change code below this line.

var expression = /d+/g;

// Only change code above this line.

return testString.match(expression).length;

})();(function(){return test;})();

this is my code
roadlesstraveled
@roadlesstraveled
Nov 07 2015 18:18
<style>
h2 {color: blue;}
<h2>CatPhotoApp</h2>
</style> It is asking me to make the h2 element blue but I already did that. It won't let me progress
Aleksander Gębicki
@Takumar
Nov 07 2015 18:19
@roadlesstraveled remove <h2>CatPhotoApp</h2> from <style> ... </style> section. Move it down.
cbgesbocker
@cbgesbocker
Nov 07 2015 18:19

function palindrome(str) {

function reverse(s){
return str.split("").reverse().join("");
}

var pal = reverse(str);

if (pal == str){
return true;

}
else{
return false;
}
}

whats wrong with this code?
roadlesstraveled
@roadlesstraveled
Nov 07 2015 18:20
I was wondering if that had something to do with it. Thank you!
CamperBot
@camperbot
Nov 07 2015 18:20
if you want to thank someone, put an @ before their name!
Aleksander Gębicki
@Takumar
Nov 07 2015 18:20
@cbgesbocker you have to remove some things from your string. Leave only digits and characters.
cbgesbocker
@cbgesbocker
Nov 07 2015 18:22
remove the spaces?
Aleksander Gębicki
@Takumar
Nov 07 2015 18:23
@cbgesbocker yes, leave only something like this: "asd6d785asd"
cbgesbocker
@cbgesbocker
Nov 07 2015 18:25
var newstr = str.replace(/" "/, "");
did this and didnt work.
Aleksander Gębicki
@Takumar
Nov 07 2015 18:27
Work a little on regular expressions.
http://regexone.com/
Rita
@Romperss
Nov 07 2015 18:32
Hello fellow campers, I'm working on some easy r/dailyprogrammer challeges and (I hope it's okay to ask this here) on my first try at setting up a template for these challenges, I can't get the function to run. I think something is not "hooked up." Can someone take a look at my codepen and tell me what I'm missing? Thanks in advance, R
Rory Smith
@alanbuchanan
Nov 07 2015 18:39
@Romperss looks like it's working ok, check out your console
@Romperss perhaps this would be a better environment for such a task https://repl.it/BXvD
Rita
@Romperss
Nov 07 2015 18:43
Thanks @alanbuchanan . I guess I don't know how to get to the console? (#neub) I'll check out the link you sent now...
CamperBot
@camperbot
Nov 07 2015 18:43
romperss sends brownie points to @alanbuchanan :sparkles: :thumbsup: :sparkles:
:star: 491 | @alanbuchanan | http://www.freecodecamp.com/alanbuchanan
psicogod
@psicogod
Nov 07 2015 18:47
$($('.slot')[0]).html('<img src = "http://i.imgur.com/9H17QFk.png' + images[slotOne-1] + '">');
$($('.slot')1).html('<img src = "http://i.imgur.com/9RmpXTy.png' + images[slotTwo-1] + '">');
$($('.slot')[2]).html('<img src = "http://i.imgur.com/VJnmtt5.png' + images[slotThree-1] + '">');
why it doesnt work?
Rory Smith
@alanbuchanan
Nov 07 2015 18:47
wiki format
CamperBot
@camperbot
Nov 07 2015 18:47

:point_right: code format [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 and then press [shift + enter ⏎]

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

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

How to Code

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

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

Rita
@Romperss
Nov 07 2015 18:47
Thank you @alanbuchanan . I do know how to use the console on web browsers, thanks! I wanted to do these little projects on codepen but am new to codepen... guess that's not the place to do these.
CamperBot
@camperbot
Nov 07 2015 18:48
romperss sends brownie points to @alanbuchanan :sparkles: :thumbsup: :sparkles:
:warning: romperss already gave alanbuchanan points
Rory Smith
@alanbuchanan
Nov 07 2015 18:49
@Romperss i was just thinking repl.it might be better for such a task as it doesn't require any css or html
codepen is best for using all 3
Rita
@Romperss
Nov 07 2015 18:51
I see, got it, thanks!!!!
CamperBot
@camperbot
Nov 07 2015 18:51
if you want to thank someone, put an @ before their name!
psicogod
@psicogod
Nov 07 2015 18:56
can someone help me with a JS problem i ogt?
got*
h4r1m4u
@h4r1m4u
Nov 07 2015 18:57
what's the issue @psicogod ?
psicogod
@psicogod
Nov 07 2015 18:58
in the JS ecercise: Give your javascript slot machine some stylish images
im always getting an error
"Use the provided code three times. One for each slot."
which i did already
h4r1m4u
@h4r1m4u
Nov 07 2015 18:59
could you post your code?
or paste the url from your browser? i can have a look at it
psicogod
@psicogod
Nov 07 2015 18:59
sure
http://www.freecodecamp.com/challenges/waypoint-give-your-javascript-slot-machine-some-stylish-images#?solution=fccss%0A%20%20function%20runSlots()%7B%0A%20%20%20%20var%20slotOne%3B%0A%20%20%20%20var%20slotTwo%3B%0A%20%20%20%20var%20slotThree%3B%0A%20%20%20%20%0A%20%20%20%20var%20images%20%3D%20%5B%22http%3A%2F%2Fi.imgur.com%2F9H17QFk.png%22%2C%20%22http%3A%2F%2Fi.imgur.com%2F9RmpXTy.png%22%2C%20%22http%3A%2F%2Fi.imgur.com%2FVJnmtt5.png%22%5D%3B%0A%20%20%20%20%0A%20%20%20%20slotOne%20%3D%20Math.floor(Math.random()%20*%20(3%20-%201%20%2B%201))%20%2B%201%3B%0A%20%20%20%20slotTwo%20%3D%20Math.floor(Math.random()%20*%20(3%20-%201%20%2B%201))%20%2B%201%3B%0A%20%20%20%20slotThree%20%3D%20Math.floor(Math.random()%20*%20(3%20-%201%20%2B%201))%20%2B%201%3B%0A%20%20%20%20%0A%20%20%20%20%24('.logger').html('')%3B%0A%20%20%20%20%24('.logger').html('Not%20A%20Win')%3B%0A%20%20%20%20%0A%20%20%20%20%2F%2F%20Only%20change%20code%20below%20this%20line.%0A%20%20%20%24(%24('.slot')%5B0%5D).html('%3Cimg%20src%20%3D%20%22http%3A%2F%2Fi.imgur.com%2F9H17QFk.png'%20%2B%20images%5BslotOne-1%5D%20%2B%20'%22%3E')%3B%0A%20%20%20%24(%24('.slot')%5B1%5D).html('%3Cimg%20src%20%3D%20%22http%3A%2F%2Fi.imgur.com%2F9RmpXTy.png'%20%2B%20images%5BslotTwo-1%5D%20%2B%20'%22%3E')%3B%0A%20%20%20%24(%24('.slot')%5B2%5D).html('%3Cimg%20src%20%3D%20%22http%3A%2F%2Fi.imgur.com%2FVJnmtt5.png'%20%2B%20images%5BslotThree-1%5D%20%2B%20'%22%3E')%3B%0A%20%20%20%20%0A%20%20%20%20%2F%2F%20Only%20change%20code%20above%20this%20line.%0A%20%20%20%20%0A%20%20%20%20if%20(slotOne%20%3D%3D%3D%20slotTwo%20%26%26%20slotTwo%20%3D%3D%3D%20slotThree)%20%7B%0A%20%20%20%20%20%20return%20slotOne%3B%0A%20%20%20%20%7D%0A%20%20%20%20%0A%20%20%20%20if(slotOne%20!%3D%3D%20undefined%20%26%26%20slotTwo%20!%3D%3D%20undefined%20%26%26%20slotThree%20!%3D%3D%20undefined)%7B%0A%20%20%20%20%20%20%24('.logger').html(slotOne)%3B%0A%20%20%20%20%20%20%24('.logger').append('%20'%20%2B%20slotTwo)%3B%0A%20%20%20%20%20%20%24('.logger').append('%20'%20%2B%20slotThree)%3B%0A%20%20%20%20%7D%0A%20%20%20%20%0A%20%20%20%20return%20%5BslotOne%2C%20slotTwo%2C%20slotThree%5D%3B%0A%20%20%7D%0A%0A%20%20%24(document).ready(function()%7B%0A%20%20%20%20%20%24('.go').click(function()%7B%0A%20%20%20%20%20%20%20runSlots()%3B%0A%20%20%20%20%20%7D)%3B%0A%20%20%20%7D)%3B%0Afcces%0A%20%0A%3Cdiv%3E%0A%20%3Cdiv%20class%20%3D%20'container%20inset'%3E%0A%20%20%20%3Cdiv%20class%20%3D%20'header%20inset'%3E%0A%20%20%20%20%20%3Cimg%20src%3D'https%3A%2F%2Fs3.amazonaws.com%2Ffreecodecamp%2Ffreecodecamp_logo.svg.gz'%20alt%3D'learn%20to%20code%20javascript%20at%20Free%20Code%20Camp%20logo'%20class%3D'img-responsive%20nav-logo'%3E%0A%20%20%20%20%20%3Ch2%3EFCC%20Slot%20Machine%3C%2Fh2%3E%0A%20%20%20%3C%2Fdiv%3E%0A%20%20%20%3Cdiv%20class%20%3D%20'slots%20inset'%3E%0A%20%20%20%20%20%3Cdiv%20class%20%3D%20'slot%20inset'%3E%0A%20%20%20%20%20%20%20%0A%20%20%20%20%20%3C%2Fdiv%3E%0A%20%20%20%20%20%3Cdiv%20class%20%3D%20'slot%20inset'%3E%0A%20%20%20%20%20%20%20%0A%20%20%20%20%20%3C%2Fdiv%3E%0A%20%20%20%20%20%3Cdiv%20class%20%3D%20'slot%20inset'%3E%0A%20%20%20%20%20%20%20%0A%20%20%20%20%20%3C%2Fdiv%3E%0A%20%20%20%3C%2Fdiv%3E%0A%20%20%20%3Cbr%2F%3E%0A%20%20%20%3Cdiv%20class%20%3D%20'outset'%3E%0A%20%20%20%20%20%3Cbutton%20class%20%3D%20'go%20inset'%3E%0A%20%20%20%20%20%20%20Go%0A%20%20%20%20%20%3C%2Fbutton%3E%0A%20%20%20%3C%2Fdiv%3E%0A%20%20%20%3Cbr%2F%3E%0A%20%20%20%3Cdiv%20class%20%3D%20'foot%20inset'%3E%0A%20%20%20%20%20%3Cspan%20class%20%3D%20'logger'%3E%3C%2Fspan%3E%0A%20%20%20%3C%2Fdiv%3E%0A%20%3C%2Fdiv%3E%0A%3C%2Fdiv%3E%0A%0A%3Cstyle%3E%0A%20.slot%20%3E%20img%20%7B%0A%20%20margin%3A%200!important%3B%0A%20%20height%3A%2071px%3B%0A%20%20width%3A%2050px%3B%0A%20%7D%0A%20.container%20%7B%0A%20%20%20background-color%3A%20%234a2b0f%3B%0A%20%20%20height%3A%20400px%3B%0A%20%20%20width%3A%20260px%3B%0A%20%20%20margin%3A%2050px%20auto%3B%0A%20%20%20border-radius%3A%204px%3B%0A%20%7D%0A%20.header%20%7B%0A%20%20%20border%3A%202px%20solid%20%23fff%3B%0A%20%20%20border-radius%3A%204px%3B%0A%20%20%20height%3A%2055px%3B%0A%20%20%20margin%3A%2014px%20auto%3B%0A%
x
h4r1m4u
@h4r1m4u
Nov 07 2015 19:00
hmm, it's not opening for me. it just shows an empty code pane
psicogod
@psicogod
Nov 07 2015 19:01
should i paste the code?
h4r1m4u
@h4r1m4u
Nov 07 2015 19:01
yes please
psicogod
@psicogod
Nov 07 2015 19:01
<script>
function runSlots(){
var slotOne;
var slotTwo;
var slotThree;

var images = ["http://i.imgur.com/9H17QFk.png", "http://i.imgur.com/9RmpXTy.png", "http://i.imgur.com/VJnmtt5.png"];

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

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

// Only change code below this line.
$($('.slot')[0]).html('<img src = "http://i.imgur.com/9H17QFk.png' + images[slotOne-1] + '">');
$($('.slot')[1]).html('<img src = "http://i.imgur.com/9RmpXTy.png' + images[slotTwo-1] + '">');
$($('.slot')[2]).html('<img src = "http://i.imgur.com/VJnmtt5.png' + images[slotThree-1] + '">');

// Only change code above this line.

if (slotOne === slotTwo && slotTwo === slotThree) {
return slotOne;
}

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

return [slotOne, slotTwo, slotThree];
}

$(document).ready(function(){
$('.go').click(function(){
runSlots();
});
});
</script>
h4r1m4u
@h4r1m4u
Nov 07 2015 19:03
ah
ok
Rory Smith
@alanbuchanan
Nov 07 2015 19:03
wiki format
CamperBot
@camperbot
Nov 07 2015 19:03

:point_right: code format [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 and then press [shift + enter ⏎]

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

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

How to Code

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

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

Rory Smith
@alanbuchanan
Nov 07 2015 19:03
please post like that
h4r1m4u
@h4r1m4u
Nov 07 2015 19:03
you don't need to put in the img URLs @psicogod that's what these parts do for you images[slotOne-1]
check the sample provided to you in the sidebar and how it differs from your code
Aaron Freidus
@shadowfool
Nov 07 2015 19:04
Thanks @Rafase282 & Thanks @Shadowfool
CamperBot
@camperbot
Nov 07 2015 19:04
if you want to thank someone, put an @ before their name!
Aaron Freidus
@shadowfool
Nov 07 2015 19:05
Thanks @Rafase282 & Thanks @Shadowfool
CamperBot
@camperbot
Nov 07 2015 19:05
shadowfool sends brownie points to @rafase282 and @ :sparkles: :thumbsup: :sparkles:
:star: 614 | @rafase282 | http://www.freecodecamp.com/rafase282
psicogod
@psicogod
Nov 07 2015 19:05
@h4r1m4u oh ok thx m8!
CamperBot
@camperbot
Nov 07 2015 19:05
psicogod sends brownie points to @h4r1m4u :sparkles: :thumbsup: :sparkles:
:star: 570 | @h4r1m4u | http://www.freecodecamp.com/h4r1m4u
Rafael J. Rodriguez
@Rafase282
Nov 07 2015 19:06
@shadowfool you can't thank yourself ;-)
CamperBot
@camperbot
Nov 07 2015 19:06
rafase282 sends brownie points to @shadowfool :sparkles: :thumbsup: :sparkles:
:star: 306 | @shadowfool | http://www.freecodecamp.com/shadowfool
h4r1m4u
@h4r1m4u
Nov 07 2015 19:06
@psicogod you're welcome. you understand why it's so, right? the img URLs are stored in the images array and with this code images[slotOne-1] you select one of the URLs
yeah, no eaterino your own cookerino!
psicogod
@psicogod
Nov 07 2015 19:07
@h4r1m4u yeah i got it didnt realise it x
h4r1m4u
@h4r1m4u
Nov 07 2015 19:08
great! just making sure
Elise
@eliseb1
Nov 07 2015 19:28
Help! I don't know what's wrong with my code in waypoint 6 of jQuery. I typed in: $(document).ready(function() { $("button").addClass(animated) $(".btn").addClass(shake) $("#target1").addClass(btn-primary) }); and am getting that "Your #target1 element should have the classes animated‚ shake and btn-primary."
CamperBot
@camperbot
Nov 07 2015 19:28
no wiki entry for: i dont know whats wrong with my code in waypoint 6 of jquery i typed in documentreadyfunction buttonaddclassanimatedbtnaddclassshaketarget1addclassbtn-primary and am getting that your target1 element should have the classes animated shake and btn-primary
:pencil: click here to create one now!after creating your page type update to reload it here
h4r1m4u
@h4r1m4u
Nov 07 2015 19:28
@eliseb1 the class names need to be wrapped in quotes
otherwise you're passing variables to the addClass methods
Elise
@eliseb1
Nov 07 2015 19:29
ohh well thank you
CamperBot
@camperbot
Nov 07 2015 19:29
if you want to thank someone, put an @ before their name!
Elise
@eliseb1
Nov 07 2015 19:29
@h4r1m4u thanks for pointing that out!
h4r1m4u
@h4r1m4u
Nov 07 2015 19:29
no problem
jpjenkins
@jpjenkins
Nov 07 2015 19:33
Someone introduced me to the idea of ternary conditions earlier. I came back to it and have a couple of questions. Here's the line of code that started the brain melt:
return num === 0 ? 1 : num * factorialize(num - 1);
So, obviously the two sides of the colon are just the true or false returns. What I'm trying to wrap my head around is variable that separates the value of the 'num' being multiplied and the decrementing num that's inside the factorialise statement.
I did some tests and found that 'num' is separate from 'factorialize(num)'
(if I did : return num === 0 ? 1 : num * (num - 1);the result would mess up)
h4r1m4u
@h4r1m4u
Nov 07 2015 19:35
@jpjenkins "variable that separates the value of the 'num' being multiplied"? which variable ?
This message was deleted
jpjenkins
@jpjenkins
Nov 07 2015 19:36
I suppose that's where I'm stumped @h4r1m4u , is there a variable? What separates the 2 values, the one storing the incrementing value and the value of num itself
h4r1m4u
@h4r1m4u
Nov 07 2015 19:37
i'm sorry, i'm confused. i'm not sure what you're referring to. what do you mean by the one storing the incrementing value?
jpjenkins
@jpjenkins
Nov 07 2015 19:37
there's one value going: 5,4,3,2,1 and another going 20, 60 , 120...
Bonfire: factorialize a number
CamperBot
@camperbot
Nov 07 2015 19:37

:fire:Bonfire: Factorialize a Number :link:

function factorialize(num) {
  return num;
}

factorialize(5);

Return the factorial of the provided integer.

more info:  bf details | bf links | hint

h4r1m4u
@h4r1m4u
Nov 07 2015 19:37
ah, ok. i think what you mean now
jpjenkins
@jpjenkins
Nov 07 2015 19:38
Of coures, up until now I've been trained to state a variable for 2 values that change. But here, magic happens
h4r1m4u
@h4r1m4u
Nov 07 2015 19:38
nothing stores the result. the function uses recursion. meaning that from within the function you're calling the same function for a slightly different value
these calls will chain, until one of them returns an actual value
then the value of the entire chain of functions will be calculated back
jpjenkins
@jpjenkins
Nov 07 2015 19:39
'actual value' being when num -1 reaches 0?
h4r1m4u
@h4r1m4u
Nov 07 2015 19:39
that's right, in this case yes
so that will be your first result. then the chain will go back one step and calculate the value again
jpjenkins
@jpjenkins
Nov 07 2015 19:40
so, in the case of the line num * factorialize(num-1) what's separating the multiplying num and the num withing the brackets?
h4r1m4u
@h4r1m4u
Nov 07 2015 19:41
i'm not sure what you mean by the separation
David Franco
@franco3131
Nov 07 2015 19:41
Hi, im having trouble adding an engines property with a number value to the myCar instance... if car is an object and I create a new instance of that object (var myCar= new Car()) , how can I add an engines property to myCar instance ... ? I keep on getting error
Numble Fingers
@numfin
Nov 07 2015 19:41
Bonfire: Chunky Monkey
CamperBot
@camperbot
Nov 07 2015 19:41

: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

Numble Fingers
@numfin
Nov 07 2015 19:41
bf links Bonfire: Chunky Monkey
CamperBot
@camperbot
Nov 07 2015 19:41
Sorry, can't find a bonfire called links bonfire chunky monkey. [ Check the map? ]
Numble Fingers
@numfin
Nov 07 2015 19:41
bf links
CamperBot
@camperbot
Nov 07 2015 19:41
links:
Numble Fingers
@numfin
Nov 07 2015 19:42
hint
CamperBot
@camperbot
Nov 07 2015 19:42
:construction: Spoilers are only in the Bonfire's Custom Room :point_right:
h4r1m4u
@h4r1m4u
Nov 07 2015 19:42
@franco3131 if myDog was an object, i could give it a property legs like so: myDog.legs = 4;
jpjenkins
@jpjenkins
Nov 07 2015 19:42
In a recursion, the first would essentially be: 5 * factorialise(5-1) but on the second it would be 20 * factorialise(4-1)
one num is 20, the other is 4
h4r1m4u
@h4r1m4u
Nov 07 2015 19:42
nope, that's not how it works.
jpjenkins
@jpjenkins
Nov 07 2015 19:43
okay, then I'm more confused than I thought then :) I thought the 2 nums were at least separated by the fact that it stated 'factorialise' before the second num
h4r1m4u
@h4r1m4u
Nov 07 2015 19:44
1) 5 * factor(4);
2) 5 * 4 * factor(3);
3) 5 * 4 * 3 * factor(2);
4) 5 * 4 * 3 * 2 * factor(1);
5) 5 * 4 * 3 * 2 * 1 * factor(1);
6) 5 * 4 * 3 * 2 * 1 * 1;
damn the formatting
David Franco
@franco3131
Nov 07 2015 19:44
Thanks! @h4r1m4u it worked!
CamperBot
@camperbot
Nov 07 2015 19:44
franco3131 sends brownie points to @h4r1m4u :sparkles: :thumbsup: :sparkles:
:star: 571 | @h4r1m4u | http://www.freecodecamp.com/h4r1m4u
h4r1m4u
@h4r1m4u
Nov 07 2015 19:44
@franco3131 my pleasure
jpjenkins
@jpjenkins
Nov 07 2015 19:44
yeah I gotcha though :) but what decrements the first num?
h4r1m4u
@h4r1m4u
Nov 07 2015 19:46
@jpjenkins it's just a "substitution".
1) 5 * factor(4); now what is the result of factor(4) function? according to our code it's 4 * factor(3)
hence
2) 5 * factor(4) = 5 * (4 * factor(3));
etc.
jpjenkins
@jpjenkins
Nov 07 2015 19:47
I see, so the numbers that will eventually be calculated at the end are just in the background somewhere?
h4r1m4u
@h4r1m4u
Nov 07 2015 19:47
the factor function gets recursively called until the recursion reaches factor(0), for which it will return 1 and not another factor() function
think of it as bungee jumping. you jump off, then fall fall fall, until you hit bottom (factor(0) which equals 1). then you bounce back and start flying back to the top, calculating the previous function because now you have actual values to work with
jpjenkins
@jpjenkins
Nov 07 2015 19:51
so the multiplication, as you stated at '6' above, only executes once the whole thing has ended?
h4r1m4u
@h4r1m4u
Nov 07 2015 19:51
as the recursion happens, the computer will hold all the functions in memory. once it reaches factor(0) and another factor() is not called, it will start rolling back, calculating the values of the functions it stored in the memory so far
that's right
jpjenkins
@jpjenkins
Nov 07 2015 19:51
ah okay, that's a good explanation there :)
h4r1m4u
@h4r1m4u
Nov 07 2015 19:51
because until then you don't know the result
you just know some numbers and another function
it could be that factor(0) = 'some string'
jpjenkins
@jpjenkins
Nov 07 2015 19:52
there essentially can't be a 'return' until all the numbers have been gathered to calculate?
h4r1m4u
@h4r1m4u
Nov 07 2015 19:53
yeah. it's the same as if you were calculating it as a human. you're not able to get the result until you reach the end of the recursion
Aaron Freidus
@shadowfool
Nov 07 2015 19:53
@Rafase282 haha I was testing it out :p
h4r1m4u
@h4r1m4u
Nov 07 2015 19:54
only then you can roll back step by step and calculate the final value from bottom up
jpjenkins
@jpjenkins
Nov 07 2015 19:54
You should save that explanation... you're better than google @h4r1m4u :) thanks
CamperBot
@camperbot
Nov 07 2015 19:54
jpjenkins sends brownie points to @h4r1m4u :sparkles: :thumbsup: :sparkles:
:star: 572 | @h4r1m4u | http://www.freecodecamp.com/h4r1m4u
h4r1m4u
@h4r1m4u
Nov 07 2015 19:54
lol
glad you found it helpful
jpjenkins
@jpjenkins
Nov 07 2015 19:54
Nothing I found really explained it though, it was really strange
there are only 'true:false' explanations for elementary if-then-else possibilities
h4r1m4u
@h4r1m4u
Nov 07 2015 19:55
i'm surprised. factorial is always recursion 101 when learning any language
jpjenkins
@jpjenkins
Nov 07 2015 19:55
is this kind of ternary operator unique to javascript?
h4r1m4u
@h4r1m4u
Nov 07 2015 19:55
no, it isn't
it's in other languages too
i'm not sure if you were thrown by the ternary operator or by the recursion itself?
jpjenkins
@jpjenkins
Nov 07 2015 19:56
the recursion yeah, just the way it handled the actual values
h4r1m4u
@h4r1m4u
Nov 07 2015 19:56
right, ok
jpjenkins
@jpjenkins
Nov 07 2015 19:56
I couldn't get my head around it, I'm so used to a value being 'stored'
then calculated each step
That to me WAS recursion
h4r1m4u
@h4r1m4u
Nov 07 2015 19:57
right. that's the beauty of recursion functions
one take away from this is that you always want to define some sort of an end state for the recursion
otherwise it'll just keep going and never stop
and your browser will freeze
jpjenkins
@jpjenkins
Nov 07 2015 19:58
Yeah, my first presumption was it would have to be a statement that would inevitably go down to 0
essentially the 'condition'
h4r1m4u
@h4r1m4u
Nov 07 2015 19:59
got it
jpjenkins
@jpjenkins
Nov 07 2015 20:00
you saved me hours, thanks for explaining it to me, really appreciate it
CamperBot
@camperbot
Nov 07 2015 20:00
if you want to thank someone, put an @ before their name!
h4r1m4u
@h4r1m4u
Nov 07 2015 20:00
you're most welcome
Numble Fingers
@numfin
Nov 07 2015 20:03
function chunk(arr, size) {
  var i=0; var newArray = [];
  while(i<arr.length){
    newArray.push(arr.slice(i,size));
    i+=size;
  }
  return newArray;
}

chunk(["a", "b", "c", "d"], 2);
why this returns only first 2 items?
chermandu
@chermandu
Nov 07 2015 20:06
How do I show an image here in chat? Should I use imgur? I need some help :D
h4r1m4u
@h4r1m4u
Nov 07 2015 20:06
@numfin using your example, tell me what are the values of i and size on the second run of the for loop:
 newArray.push(arr.slice(i,size));
what will the arr.slice() function actually look like?
Aleksander Gębicki
@Takumar
Nov 07 2015 20:08
@chermandu just drag your image onto gitter chat window or even better copy and paste your code here.
Numble Fingers
@numfin
Nov 07 2015 20:08
@h4r1m4u my english is bad. but i did it with this
newArray.push(arr.slice(i,i+size));
h4r1m4u
@h4r1m4u
Nov 07 2015 20:08
cool. that's what i wanted to get you to eventually. glad you figured it out on your own
Fennek
@fennekbe
Nov 07 2015 20:09
How can I add a dash between inline li items? If I use :before or :after it means i will have 1 dash sticking out at the front or the end. Anyone got some advice?
Numble Fingers
@numfin
Nov 07 2015 20:09
@h4r1m4u thank you
CamperBot
@camperbot
Nov 07 2015 20:09
numfin sends brownie points to @h4r1m4u :sparkles: :thumbsup: :sparkles:
:star: 573 | @h4r1m4u | http://www.freecodecamp.com/h4r1m4u
h4r1m4u
@h4r1m4u
Nov 07 2015 20:10
@fennekbe look up last-of-type or first-of-type CSS selector
Fennek
@fennekbe
Nov 07 2015 20:10
@h4r1m4u alright, thank you
CamperBot
@camperbot
Nov 07 2015 20:10
fennekbe sends brownie points to @h4r1m4u :sparkles: :thumbsup: :sparkles:
:star: 574 | @h4r1m4u | http://www.freecodecamp.com/h4r1m4u
Fennek
@fennekbe
Nov 07 2015 20:10
@h4r1m4u What do you think of the idea? Looks good or rather miserable? Be honest! :) http://www.qbyte.be/webdevelopment
chermandu
@chermandu
Nov 07 2015 20:10
@Takumar ohh thanks man. So basically, I'm on the jQuery part right now, but I figured that I might as well practice HTML/CSS before moving forward. I'm currently doing a family tree website and I'm confused on how do I create something like this:
CamperBot
@camperbot
Nov 07 2015 20:10
chermandu sends brownie points to @takumar :sparkles: :thumbsup: :sparkles:
:star: 651 | @takumar | http://www.freecodecamp.com/takumar
Fennek
@fennekbe
Nov 07 2015 20:11
(still a lot of work)
chermandu
@chermandu
Nov 07 2015 20:11
img+button help.jpg
Elizabeth Hatleli
@TheHighPriestess
Nov 07 2015 20:11
Has anyone here done the Bonfire...Exact Change?
I know how to get the total amount in the cash register AND the change due...
h4r1m4u
@h4r1m4u
Nov 07 2015 20:12
@fennekbe it obviously needs works, but it's starting to take shape
Elizabeth Hatleli
@TheHighPriestess
Nov 07 2015 20:12
I'm wondering though....on how exactly to take the change due out of the "cash register".
h4r1m4u
@h4r1m4u
Nov 07 2015 20:12
@fennekbe i like the top menu and the header image underneath. that looks neat
Fennek
@fennekbe
Nov 07 2015 20:12
Great :)
h4r1m4u
@h4r1m4u
Nov 07 2015 20:13
i'd probably make the logo background transparent, so that it's not a grey rectangle
Fennek
@fennekbe
Nov 07 2015 20:13
It's not the background, i put it there with css. Thought it looked nice
Bill
@kirah1314
Nov 07 2015 20:13
@chermandu have you looked at bootstrap?
h4r1m4u
@h4r1m4u
Nov 07 2015 20:13
and i'd give more padding to the 'Quality...' text, so that it's not so close to the edges of the dark, semi-transparent background
Fennek
@fennekbe
Nov 07 2015 20:14
That's true, good idea
chermandu
@chermandu
Nov 07 2015 20:14
@kirah1314 yup, I still cant' figure it out
Fennek
@fennekbe
Nov 07 2015 20:14
@h4r1m4u How would you handle the content? Right now I just have a shadow but it seems out of place to me
h4r1m4u
@h4r1m4u
Nov 07 2015 20:14
you're right re the logo background, i didn't realize it CSS and not part of the image. still, i personally would prefer it without the background
i'd make it a 100% width stripe across the screen, similar to what you're doing with the header
Bill
@kirah1314
Nov 07 2015 20:15
@chermandu check out the first zipline, http://www.freecodecamp.com/challenges/zipline-build-a-personal-portfolio-webpage there's a template to help you get started
h4r1m4u
@h4r1m4u
Nov 07 2015 20:15
use different color backgrounds to separate the different sections
then keep the text flushed with the logo edge on one side and the menu end on the other
(like you have the shadow now). i just want to emphasize that the background color for the section should be 100% wide
Fennek
@fennekbe
Nov 07 2015 20:16
Which colors would you think are appropriate? I've tried it like that before but I couldn't find the right colors, it made it seem out of place
h4r1m4u
@h4r1m4u
Nov 07 2015 20:17
white. or different shades of gray
depends on how many sections you have
Fennek
@fennekbe
Nov 07 2015 20:17
@h4r1m4u I'll try it out. Thanks for the advice again. I can go at it for a while again haha
CamperBot
@camperbot
Nov 07 2015 20:17
fennekbe sends brownie points to @h4r1m4u :sparkles: :thumbsup: :sparkles:
:warning: fennekbe already gave h4r1m4u points
h4r1m4u
@h4r1m4u
Nov 07 2015 20:18
you already use the dark red (footer) and lighter red (menu), so i wouldn't throw more colors at it.
cool. my pleasure
Fennek
@fennekbe
Nov 07 2015 20:19
@h4r1m4u on a side note, could you tell me the name of whatever I need to google to for example make an image pop up or activate some animation only when I scroll far enough down to see it?
chermandu
@chermandu
Nov 07 2015 20:20
@kirah1314 I think I'm more confused than before haha. What exactly am I looking at? :smile:
h4r1m4u
@h4r1m4u
Nov 07 2015 20:21
@fennekbe hmm, there are some libraries that can detect whether a certain element is visible in the viewport
Bill
@kirah1314
Nov 07 2015 20:21
@chermandu oh haha, you wanted to build something with an image and button under it so you need a place to build it
h4r1m4u
@h4r1m4u
Nov 07 2015 20:21
i can't remember the name of the library i came across before
Bill
@kirah1314
Nov 07 2015 20:21
@chermandu are you using codepen? if not then, use it
@chermandu then there's a link to a template FCC created which gives you a layout to start: http://codepen.io/FreeCodeCamp/pen/mJNqQj/
h4r1m4u
@h4r1m4u
Nov 07 2015 20:22
@fennekbe i'd probably search for something like how to detect whether element is visible on screen or ...whether element has scrolled into view
chermandu
@chermandu
Nov 07 2015 20:22
@kirah1314 im currently typing on sublime text :D
Bill
@kirah1314
Nov 07 2015 20:23
@chermandu sublime is for JS part, but you'll need to build html and css too which codepen provides
chermandu
@chermandu
Nov 07 2015 20:24
@kirah1314 got it. So I pasted my code into codepen. Now what? :D
Bill
@kirah1314
Nov 07 2015 20:25
@chermandu did you look at the FCC template? http://codepen.io/FreeCodeCamp/pen/mJNqQj/
@chermandu did you go through FCC's html and css waypoints?
chermandu
@chermandu
Nov 07 2015 20:28
@kirah1314 yup I did. What exactly I want to know is how do I put an image on top of a button inside a border.
Fennek
@fennekbe
Nov 07 2015 20:29
@h4r1m4u ah it's jquery, i didnt get to that yet, saved for later though
chermandu
@chermandu
Nov 07 2015 20:29
@kirah1314 Just like the cats on the FCC template, but a button instead of a <p>, and both of them inside a border
Bill
@kirah1314
Nov 07 2015 20:30
@chermandu you create div's then add an image and a button...
@chermandu do you see how the html codes are written here? http://codepen.io/FreeCodeCamp/pen/mJNqQj/
MirkaG
@MirkaG
Nov 07 2015 20:31

This code tells me that "Cannot read property 'length' of null" can anyone figure out what I'm missing?

<script>
function runSlots(){
var slotOne = 1;
var slotTwo = 2;
var slotThree = 3;

var images = ["http://i.imgur.com/9H17QFk.png", "http://i.imgur.com/9RmpXTy.png", "http://i.imgur.com/VJnmtt5.png"];

// Only change code below this line.

Math.floor(Math.random() * (3 - 1 + 1)) + 1;

// Only change code above this line.

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

if(slotOne !== undefined && slotTwo !== undefined && slotThree !== undefined){
$(".logger").html(slotOne + " " + slotTwo + " " + slotThree);
}
return [slotOne, slotTwo, slotThree];
}

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

<div>

<div class = "container inset">

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

<h2>FCC Slot Machine</h2>
</div>

<div class = "slots inset">

<div class = "slot inset">

</div>

<div class = "slot inset">

</div>

<div class = "slot inset">

</div>
</div>
<br/>

<div class = "outset">

<button class = "go inset">
Go
</button>
</div>
<br/>

<div class = "foot inset">
<span class = "logger"></span>
</div>
</div>
</div>

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

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

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

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

Bill
@kirah1314
Nov 07 2015 20:32
@chermandu
<div class="row">
    <div class="col-md-4">
      <h2>                        Heading                    </h2>
      <img class="img-responsive" src="https://scontent.cdninstagram.com/hphotos-xpa1/t51.2885-15/s480x480/e35/12120230_1660914670849910_809073269_n.jpg">
      <p>
        Kitty ipsum dolor sit amet, shed everywhere shed everywhere stretching attack your ankles chase the red dot, hairball run catnip eat the grass sniff.
      </p>
    </div>
@chermandu you add a button using <button> </button>
chermandu
@chermandu
Nov 07 2015 20:32
@kirah1314 can you check my code?
Bill
@kirah1314
Nov 07 2015 20:35

@chermandu it's a good start, move this

    h1, h3    {
                font-family: monospace;
                color: blue;
            }

            body {

            }

to the CSS section

chermandu
@chermandu
Nov 07 2015 20:36
@kirah1314 and the Bootstrap link stays on the <head> ?
Bill
@kirah1314
Nov 07 2015 20:38
@chermandu you can leave those there
@chermandu I gotta go eat, so keep hammering at it!
chermandu
@chermandu
Nov 07 2015 20:40
@kirah1314 thanks man! I will :D
CamperBot
@camperbot
Nov 07 2015 20:40
chermandu sends brownie points to @kirah1314 :sparkles: :thumbsup: :sparkles:
:star: 317 | @kirah1314 | http://www.freecodecamp.com/kirah1314
Bill
@kirah1314
Nov 07 2015 20:40
@chermandu check out other people's codepen's and look at how their codes are written and just play around with them
@chermandu and if you want to see the different html or css commands, check out this http://www.w3schools.com/
Ed Sztukowski
@Burgustu
Nov 07 2015 20:44
bf Comfirm the Ending
CamperBot
@camperbot
Nov 07 2015 20:44
Sorry, can't find a bonfire called comfirm the ending. [ Check the map? ]
Ed Sztukowski
@Burgustu
Nov 07 2015 20:44
bf Confirm the Ending
CamperBot
@camperbot
Nov 07 2015 20:44

:fire:Bonfire: Confirm the Ending :link:

function end(str, target) {
  // "Never give up and good luck will find you."
  // -- Falcor
  return str;
}

end('Bastian', 'n');

Check if a string (first argument) ends with the given target string (second argument).

more info:  bf details | bf links | hint

Ed Sztukowski
@Burgustu
Nov 07 2015 20:44
so I think I found a really overly simple solution to this, but I’m not sure if that’s what they wanted me to do?
using .endsWith()
is there a reason you wouldn’t want to use that?
function end(str, target) {
  return str.endsWith(target);
}

end("He has to give me a new name", "name");
Arnis Jaundzeikars
@SangSatori
Nov 07 2015 20:51
ES6! :sparkles:
Ed Sztukowski
@Burgustu
Nov 07 2015 20:52
so compatability is the major concern here I’d guess
Arnis Jaundzeikars
@SangSatori
Nov 07 2015 20:56
Well, out in the big wide real world you can compile lots of ES6 code down to ES5-compilant code with tools like Babel.js, so it's not that much of an issue now, I think.
Ed Sztukowski
@Burgustu
Nov 07 2015 20:57
Interesting, thanks @SangSatori !
CamperBot
@camperbot
Nov 07 2015 20:57
burgustu sends brownie points to @sangsatori :sparkles: :thumbsup: :sparkles:
:star: 215 | @sangsatori | http://www.freecodecamp.com/sangsatori
chermandu
@chermandu
Nov 07 2015 21:09
Hey guys, can someone check my code? I'm trying to center a <div>
Erik Cohen
@cohenpts
Nov 07 2015 21:15
which div?
i highly recommend Pesticide for Chrome for CSS debugging
Pratik Sethi
@pratikSethi
Nov 07 2015 21:36
Hello !! can someone tell me about the exercises in jQuery ie waypoint using target class... So is it there a class named target in the background ???
Waypoint: Target Even Numbered Elements Using jQuery
Anyone ??? It will be great if you could spare a few mins :smile: thanks in advance
CamperBot
@camperbot
Nov 07 2015 21:38
if you want to thank someone, put an @ before their name!
Pratik Sethi
@pratikSethi
Nov 07 2015 21:39
very well @camperbot ... thankyou
No worries ... Thankyou :smile:
Fennek
@fennekbe
Nov 07 2015 21:48
@h4r1m4u You still around?
Nvm, literally just that moment I want to ask, i figure it out ;o
Rita
@Romperss
Nov 07 2015 21:58
This message was deleted
CamperBot
@camperbot
Nov 07 2015 21:58
:bulb: to format code use backticks! ``` more info
Rita
@Romperss
Nov 07 2015 22:02
function diff(arr1, arr2) {
  var newArr = arr1.concat(arr2);
  var finArr = [];

  for (i=0; i<newArr.length; i++){
    if (arr1.indexOf(newArr[i]) === -1 || arr2.indexOf(newArr[i]) === -1) {
      finArr.push(newArr[i])
    }
  }
  // Same, same; but different.
  return finArr
}

Can someone help my understand why this works? Specifically, the for loop:

for (i=0; i<newArr.length; i++){
    if (arr1.indexOf(newArr[i]) === -1 || arr2.indexOf(newArr[i]) === -1) {
      finArr.push(newArr[i])
    }

I think what it is doing is checking to see if an element of the concatenated newArray is missing in either the first or second array, and if it is missing in either, pushing it to the new finalArray. What I don't get is why use indexOf. Isn't checking for elements in/by position going to mess things up (since they will not be in the same positions once the arrays are concatenated)?

Really struggling to keep up here! Thanks in advance. R

CamperBot
@camperbot
Nov 07 2015 22:02
if you want to thank someone, put an @ before their name!
Fennek
@fennekbe
Nov 07 2015 22:03
is it normal behavior for my ul>li to go from last to first instead of first to last when I use float: right; ?
Rita
@Romperss
Nov 07 2015 22:03
This message was deleted
CamperBot
@camperbot
Nov 07 2015 22:03

:point_right: code format [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 and then press [shift + enter ⏎]

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

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

How to Code

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

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

Fennek
@fennekbe
Nov 07 2015 22:04
you need back quotes, not the regular ones
` these ones
@Romperss
Rita
@Romperss
Nov 07 2015 22:05
Got it, thanks @fennekbe !
CamperBot
@camperbot
Nov 07 2015 22:05
romperss sends brownie points to @fennekbe :sparkles: :thumbsup: :sparkles:
:star: 208 | @fennekbe | http://www.freecodecamp.com/fennekbe
Fennek
@fennekbe
Nov 07 2015 22:05
no worries
As for your question, I don't really understand what your problem is here. Could you rephrase?
Rita
@Romperss
Nov 07 2015 22:07
This message was deleted
@fennekbe Can you pseudocode talk me through what the conditional "if" line is doing, please?
Elliott McNary
@bighitbiker3
Nov 07 2015 22:11
This message was deleted
Rita
@Romperss
Nov 07 2015 22:12
If either condition one Or condition two is false, the function pushes to the finalArray, but what is happening with the indexOf statements?
arr1.indexOf(newArr[i]) === -1
here, we're iterating through all the items in the concatenated array, checking to see if the first item is the same in both arr1 and concat newArr, yes?
Jeremy Roe
@jeremyroe
Nov 07 2015 22:16
Thanks for Sharing @kotAPI - Hoping to finish mine this weekend if I can
CamperBot
@camperbot
Nov 07 2015 22:16
jeremyroe sends brownie points to @kotapi :sparkles: :thumbsup: :sparkles:
:star: 220 | @kotapi | http://www.freecodecamp.com/kotapi
Rex Schrader
@SaintPeter
Nov 07 2015 22:16
@Romperss You're checking to see if newArr[i] exists in arr - If indexOf finds it, it will return its index. If it doesn't find it, it returns -1.
@Romperss So your statement is "return true if newArr[i] doesn't exist in arr1"
Rita
@Romperss
Nov 07 2015 22:17
Thank you @SaintPeter -1 = false, didn't find it?
CamperBot
@camperbot
Nov 07 2015 22:17
romperss sends brownie points to @saintpeter :sparkles: :thumbsup: :sparkles:
:star: 1429 | @saintpeter | http://www.freecodecamp.com/saintpeter
Rex Schrader
@SaintPeter
Nov 07 2015 22:18
@Romperss Right - because remember that 0 is a valid index - it could be the first element in the array. So if it's not found it returns -1
roadlesstraveled
@roadlesstraveled
Nov 07 2015 22:19

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

<h2>CatPhotoApp</h2>

<p>Kitty ipsum dolor sit amet, shed everywhere shed everywhere stretching attack your ankles chase the red dot, hairball run catnip eat the grass sniff.</p>

It's asking me to create a CSS class called red-text
The above code is my attempt to do that
Isaac
@BenBagBag
Nov 07 2015 22:20
Can anybody help me with why this CSS doesn't push the child divs down to the bottom of the parent div? ````.c {
display: flex;
border: 1px black solid;
align-content: flex-end;
flex-direction: row;
justify-content: center;
}
''''
CamperBot
@camperbot
Nov 07 2015 22:20
:bulb: to format code use backticks! ``` more info
roadlesstraveled
@roadlesstraveled
Nov 07 2015 22:20
but it's not working
Rita
@Romperss
Nov 07 2015 22:20
thanks again, i think i got it. But i don't think I would have ever come up with this solution on my own. I'm really struggling with these bonefires and ziplines. Is it supposed to be really hard or do I need to go back and review everything? #discouraged
CamperBot
@camperbot
Nov 07 2015 22:20
if you want to thank someone, put an @ before their name!
Isaac
@BenBagBag
Nov 07 2015 22:20
.c { display: flex; border: 1px black solid; align-content: flex-end; flex-direction: row; justify-content: center; }
with the html: <div class="c"> <p>Block one</p> <p>Block two</p> </div>
why aren't the <p> elements at the bottom of the <div>?
align-content: flex-end doesn't seem to work
Rita
@Romperss
Nov 07 2015 22:22
maybe i just need to take it step by step and try to do the long version that is prob more intuitive
Venkat Polumahanti
@venkat4541
Nov 07 2015 22:23
@roadlesstraveled you also have to declare the class name in opening p tag
looks like this: <p class="classname">text</p>
roadlesstraveled
@roadlesstraveled
Nov 07 2015 22:25
Thank you @venkat4541
CamperBot
@camperbot
Nov 07 2015 22:25
roadlesstraveled sends brownie points to @venkat4541 :sparkles: :thumbsup: :sparkles:
:star: 168 | @venkat4541 | http://www.freecodecamp.com/venkat4541
Venkat Polumahanti
@venkat4541
Nov 07 2015 22:25
:)
roadlesstraveled
@roadlesstraveled
Nov 07 2015 22:30
Okay I don't think that's actually correct. I'm supposed to create a .red-text class and apply it to my h2 element. I'm not supposed to alter anything within the p tag I don't think.
Sorry @venkat4541 I don't think I explained it very well
Michael de los Reyes
@silvernpewter
Nov 07 2015 22:31
Hey @roadlesstraveled , I'm working on the same thing
I'm trying to figure it out, and I've tried to put the CSS element in different places unsuccessfully
Jason Wood
@catapixel
Nov 07 2015 22:33
@silvernpewter @roadlesstraveled I'll help you out. Which waypoint?
Michael de los Reyes
@silvernpewter
Nov 07 2015 22:34
Use a CSS class to style an element
Bersuc
@bersuc
Nov 07 2015 22:35
Sometimes the challenge asks me to put an array properties within " " and sometimes within ' '... I dont see any diference... There is any thing too fool me in the future???
elubie
@elubie
Nov 07 2015 22:35
Whoa, just finished my Pomodoro Timer, took longer than I thought and can probably still be improved. http://codepen.io/Massadrafil/pen/BoqZxB
Jason Wood
@catapixel
Nov 07 2015 22:36
@silvernpewter No problem for this one you add your class style ".redtext" up in the section between your <style> tags and then on the h2 element you just add the class itself <h2 class=....
Rory Smith
@alanbuchanan
Nov 07 2015 22:36
@elubie i think that was the wrong link?
elubie
@elubie
Nov 07 2015 22:36
No, link was correct, just forgot to save the Pen
Rory Smith
@alanbuchanan
Nov 07 2015 22:36
ah. now it's different :)
Bersuc
@bersuc
Nov 07 2015 22:36
I saw Hello World bouncing
Jason Wood
@catapixel
Nov 07 2015 22:37
@silvernpewter does that make sense?
elubie
@elubie
Nov 07 2015 22:37
@bersuc yes, sorry, I forgot to save the Pen
Michael de los Reyes
@silvernpewter
Nov 07 2015 22:37
trying it out now...
Bersuc
@bersuc
Nov 07 2015 22:37
:) it happens :)
Michael de los Reyes
@silvernpewter
Nov 07 2015 22:37
ah!
thanks @catapixel
CamperBot
@camperbot
Nov 07 2015 22:37
silvernpewter sends brownie points to @catapixel :sparkles: :thumbsup: :sparkles:
:star: 567 | @catapixel | http://www.freecodecamp.com/catapixel
Jason Wood
@catapixel
Nov 07 2015 22:38
:thumbsup:
Michael de los Reyes
@silvernpewter
Nov 07 2015 22:38
I didn't know you had to state it again in HTML
I thought the CSS would be enough
Rory Smith
@alanbuchanan