These are chat archives for FreeCodeCamp/Help

21st
Jan 2015
Christopher Hutchinson
@cshutchinson
Jan 21 2015 00:01
@jmcshane thanks for support... where did you do your programming? codepen.io?
I have been using codepen.io but for strictly javascript it is annoying sometimes
James McShane
@jmcshane
Jan 21 2015 00:04
i worked in cloud 9, c9.io
Ben Clist
@BenClist
Jan 21 2015 00:05
I also use cloud9, love it
Christopher Hutchinson
@cshutchinson
Jan 21 2015 00:09
ty ty love you guys
Bill Maca
@bmaca
Jan 21 2015 01:46
Question
> $("span:contains('$299.99')")
on this element
<p>Fly to New York today for as little as <yes><span>$299.99</span></ye
anyone see why im getting an error here?
Suzanne Atkinson
@AdventureBear
Jan 21 2015 01:47
Do you need to escape the $ character?
> $("span:contains('/$299.99')")
not sure...just a guess
actually ignore me, i have no idea.
Bill Maca
@bmaca
Jan 21 2015 01:48
no thats not it, thanks for taking a tab at it
Suzanne Atkinson
@AdventureBear
Jan 21 2015 01:49
well, i tried. :)
Bill Maca
@bmaca
Jan 21 2015 01:50
no worries @AdventureBear
Christopher Hutchinson
@cshutchinson
Jan 21 2015 04:03
@jmcshane everything fell into place tonight, knocked out 6 easy challenges in less than an hour
@BenClist c9.io is very nice thank you @jmcshane
Julie Myers
@BlueOceanView
Jan 21 2015 04:04
@cshutchinson Good job. :) I'm a little more than 1/2 way through the challenges. I'm skipping the pair programming...I've heard it's going to get replaced with something else soon.
Ben Clist
@BenClist
Jan 21 2015 04:05
@cshutchinson The other thing it's really good for is pair programming, multiple people can work on 1 document if multiple cursors
with*
Evan Davis
@davisec52
Jan 21 2015 16:53

Good morning! Back with questions. Also wanted to thank @BenClist, @yaskyj, @Maximization, @terakilobyte, and @Rrybar for pulling me out of JS quicksand, I've been able to complete half of the easy coderbyte challenges so far. I'm sure I will be begging for a lifeline later on.

My question right now, is simply why I get two different results for str1 in the code samples below. Basically, str1.split("") yeilds the array shown in the first sample, but when I initialize var str2, var str1 gives the output in reversed order.

I don't understand and would appreciate illumination.


function test(str) {
    var str1 = str.split("");
    //var str2 = str1.reverse("");
    return str1;
}
test("dog");

=> [ 'd', 'o', 'g' ]

What does this next example give a different result from the first:


function test(str) {
    var str1 = str.split("");
    var str2 = str1.reverse("");
    return str1;
}
test("dog");

=> [ 'g', 'o', 'd' ]
Justin Rogers
@yaskyj
Jan 21 2015 17:07
@davisec52 Reverse called on an array changes the array itself: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/reverse
So you could use
var str2 = str.split("").reverse();
Evan Davis
@davisec52
Jan 21 2015 17:12
So, even if reverse is called in str2, it will apply backwardly to str1?
Justin Rogers
@yaskyj
Jan 21 2015 17:12
Yes. Reverse returns the array mutated.
Evan Davis
@davisec52
Jan 21 2015 17:14
Ok. I thought that if you put the reversed array in a separate variable, then the order of str1 would remain intact.
Scott Mac Donald
@Corinos
Jan 21 2015 18:11
I have a couple of quick questions about Code School lesson 4. At one point, they show the 'event bubbling up the dom' and I don't really get what that means...
'$(document).ready(function() {
$(".see-photos").on("click", function() {
$(this).closest(".tour").find(".photos").slideToggle();
});
});' This was the code that I think was 'Bubbling'
Julie Myers
@BlueOceanView
Jan 21 2015 20:34

@Corinos - Events have a feature called propagation. Propagation can work by either searching up the DOM tree or searching down. Searching up the DOM tree is the approach that modern browsers use. This searching up is called bubbling. Searching down is called capturing.

When you write events in plain javascript you should always tell the browser to either use bubbling or capturing. Always choose bubbling, which will be written in your coding as false. Here is an example:

