These are chat archives for FreeCodeCamp/Help

4th
Jan 2015
Sean May
@Lumiras
Jan 04 2015 04:14
Hey guys, I'm having a problem with the jQuery intro on CodeSchool, anyone able to help?
MychaelZ
@MychaelZ
Jan 04 2015 04:14
i might be able to help what's up?
Sean May
@Lumiras
Jan 04 2015 04:15
It's a dumb problem, I think it's a bug with CodeSchool
MychaelZ
@MychaelZ
Jan 04 2015 04:15
okay what's going on?
Charles Watson
@sircharleswatson
Jan 04 2015 04:16
it's most likely an issue with not typing the answer exactly as they want it :P
Sean May
@Lumiras
Jan 04 2015 04:16
so it has me putting the "application.js" file in under the jQuery inside the HTML
MychaelZ
@MychaelZ
Jan 04 2015 04:16
okay
Sean May
@Lumiras
Jan 04 2015 04:16
this is my code for it:
<!DOCTYPE html>
<html>
  <head>
    <title>Home</title>
  </head>
  <body>
    <div class="homepage-wrapper">
      <h2>Welcome to jQuery Travels - Traversing the DOM since 2006</h2>
      <p>Fly to New York today for as little as <span>$299.99</span></p>
    </div>
    <script src="jquery.min.js"></script>
    <script src="application.js"></script>
  </body>
</html>
MychaelZ
@MychaelZ
Jan 04 2015 04:17
place the script tags in the head
not at the bottom of the body
Charles Watson
@sircharleswatson
Jan 04 2015 04:17
@MychaelZ a lot of tutorials tell you to put it at the bottom of the body so that it makes sure everything else is loaded first
Sean May
@Lumiras
Jan 04 2015 04:17
really? That seems non-standard. I thought scripts went at the bottom of the HTML to prevent weird behavior on loading
MychaelZ
@MychaelZ
Jan 04 2015 04:18
what? try it first im going to look it up
no u guys are right
Charles Watson
@sircharleswatson
Jan 04 2015 04:19
:P
Nathan
@terakilobyte
Jan 04 2015 04:19
The idea is to let the the page load in case retreiving the jquery and custom script libraries take a while. the jquery won’t fire until $(document).ready
Sean May
@Lumiras
Jan 04 2015 04:19
nope, when I put it at the top it tells me to put it right before </body>
the error it's giving me says I need to put in a closing tag...
which, I have...
Nathan
@terakilobyte
Jan 04 2015 04:20
see if they want something stupid
try specifying what kind of script
Charles Watson
@sircharleswatson
Jan 04 2015 04:20
@Lumiras try refreshing the page
Nathan
@terakilobyte
Jan 04 2015 04:20
that too
Sean May
@Lumiras
Jan 04 2015 04:21
yeah, reloaded the page
Charles Watson
@sircharleswatson
Jan 04 2015 04:21
also
<script type="text/javascript">
try that
Sean May
@Lumiras
Jan 04 2015 04:21
tried
I'm going to try in Firefox
Charles Watson
@sircharleswatson
Jan 04 2015 04:22
which checkpoint is that?
MychaelZ
@MychaelZ
Jan 04 2015 04:23
are the src link right?
Sean May
@Lumiras
Jan 04 2015 04:23
@sircharleswatson it's the second challenge in the second part of the introduction
@MychaelZ yeah, sources are right as far as I can tell
same behavior in FF
MychaelZ
@MychaelZ
Jan 04 2015 04:24
so the first challenge when u submitted the challenge it took the srcs
Sean May
@Lumiras
Jan 04 2015 04:25
yeah, worked fine
so it's simulating that they're in the root directory
MychaelZ
@MychaelZ
Jan 04 2015 04:27
i tried doing the challenge
its a bug
Charles Watson
@sircharleswatson
Jan 04 2015 04:27
that's weid, i did this challenge before and had no issues
now im getting the same error
MychaelZ
@MychaelZ
Jan 04 2015 04:28
use signle quotes
Charles Watson
@sircharleswatson
Jan 04 2015 04:29
single quotes still doesnt work
MychaelZ
@MychaelZ
Jan 04 2015 04:29
<!DOCTYPE html>
<html>
  <head>
    <title>Home</title>
  </head>
  <body>
    <div class="homepage-wrapper">
      <h2>Welcome to jQuery Travels - Traversing the DOM since 2006</h2>
      <p>Fly to New York today for as little as <correct><span>$299.99</span></correct></p>
    </div>
    <script src='jquery.min.js'></script>
    <script src='application.js'></script>
  </body>