var p = document.getElementById('photoList2'); 
p.addEventListener('click', function(e){
    console.log(e.toElement.alt);
}, false);
In jQuery you don't have to tell the browser which one to use. I believe jQuery figures that out behind the scene...but, don't quote me on that.
onemillion
@onemillion
Jan 21 2015 21:52

<!DOCTYPE html>

<head>

<style>
body {
font-family: helvetica, sans-serif;
}


div
{

background: url("http://dash.ga.co/assets/firstcourse.jpg");
}

{
height: 200px;
}
{
background-size: cover;
}



</style>


</head>

<body>
<h1>esha's restaurant</h1>
<div>
<h2>welsh onion soko $14</h2>
<p>Mustard sierra leone bologi kale chard beet greens black-eyed pea sorrel amaranth garlic tigernut spring onion summer purslane asparagus lentil. </p>
</div>
{

background: url("http://dash.ga.co/assets/firstcourse.jpg");
}

{
height: 200px;
}
{
background-size: cover;
}
<div>
<h2>pastrami boudin tongue $22</h2>
<p>Tri-tip capicola kielbasa salami brisket chicken rump strip steak drumstick. Meatloaf chuck boudin ribeye pork jowl. Andouille bacon jowl meatloaf pork loin prosciutto bresaola.</p>
</div>
<div>
<h2>fruitcake marzipan pudding dragee $8</h2>
<p>Lollipop tart cotton candy jelly-o carrot cake apple pie cupcake. Jelly-o bear claw ice cream candy canes.</p>
</div>
</body>

Jason Rueckert
@jsonify
Jan 21 2015 21:52
so, just a heads up, @onemillion, if you go switch to Markdown mode on the side over here ------------------------------------------------->
onemillion
@onemillion
Jan 21 2015 21:53
ok ok
Jason Rueckert
@jsonify
Jan 21 2015 21:55
you can read about the Markdown help and see how you can make your code look like this:
<!DOCTYPE html>

<head>

<style>
body {
font-family: helvetica, sans-serif;
}


div
{

background: url("http://dash.ga.co/assets/firstcourse.jpg");
}

{
height: 200px;
}
{
background-size: cover;
}



</style>


</head>

<body>
<h1>esha's restaurant</h1>
<div>
<h2>welsh onion soko $14</h2>
<p>Mustard sierra leone bologi kale chard beet greens black-eyed pea sorrel amaranth garlic tigernut spring onion summer purslane asparagus lentil. </p>
</div>
{

background: url("http://dash.ga.co/assets/firstcourse.jpg");
}

{
height: 200px;
}
{
background-size: cover;
}
<div>
<h2>pastrami boudin tongue $22</h2>
<p>Tri-tip capicola kielbasa salami brisket chicken rump strip steak drumstick. Meatloaf chuck boudin ribeye pork jowl. Andouille bacon jowl meatloaf pork loin prosciutto bresaola.</p>
</div>
<div>
<h2>fruitcake marzipan pudding dragee $8</h2>
<p>Lollipop tart cotton candy jelly-o carrot cake apple pie cupcake. Jelly-o bear claw ice cream candy canes.</p>
</div>
</body>
So, what is the code not doing that you're expecting it to?
onemillion
@onemillion
Jan 21 2015 21:56
ok im going to try
i cant make the background stop tilling
all three divs have the same background image
Jason Rueckert
@jsonify
Jan 21 2015 21:59
try putting the three properties INSIDE the div tag. Like this:
div {
    background: url("http://dash.ga.co/assets/firstcourse.jpg");
    height: 200px;
    background-size: cover;
}
onemillion
@onemillion
Jan 21 2015 21:59
ok
oh men that was great
i really apreciate @phlacin
Ghost
@ghost~54bf7177db8155e6700ee568
Jan 21 2015 22:01
briefly: all properties belonging to the same element or tag or class should be within 1 pair of {}
not a pair of {} for each property
onemillion
@onemillion
Jan 21 2015 22:02
ok @lan3jur i take note on that thank you
Jason Rueckert
@jsonify
Jan 21 2015 22:02
@onemillion yeah, no problem.
Ghost
@ghost~54bf7177db8155e6700ee568
Jan 21 2015 22:02
otherwise the css doesn't know what to do with the property ..
onemillion
@onemillion
Jan 21 2015 22:03
good to know
Jason Rueckert
@jsonify
Jan 21 2015 22:03
@lan3jur true that
Ghost
@ghost~54bf7177db8155e6700ee568
Jan 21 2015 22:03
no probs.. I try to keep 1 eye on chat so if you have any more questions, just shoot
onemillion
@onemillion
Jan 21 2015 22:03
ok thanks you both for the assistance
Ghost
@ghost~54bf7177db8155e6700ee568
Jan 21 2015 22:04
no problem .. have fun with the rest of the challenges :)
onemillion
@onemillion
Jan 21 2015 22:06
yes im going to try to make my code like you show me with the markboard i think i dont have the right input in my keyboard, if you dont understand something that im saying is because english is my second language and im not fully mature on it
Florian Beijers
@zersiax
Jan 21 2015 22:14
does anyone know why Dash is tripping over this code? I think syntactically it's sound, but Dash doesn't seem to be satisfied:
<!DOCTYPE html>