</html>
Sean May
@Lumiras
Jan 04 2015 04:29
@MychaelZ that passed?
MychaelZ
@MychaelZ
Jan 04 2015 04:29
is the answer codeschool give u from the hint
Nathan
@terakilobyte
Jan 04 2015 04:29
link the challenge plz?
Sean May
@Lumiras
Jan 04 2015 04:29
single quotes didn't work for me
Nathan
@terakilobyte
Jan 04 2015 04:30
I’ll try and get frustrated too :)
it's frustrating, because I've worked on sites and stuff before, I know how to link to a JS file :)
the specific error says I'm missing a closing tag, which tells me that it's looking for something after that end quote on "application.js" and not finding it
Charles Watson
@sircharleswatson
Jan 04 2015 04:31
its just bugged
Sean May
@Lumiras
Jan 04 2015 04:32
@sircharleswatson yeah, thinking so. It lets you jump ahead, so I'm just going to go onto the next one
thanks for the help, though, everyone, I appreciate it!
Nathan
@terakilobyte
Jan 04 2015 04:33
yep report a bug :)
Sean May
@Lumiras
Jan 04 2015 04:36
will do!
Christopher Hutchinson
@cshutchinson
Jan 04 2015 15:34
in relation to challenge 17, can anyone please tell me why I have to use quote in the toggleClass to make the JS work?
var answer = 42;
$('.answer').text(answer);

$('button').on('click', function() {
  $('h1').toggleClass('animated hinge');
});
normally when you addClass() or removeClass() the quotes aren't needed... now this confuses me. I am testing this in code pen and can share if needed so you can see for yourself
Ben Stoltz
@benstoltz
Jan 04 2015 15:36
Because toggleClass is wonky that way?
Christopher Hutchinson
@cshutchinson
Jan 04 2015 15:40
thank you Ben, that is what I get for not checking the API myself
Ben Stoltz
@benstoltz
Jan 04 2015 15:40
NP :)
Maxim Orlov
@Maximization
Jan 04 2015 15:45
@cshutchinson with addClass() and removeClass() you need the quotes as well
perhaps you meant the difference between 'class' and '.class'
Christopher Hutchinson
@cshutchinson
Jan 04 2015 15:55
@Maximization thanks for this; not sure where I picked up this misconception
i appreciate the help guys.
Kathy O'Driscoll
@odrisck
Jan 04 2015 18:52
Thank you everyone for being so helpful to our fellow campers :)
Ian Yeager
@iyeager2004
Jan 04 2015 19:49
What's the easiest way to just run some JS? Just something if I wanted to write a JS function and test that it works?
Ryan Malm
@Rybar
Jan 04 2015 19:49
browser console
Ben Stoltz
@benstoltz
Jan 04 2015 19:49
Go to any webpage and browser console
Ian Yeager
@iyeager2004
Jan 04 2015 19:52
How do you declare a function and call it in the JS console?
function productOfAllInts(data) {
    var returnArray = null;
    data.forEach(function(i){
        data.forEach(function(j){
           if(i != j) {
               returnArray = returnArray[i] * j;
           } 
        });
    });
    process.stdout.write(returnArray);
};
Ben Stoltz
@benstoltz
Jan 04 2015 19:53
so you have that function
then just call poductOfAllInts(whateverhere);
just like how you would call a function normally
Ian Yeager
@iyeager2004
Jan 04 2015 19:55
Oh, yeah, I see, thanks.
Ian Yeager
@iyeager2004
Jan 04 2015 22:26
When using express, is app.param always called in the stack prior to anything else?
Dominic Jones
@towwiow
Jan 04 2015 22:28
another question. Is Dash set up by FCC?
Ben Stoltz
@benstoltz
Jan 04 2015 22:29
@towwiow That’s a negative.
Dominic Jones
@towwiow
Jan 04 2015 22:30
@benstoltz gracias senior
Ben Stoltz
@benstoltz
Jan 04 2015 22:30
@towwiow De nada, It’s a company out of NYC I believe.
Dominic Jones
@towwiow
Jan 04 2015 22:30
Oh okay. Smooth.
Maxim Orlov
@Maximization
Jan 04 2015 22:30
@iyeager2004 > A param callback will be called only once in a request-response cycle, even if the parameter is matched in multiple routes.
Dominic Jones
@towwiow
Jan 04 2015 22:30
Thanks my friend.
Maxim Orlov
@Maximization
Jan 04 2015 22:31
I don't know if this suggest that
Ian Yeager
@iyeager2004
Jan 04 2015 22:32
@Maximization Right, that's what I was asking I guess. the app.param call is at the top of the stack for a request/response.
Just making sure that I understood correctly that it was called once, and only once, at the top of the stack.
Intercepting query's in one spot is so much smarter than having to handle everything all over the place.
Maxim Orlov
@Maximization
Jan 04 2015 22:35
indeed it does seem good practice to use app.param for all your params pre-processing