<head>
<script src="/assets/jquery.js"></script>
<style>
</style>
</head>

<body>
<div class="prompt"></div>

<script>
var prompts = [
         'Type your name', 
         'Type an adjective',
         'Type a noun'
    ];


    // alert(prompts.length);
    // alert(prompts[0]);
// jQuery to insert an array-indexed item into the empty HTML div
    $('.prompt').html(prompts[0]);
    </script>
</body>
Dash project 5, section 1, checkpoint 6
onemillion
@onemillion
Jan 21 2015 22:19
@zersiax sorry i want to know how to show code like that in black and not only paste it can you give me a hint?
Kathy O'Driscoll
@odrisck
Jan 21 2015 22:20
gittermarkdowncodetut.jpg
thats how you do markup
onemillion
@onemillion
Jan 21 2015 22:21
thanks the thing is i dont know how to make the back ticks but know that i know how they are called im a step further
´´´
Kathy O'Driscoll
@odrisck
Jan 21 2015 22:24
back ticks are next to the #1 on my keyboard, likely yours too
next to the number 1
same key as the tilde
onemillion
@onemillion
Jan 21 2015 22:24
´´´
Kathy O'Driscoll
@odrisck
Jan 21 2015 22:25
thats a single quote
the key next to your 1 key
onemillion
@onemillion
Jan 21 2015 22:26
ok thank you my keyboard is different maybe because is spanish keyboard
´´´
Kathy O'Driscoll
@odrisck
Jan 21 2015 22:26
no thats a single quote
Florian Beijers
@zersiax
Jan 21 2015 22:26
yes, international keyboards have it in a different place or not at all because you need the keys to make diacritics of accents on the letters ...not sure where it is on a Spanish keyboard ...
Kathy O'Driscoll
@odrisck
Jan 21 2015 22:27
I'm researching
ok so I see the Italian keyboard doesn't have a back tick, still looking :)
onemillion
@onemillion
Jan 21 2015 22:28
thanks @odrisck
var code ="formatted";
Kathy O'Driscoll
@odrisck
Jan 21 2015 22:31
there you go
the key next to the p?
onemillion
@onemillion
Jan 21 2015 22:32
now im happy
Kathy O'Driscoll
@odrisck
Jan 21 2015 22:32
I just found a visual of a spanish keyboard? I'd like to know where you found it please
onemillion
@onemillion
Jan 21 2015 22:32
yes
Kathy O'Driscoll
@odrisck
Jan 21 2015 22:32
awesome, now I know what to tell other folks :)
thank you kindly
onemillion
@onemillion
Jan 21 2015 22:32
no thanks to you, you are the kindest @odrisck
Kathy O'Driscoll
@odrisck
Jan 21 2015 22:32
I'll save this pic and mark it up for showing in the future
onemillion
@onemillion
Jan 21 2015 22:33
excellent
Kathy O'Driscoll
@odrisck
Jan 21 2015 22:35
spanishkeyboard.jpg
how does that look is that where you see it on your keyboard?
onemillion
@onemillion
Jan 21 2015 22:41
yes
exactly
Kathy O'Driscoll
@odrisck
Jan 21 2015 22:50
awesome!!!!
I should make one for a US keyboard too
is a UK keyboard different?
off to add "process documentation" or "support documentation" to my resume :)
onemillion
@onemillion
Jan 21 2015 22:55
:)
Florian Beijers
@zersiax
Jan 21 2015 23:26
grin, I am still quite stuck on this slide though :) any clue why it is misbehaving anyone? :)
Ghost
@ghost~54bf7177db8155e6700ee568
Jan 21 2015 23:27
sorry which slide is that?
Kathy O'Driscoll
@odrisck
Jan 21 2015 23:27
Sorry about that @zersiax
Dash project 5, section 1, checkpoint 6
Ghost
@ghost~54bf7177db8155e6700ee568
Jan 21 2015 23:29
Ah sorry didn't make it that far yet..
is it about the array thing you posted earlier here?
Florian Beijers
@zersiax
Jan 21 2015 23:32
yup :)
Ghost
@ghost~54bf7177db8155e6700ee568
Jan 21 2015 23:33
I don't see anything wrong with it.. You should get "Type your name" as output
Florian Beijers
@zersiax
Jan 21 2015 23:33
I'm almost 100% sure its a Dash thing ...expecting the line somewhere else than where I put it , I don't see any syntax errors at least
Ghost
@ghost~54bf7177db8155e6700ee568
Jan 21 2015 23:33
nope, syntax is correct
They probably want you to write the code in another place or something..
Florian Beijers
@zersiax
Jan 21 2015 23:34
hmm ...the disadvantage of Dash right here ... the system isn't very flexible. If you use a different type of quote or a different order than the one you're expecting it won't let you continue and there's no error
Ghost
@ghost~54bf7177db8155e6700ee568
Jan 21 2015 23:35
yeah... I had the same thing on codeschool
Florian Beijers
@zersiax
Jan 21 2015 23:35
I'll ask on main if anyone has done this slide and how they got past :)
codeSchool gives you tips on where you may have gone wrong though :)
Ghost
@ghost~54bf7177db8155e6700ee568
Jan 21 2015 23:35
Well, feel free to send me a pm here and I'll try and hurry to get there so I can see what's up with that slide..
Almost done making the robot .. so not that far behind
Florian Beijers
@zersiax
Jan 21 2015 23:37
I can wait :) just let me know when you get there and if you will this night ...you're in the same timezone I am so it is quite late already:)
Kathy O'Driscoll
@odrisck
Jan 21 2015 23:37
also remember with dash, sometimes, you have to refresh your page
to get it to take
Ghost
@ghost~54bf7177db8155e6700ee568
Jan 21 2015 23:37
It probably won't be till tomorrow morning, since I plan to be in bed around 01:00 .. still have 2 episodes of The Originals to watch :)
Florian Beijers
@zersiax
Jan 21 2015 23:38
grin :) I should start on that series at some point
Ghost
@ghost~54bf7177db8155e6700ee568
Jan 21 2015 23:38
It's awesome! I'm so addicted
Florian Beijers
@zersiax
Jan 21 2015 23:38
@odrisck I know :) but I already tried that :)
Ghost
@ghost~54bf7177db8155e6700ee568
Jan 21 2015 23:38
And one of them is my new most favourite bad guy ever, lol
if I were a woman or gay, I'd be all over him :D
Florian Beijers
@zersiax
Jan 21 2015 23:38
@lan3jur so are you in the Flemmish or French part of Belgium?
Ghost
@ghost~54bf7177db8155e6700ee568
Jan 21 2015 23:39
Flemmish
Florian Beijers
@zersiax
Jan 21 2015 23:39
lol we almost share a language then :P
Kathy O'Driscoll
@odrisck
Jan 21 2015 23:39
ok just tossing it out there :)
Ghost
@ghost~54bf7177db8155e6700ee568
Jan 21 2015 23:39
I know .. but I prefer to keep it in English here since it's a 'public' chat ..
Florian Beijers
@zersiax
Jan 21 2015 23:40
@lan3jur agreed :) I prefer it in 9 out of 10 cases anyway :)
@odrisck thanks for the tip anyway :)
Ghost
@ghost~54bf7177db8155e6700ee568
Jan 21 2015 23:40
same here :)
Kathy O'Driscoll
@odrisck
Jan 21 2015 23:41
its my standard brain script when the code seems right and I know its on dash :), its always the first thing I suggest, I don't always remember who else already knows to try that lol
Ghost
@ghost~54bf7177db8155e6700ee568
Jan 21 2015 23:41
haha same here, I hit
'Command-R' more than anything else :)