These are chat archives for FreeCodeCamp/HelpFrontEnd

28th
Jun 2017
Raymond
@Raymondshen
Jun 28 2017 00:07
Hey guys I have a question on media queries I have been running into problems alot with it
So i have two css files one is the default main style.
and the other contains media queries.
<link rel="stylesheet" type="text/css" href="style.css" />
<link rel="stylesheet" media='screen and (min-width: 1200px) and (max-width: 1366px)' href="media.css" />
But everytime i try to apply it takes in the second and runs everything else.
Noel Quiles
@EnMod
Jun 28 2017 00:37
getting the following running a simple request in the Twitch Status challenge, even tried using crossorigin.me to no avail. What gives?
XMLHttpRequest cannot load https://wind-bow.gomix.me/twitch-api/users?login=ESL_SC2. Redirect from 'https://wind-bow.gomix.me/twitch-api/users?login=ESL_SC2' to 'https://wind-bow.glitch.me/twitch-api/users?login=ESL_SC2' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'https://s.codepen.io' is therefore not allowed access.
Noel Quiles
@EnMod
Jun 28 2017 00:43
@jtan3 Nope, same error
Johnny
@jtan3
Jun 28 2017 00:44
@EnMod can you share your codepen?
Noel Quiles
@EnMod
Jun 28 2017 00:46
@jtan3 sure, I'm not even sure if I'm doing the challenge right lol but it's kind of irksome that I can't even test it right now: https://codepen.io/EnMod/pen/jwLPQm
Johnny
@jtan3
Jun 28 2017 00:52
@EnMod first i think you need $(document).ready(function() {}); in your page
Noel Quiles
@EnMod
Jun 28 2017 00:55
lol omg, I REALLY have to remember that
thanks
noticing some other errors I made, fixing everything up
Johnny
@jtan3
Jun 28 2017 00:59
@EnMod users.join(',') what is this suppose to do?
Noel Quiles
@EnMod
Jun 28 2017 01:00
It was leftover from when I wanted to grab a JSON with all the users in one go, it was meant to join them into a string and concat it onto the request
just added back the full array
Johnny
@jtan3
Jun 28 2017 01:02
@EnMod try adding "?callback=?" to the end of the api's url.
Noel Quiles
@EnMod
Jun 28 2017 01:03
as in the end of the base?
Uncaught ReferenceError: filterList is not defined
??? Hmm...
Johnny
@jtan3
Jun 28 2017 01:04
@EnMod comment that part out
@EnMod then console.log(data) in your getJSON.
Noel Quiles
@EnMod
Jun 28 2017 01:11
Looks like the expected output:
Object {display_name: "FreeCodeCamp",
 _id: 79776140, 
name: "freecodecamp", 
type: "user", 
bio: "We help you learn to code, then practice by buildi…open source community at https://freecodecamp.com"…}
bio: "We help you learn to code, then practice by building projects for nonprofits. Learn Full-stack JavaScript, build a portfolio, and get a coding job by joining our open source community at https://freecodecamp.com"
created_at: "2015-01-14T03:36:47Z"
display_name: "FreeCodeCamp"
logo: "https://static-cdn.jtvnw.net/jtv_user_pictures/freecodecamp-profile_image-d9514f2df0962329-300x300.png"
name: "freecodecamp"
type: "user"
updated_at: "2017-06-28T00:02:32Z"
_id: 79776140
...
that's more or less truncated but the twitch info is there
Johnny
@jtan3
Jun 28 2017 01:13
@EnMod :thumbsup:
Noel Quiles
@EnMod
Jun 28 2017 01:14
:smile: thanks for your help! as for the filterList, I suppose it would be best to bind it to the input using jQuery's .on due to how my JS is set up?
iso
@iso1048
Jun 28 2017 01:15
Hi. How can i use a form element to send an email?
Noel Quiles
@EnMod
Jun 28 2017 01:15
@jtan3 one more question, what exactly did adding ?callback=? do?
DarrylJLTolentino
@DarrylJLTolentino
Jun 28 2017 01:17
I got a quick question for anyone. In my Local Weather code, I have a button that switches from Fahrenheit to Celsius, but it does not go back to Fahrenheit after clicking. I thought an else statement in the on click function, but it hasn't worked so far. https://codepen.io/darryljltolentino/pen/VWMMGV?editors=1010
Johnny
@jtan3
Jun 28 2017 01:18
@EnMod helped with cors error
Gulsvi
@gulsvi
Jun 28 2017 01:18
@EnMod ?callback=? isn't needed if you go to the new server: var baseURL = 'https://wind-bow.glitch.me/twitch-api/';
As Johnny says though, it treats the request as JSONP, so you don't get cross origin errors. You could use it in your Weather and Wikipedia projects if you want - instead of using crossorigin.me
Noel Quiles
@EnMod
Jun 28 2017 01:19
Cool info @SkyC0der , thanks for that :+1:
CamperBot
@camperbot
Jun 28 2017 01:19
enmod sends brownie points to @skyc0der :sparkles: :thumbsup: :sparkles:
:star2: 1861 | @skyc0der |http://www.freecodecamp.com/skyc0der
Gulsvi
@gulsvi
Jun 28 2017 01:24
@DarrylJLTolentino Same info for you :) use JSONP and you won't have to rely on a cross origin proxy as an additional dependency in your code.

For your convert button - you are doing this:

var tempA = forecast.currently.apparentTemperature;

And then you do:

  if (tempA = forecast.currently.apparentTemperature) {
    // show celsius
  } else {
    // show fahrenheit
  }
The problem is - tempA is always equal to forecast.currently.apparentTemperature
You'll need to check what the current value of the button is rather what tempA is equal to
DarrylJLTolentino
@DarrylJLTolentino
Jun 28 2017 01:29
ohhh so would I check the value of the button via the id? and also I don't know what JSONP is unfortunately, I'll have to read up on it @SkyC0der
Gulsvi
@gulsvi
Jun 28 2017 01:30
@DarrylJLTolentino It lets jQuery run the code from your page rather than remotely from the server (across origins).
Just remove https://crossorigin.me/ from the beginning of your API URLs and add ?callback=? to the end - jQuery will do the rest
DarrylJLTolentino
@DarrylJLTolentino
Jun 28 2017 01:33
the only API URL I have is this one https://cors-anywhere.herokuapp.com/https://api.darksky.net/forecast/.... unless I'm misunderstanding what you said
@SkyC0der the only API URL I have is this one https://cors-anywhere.herokuapp.com/https://api.darksky.net/forecast/.... unless I'm misunderstanding what you said
Gulsvi
@gulsvi
Jun 28 2017 01:35
@DarrylJLTolentino Sorry, I was looking at a different weather app. In your weather app, remove https://cors-anywhere.herokuapp.com/ from the beginning of the URL and add ?callback=? to the end.
DarrylJLTolentino
@DarrylJLTolentino
Jun 28 2017 01:36
@SkyC0der oh ok haha I was confused for a sec. I'
I'll make the change now
Gulsvi
@gulsvi
Jun 28 2017 01:36
:)
Had too many apps open at once lol
DarrylJLTolentino
@DarrylJLTolentino
Jun 28 2017 01:37
no problemo haha I understand you are helping many of us
So I guess my last question would be how to reference a button from HTML in JS because the only thing I have linking to the button is the id @SkyC0der
Gulsvi
@gulsvi
Jun 28 2017 01:40
@DarrylJLTolentino The .text() and .html() methods in jQuery can be used to set or get the current text/html from an element
so, $('#yourID').html() will return the current HTML for that element
DarrylJLTolentino
@DarrylJLTolentino
Jun 28 2017 01:46
@SkyC0der so would I have to set that returned element as another variable and then set the if statement to use that variable?
Gulsvi
@gulsvi
Jun 28 2017 01:46
@DarrylJLTolentino Yeah, try putting it in a console.log() and see what it returns - then you'll know what to test for in your if()
There are lots of ways to do the convert button, by the way, this is just the one that's closest to your current approach
DarrylJLTolentino
@DarrylJLTolentino
Jun 28 2017 01:48
@SkyC0der awesome! I'll definitely try to see what happens with what you have taught me! Thank you very much!
CamperBot
@camperbot
Jun 28 2017 01:48
darryljltolentino sends brownie points to @skyc0der :sparkles: :thumbsup: :sparkles:
:star2: 1862 | @skyc0der |http://www.freecodecamp.com/skyc0der
Gulsvi
@gulsvi
Jun 28 2017 01:51
Good luck! I'll be around if you get stuck
iso
@iso1048
Jun 28 2017 01:52
is there a way to send a form element as an email using only js?
Pagnito
@Pagnito
Jun 28 2017 01:53
@SkyC0der hey do u know anything about express js?
Gulsvi
@gulsvi
Jun 28 2017 01:54
@gothamknight Only if you have a mail server. If you set up your portfolio on github instead of codepen, you could use https://formspree.io/
@Pagnito I did the express nodeschool workshop
Ken Haduch
@khaduch
Jun 28 2017 01:54
@joshdaniell - looks good!
Pagnito
@Pagnito
Jun 28 2017 01:56
@SkyC0der oh so its only for mail stuff?
Gulsvi
@gulsvi
Jun 28 2017 01:57
no, express is a web server
Pagnito
@Pagnito
Jun 28 2017 01:57
i read that its a framework tho
Gulsvi
@gulsvi
Jun 28 2017 01:58
Yeah, it's like a whole framework for building web apps and rendering HTML server side
like PHP for node.js
Pagnito
@Pagnito
Jun 28 2017 01:58
oh so u dont need to learn it if u use node js
?
iso
@iso1048
Jun 28 2017 01:59
@SkyC0der thanks
CamperBot
@camperbot
Jun 28 2017 01:59
gothamknight sends brownie points to @skyc0der :sparkles: :thumbsup: :sparkles:
:star2: 1863 | @skyc0der |http://www.freecodecamp.com/skyc0der
Gulsvi
@gulsvi
Jun 28 2017 01:59
No, you don't need to learn it to understand node js
It's just another npm package, but a really powerful and important one
Pagnito
@Pagnito
Jun 28 2017 01:59
how does it compare to node js
Gulsvi
@gulsvi
Jun 28 2017 01:59
It uses node js
You can't use express.js without understanding node.js
Pagnito
@Pagnito
Jun 28 2017 02:00
oh
my head hurts lol
Gulsvi
@gulsvi
Jun 28 2017 02:00
:joy:
Pagnito
@Pagnito
Jun 28 2017 02:00
there is soooo much with these modules, and packages and loaders
and plugins
Gulsvi
@gulsvi
Jun 28 2017 02:00
It's crazy, I know
The nodeschool I go to is like a bunch of devs speaking another language
Pagnito
@Pagnito
Jun 28 2017 02:01
lol
is it like physical classes?
Gulsvi
@gulsvi
Jun 28 2017 02:01
All these project names and me writing everything down but never having enough time to research it all
Just a bunch of people who know javascript, learning node.js, and doing the workshops they have at https://nodeschool.io
They're all self guided, kind of like free code camp
iso
@iso1048
Jun 28 2017 02:03
@SkyC0der do you know if formspress can work with textarea elements?
Pagnito
@Pagnito
Jun 28 2017 02:04
@Pagnito thanks
CamperBot
@camperbot
Jun 28 2017 02:04
sorry pagnito, you can't send brownie points to yourself! :sparkles: :sparkles:
Pagnito
@Pagnito
Jun 28 2017 02:04
@SkyC0der thanks
CamperBot
@camperbot
Jun 28 2017 02:04
pagnito sends brownie points to @skyc0der :sparkles: :thumbsup: :sparkles:
:star2: 1864 | @skyc0der |http://www.freecodecamp.com/skyc0der
Gulsvi
@gulsvi
Jun 28 2017 02:04
@gothamknight I haven't used it
(Others have for their portfolios though)
Pagnito
@Pagnito
Jun 28 2017 02:06
@SkyC0der the exercises are on the github links?
Gulsvi
@gulsvi
Jun 28 2017 02:07
The instructions for them are - usually you just do npm install <workshop name> and then run through them in the command prompt / terminal
Install node.js, make sure you can run npm from your command line, and then do npm install -g learnyounode
That will get you started with the basics of node.js
Pagnito
@Pagnito
Jun 28 2017 02:07
sweet thanks
Gulsvi
@gulsvi
Jun 28 2017 02:08
Or, do this one npm install -g javascripting and you'll run through it pretty quickly. Lots of basic javascript stuff
Pagnito
@Pagnito
Jun 28 2017 02:08
why would i do that then?
Gulsvi
@gulsvi
Jun 28 2017 02:08
Just to get a hang of how they work - the coding style they show you is slightly different
Pagnito
@Pagnito
Jun 28 2017 02:09
is it likea good prereq for youlearnnode?
oh
DarrylJLTolentino
@DarrylJLTolentino
Jun 28 2017 02:09
@SkyC0der so when I console logged it, it returned 2 values. I'm kind of confused as to why hahaha
Pagnito
@Pagnito
Jun 28 2017 02:09
@SkyC0der once i go through those exercise can i delte them?
Gulsvi
@gulsvi
Jun 28 2017 02:10
Yeah, you can npm uninstall
Pagnito
@Pagnito
Jun 28 2017 02:10
@SkyC0der sweet thanks
CamperBot
@camperbot
Jun 28 2017 02:10
pagnito sends brownie points to @skyc0der :sparkles: :thumbsup: :sparkles:
:warning: pagnito already gave skyc0der points
Gulsvi
@gulsvi
Jun 28 2017 02:10
@DarrylJLTolentino lol, uh oh! :) happy to take a look if it helps
Noel Quiles
@EnMod
Jun 28 2017 02:10
Hey all, working on this Twitch thing I more or less have the desired behavior I think...except the only user that seems to get accessed is the last one in my array. What am I doing wrong?
DarrylJLTolentino
@DarrylJLTolentino
Jun 28 2017 02:10
It returned the text and then it proceeded to return undefined right after
Gulsvi
@gulsvi
Jun 28 2017 02:13

@DarrylJLTolentino Try it like this instead:

      $(".triggerB").on("click", function() {
        var tempSet = $("#temp").html();
        console.log(tempSet);
        if ((tempSet = forecast.currently.apparentTemperature)) {
          $("#temp").html("Temperature: " + Math.round((forecast.currently.apparentTemperature - 32) * (5 / 9)) + "°C");
        } else {
          $("#temp").html("Temperature: " + forecast.currently.apparentTemperature + "°F");
        }
      });

^^ You need to update tempSet on every click - and then tempSet is going to include °C, so that needs to be a part of your if statement to figure out

I'll let you figure out the if() part, but the main change is putting var tempSet = $("#temp").html(); inside your click function
Pagnito
@Pagnito
Jun 28 2017 02:15
@SkyC0der do i keep rerunning javascripting command after each challenge
Kevin
@kevinwr
Jun 28 2017 02:15

Hey, all.

Right now, I have the following code, which produces the following image

                <div class="row" id="btnBar">
                    <a href="#"><div id="fbBtn"><i class="fa fa-facebook" ></i></div></a>
                    <a href="#"><div id="twitterBtn"><i class="fa fa-twitter"></i></div></a>
                    <a href="#"><div id="nextQuoteBtn"><i class="fa fa-arrow-right"></i></div></a>
                </div>

And I'm trying to get each of these "buttons" on the same horizontal line, and where the two social buttons are to the left of the row, and the arrow is right at the center of the row. How would you think the best way to solve this would be? One thing I've noticed is that aligning crap with CSS is not a fun task, and is quite complicated (at least for me).

image.png
CallMeOrange
@EgnaroDev
Jun 28 2017 02:16
Wtf? What happened to fCC chatroom?
Kevin
@kevinwr
Jun 28 2017 02:16
@MCTwoDigitZero I was wondering the same thing. It was running this morning.
CallMeOrange
@EgnaroDev
Jun 28 2017 02:16
I see
Looks like it was removed
Pagnito
@Pagnito
Jun 28 2017 02:16
@Pagnito yup seems so
CallMeOrange
@EgnaroDev
Jun 28 2017 02:17
lol @Pagnito talking to yourself
DarrylJLTolentino
@DarrylJLTolentino
Jun 28 2017 02:17
@SkyC0der OHHH LOL that makes a lot of sense.
CallMeOrange
@EgnaroDev
Jun 28 2017 02:17
about @Pagnito
CamperBot
@camperbot
Jun 28 2017 02:17
:cookie: 255 | @pagnito |http://www.freecodecamp.com/pagnito
CallMeOrange
@EgnaroDev
Jun 28 2017 02:17
Hm, that works
Kevin
@kevinwr
Jun 28 2017 02:17
@kevinwr came back on today, and the link to the chatroom was gone, and they don't have the "HELP" button anymore on challenges. It says "GET HINT"
iso
@iso1048
Jun 28 2017 02:17
@SkyC0der could I quickly bother you with a pm?
Kevin
@kevinwr
Jun 28 2017 02:17
oh crap...tagged myself again. lol
Gulsvi
@gulsvi
Jun 28 2017 02:17
@Pagnito Yes :)
CallMeOrange
@EgnaroDev
Jun 28 2017 02:17
@kevinwr Yeah, they doesnt exist anymore
A hint button is not even helpful lol
DarrylJLTolentino
@DarrylJLTolentino
Jun 28 2017 02:18
@SkyC0der thank you very much again. back to the grind!
CamperBot
@camperbot
Jun 28 2017 02:18
darryljltolentino sends brownie points to @skyc0der :sparkles: :thumbsup: :sparkles:
:warning: darryljltolentino already gave skyc0der points
Pagnito
@Pagnito
Jun 28 2017 02:18
@MCTwoDigitZero lol always
Kevin
@kevinwr
Jun 28 2017 02:18
It's weird. @MCTwoDigitZero I haven't looked at the hints yet
CallMeOrange
@EgnaroDev
Jun 28 2017 02:18
Try it
Kevin
@kevinwr
Jun 28 2017 02:18
I will. Right now, I'm trying to figure out how to align my buttons properly lol
a thing you think would be damn easy
^^ Works for me
CallMeOrange
@EgnaroDev
Jun 28 2017 02:19
@SkyC0der lmao
Chat in fCC challenge..
Its gone
Gulsvi
@gulsvi
Jun 28 2017 02:19
Oh, I never used that :p
CallMeOrange
@EgnaroDev
Jun 28 2017 02:20
If it was removed in fCC, I wonder it might be shut down this chat too... or maybe its because beta is getting merged with fCC sooner
Gulsvi
@gulsvi
Jun 28 2017 02:20
@gothamknight If needed
Pagnito
@Pagnito
Jun 28 2017 02:20
@SkyC0der hey how do i console.log stuff intp the terminal
Gulsvi
@gulsvi
Jun 28 2017 02:20
With console.log() :)
CallMeOrange
@EgnaroDev
Jun 28 2017 02:21
@Pagnito Yeah obviously..
Pagnito
@Pagnito
Jun 28 2017 02:21
nah, but i mean, i wrote it in the editor tho
Gulsvi
@gulsvi
Jun 28 2017 02:22
You'll save it as a file, like program.js then do javascripting run program.js
Pagnito
@Pagnito
Jun 28 2017 02:22
i see
Gulsvi
@gulsvi
Jun 28 2017 02:22
or do node program.js if it doesn't have dependencies on that workshop
Pagnito
@Pagnito
Jun 28 2017 02:22
thanks
Kevin
@kevinwr
Jun 28 2017 02:22
Can anyone help me with my alignment dilemma? PURDY PURDY PWEEZE.
CallMeOrange
@EgnaroDev
Jun 28 2017 02:23
It will be a trouble if getting brownie points from fCC chatroom is removed too..
Kevin
@kevinwr
Jun 28 2017 02:23
why are they getting rid of chats?
CallMeOrange
@EgnaroDev
Jun 28 2017 02:24
No idea
Couldnt find some reasons anywhere on forums
Gulsvi
@gulsvi
Jun 28 2017 02:24
Which chats are they removing?
CallMeOrange
@EgnaroDev
Jun 28 2017 02:24
@SkyC0der all of it
Kevin
@kevinwr
Jun 28 2017 02:24
scratches chin HMMMMMMMMMM
DarrylJLTolentino
@DarrylJLTolentino
Jun 28 2017 02:24
@SkyC0der I got it to work hahaha yes!
CallMeOrange
@EgnaroDev
Jun 28 2017 02:24
Go to any fCC challenge
Amit Patel
@AmitP88
Jun 28 2017 02:24
so no more FCC gitter channels? =(
CallMeOrange
@EgnaroDev
Jun 28 2017 02:25
There is no Help button nor chat..
@AmitP88 I think this chat will stay..
Gulsvi
@gulsvi
Jun 28 2017 02:25
That doesn't mean they're deleting these chat rooms....
CallMeOrange
@EgnaroDev
Jun 28 2017 02:25
@SkyC0der Im not saying that
Oh lol
Kevin
@kevinwr
Jun 28 2017 02:25
maybe just consolidating things?
CallMeOrange
@EgnaroDev
Jun 28 2017 02:25
How do you know? why would they replace help button to "get a hint" button
Kevin
@kevinwr
Jun 28 2017 02:26
They also don't even have the "chat" link on the main menu anymore
CallMeOrange
@EgnaroDev
Jun 28 2017 02:26
Even Chat top right is gone...
Yeah
Kevin
@kevinwr
Jun 28 2017 02:26
which is curious
CallMeOrange
@EgnaroDev
Jun 28 2017 02:26
going to this site is only way for now
Kevin
@kevinwr
Jun 28 2017 02:27
I had to google to get back here lol
CallMeOrange
@EgnaroDev
Jun 28 2017 02:27
lol
I was like, "Whats going on?" then I simply type gitter...
found it
Pagnito
@Pagnito
Jun 28 2017 02:27
@SkyC0der man, this nodeschool is another blessing
Kevin
@kevinwr
Jun 28 2017 02:27
lol
Pagnito
@Pagnito
Jun 28 2017 02:27
@Pagnito like fcc
Gulsvi
@gulsvi
Jun 28 2017 02:27
:)
It's awesome
Pagnito
@Pagnito
Jun 28 2017 02:28
yea, its so nice to have the lessons paved out like that, u just know that u wont have to lose a ton of time
CallMeOrange
@EgnaroDev
Jun 28 2017 02:28
@SkyC0der you learn JS from nodeschool?
Gulsvi
@gulsvi
Jun 28 2017 02:28
Yes @MCTwoDigitZero
But not much more than from here
You learn node.js at nodeschool
CallMeOrange
@EgnaroDev
Jun 28 2017 02:29
oh
what is node.js?
Pagnito
@Pagnito
Jun 28 2017 02:30
@MCTwoDigitZero yea im much more exceited about learnin node js and all the other stuff they offer, like git and electron
CallMeOrange
@EgnaroDev
Jun 28 2017 02:30
hm..
Pagnito
@Pagnito
Jun 28 2017 02:30
they even have a section on closures
that seems interesing
CallMeOrange
@EgnaroDev
Jun 28 2017 02:30
@Pagnito Can you explain what is node.js?
Pagnito
@Pagnito
Jun 28 2017 02:31
@MCTwoDigitZero shit, im still noob lol, ask sky, all i know is it allows you to write back-end code and use javascript in all kinds of ways
CallMeOrange
@EgnaroDev
Jun 28 2017 02:31
lol I thought you knew node.js
Pagnito
@Pagnito
Jun 28 2017 02:32
like combining it with electron to write a desktop app
CallMeOrange
@EgnaroDev
Jun 28 2017 02:32
Will it help with coding JS I wonder?
Pagnito
@Pagnito
Jun 28 2017 02:32
i never said that
CallMeOrange
@EgnaroDev
Jun 28 2017 02:32
Well
Pagnito
@Pagnito
Jun 28 2017 02:32
well, if u learning js, u gonna hve to learn node eventually
CallMeOrange
@EgnaroDev
Jun 28 2017 02:32
I kinda thought webpact is part of node.js or something
Pagnito
@Pagnito
Jun 28 2017 02:32
yea, dude itsa fucking jungle
Gulsvi
@gulsvi
Jun 28 2017 02:32
node.js is server-side javascript
Pagnito
@Pagnito
Jun 28 2017 02:32
once u get to this point, u gonna be tearing ur hair out lol
yea i always see that definition, but im still not sure exactly what that means
CallMeOrange
@EgnaroDev
Jun 28 2017 02:34
I see
I want to learn more JS then become a "master" in JS..
Gulsvi
@gulsvi
Jun 28 2017 02:35
server-side javascript means it runs on a remote server
CallMeOrange
@EgnaroDev
Jun 28 2017 02:35
Yeah
Gulsvi
@gulsvi
Jun 28 2017 02:35
the javascript we do in front end all runs in your browser
CallMeOrange
@EgnaroDev
Jun 28 2017 02:35
That what Back-end is right?
like database things
Gulsvi
@gulsvi
Jun 28 2017 02:35
Yeah, and it makes it so the server does all the heavy lifting instead of your browser
so you can run more powerful applications
CallMeOrange
@EgnaroDev
Jun 28 2017 02:35
yeah I heard same thing lol
Pagnito
@Pagnito
Jun 28 2017 02:35
@SkyC0der so what does electron do that allows it make desktop apps?
CallMeOrange
@EgnaroDev
Jun 28 2017 02:35
"heavy lifting"
I dont want to learn back-end yet. I just want to focus front end
Gulsvi
@gulsvi
Jun 28 2017 02:36
I don't know a lot about electron - it basically takes the browser into a windows/mac application shell
so, it looks like a normal application you run, but all the code is JS/HTML/CSS
Kind of like a mini browser that you launch from your desktop/taskbar/launcher
Pagnito
@Pagnito
Jun 28 2017 02:37
so when i build an app with node js whats the point of it, if eventually deploy it online anyways
CallMeOrange
@EgnaroDev
Jun 28 2017 02:37
about @MathematicsCoding
Gulsvi
@gulsvi
Jun 28 2017 02:37
You can do more with node.js than you can with client-side javascript
CallMeOrange
@EgnaroDev
Jun 28 2017 02:37
about @SkyC0der
Wow
Gulsvi
@gulsvi
Jun 28 2017 02:37
botstatus
:)
skynet is down
CallMeOrange
@EgnaroDev
Jun 28 2017 02:38
I think gitter is disconnected from fCC
Maybe?
thanks @SkyC0der
CamperBot
@camperbot
Jun 28 2017 02:38
mctwodigitzero sends brownie points to @skyc0der :sparkles: :thumbsup: :sparkles:
:star2: 1865 | @skyc0der |http://www.freecodecamp.com/skyc0der
CallMeOrange
@EgnaroDev
Jun 28 2017 02:38
hm
Gulsvi
@gulsvi
Jun 28 2017 02:38
Wow, you do know how to say thanks :p
:joy:
CallMeOrange
@EgnaroDev
Jun 28 2017 02:38
lmao
Pagnito
@Pagnito
Jun 28 2017 02:38
@SkyC0der so how does that capability get translated once it is deplyed
once the app is online is it still running on node
CallMeOrange
@EgnaroDev
Jun 28 2017 02:38
Alright I gtg
Bye wont be gone too long
Pagnito
@Pagnito
Jun 28 2017 02:39
@MCTwoDigitZero peace
Gulsvi
@gulsvi
Jun 28 2017 02:39
Hmmm, think about running something like facebook
There's some code on the client side, in your browser, but a bunch of that code runs on servers
it talks to databases, other servers around the world, etc.... puts all the information together, and then shows you the data
Pagnito
@Pagnito
Jun 28 2017 02:40
ooooh
Gulsvi
@gulsvi
Jun 28 2017 02:40
your browser then does some minimal work to make it look nice - apply the HTML/CSS
Pagnito
@Pagnito
Jun 28 2017 02:41
but with client side, it recieves all the code and THEN the clients computer executes it?
Gulsvi
@gulsvi
Jun 28 2017 02:41
Yeah, kind of - the client makes a request, the servers do a lot of work, then tell your computer how to display it once they gather all the information
Pagnito
@Pagnito
Jun 28 2017 02:42
and on server side, its already put together?
and then sent?
Gulsvi
@gulsvi
Jun 28 2017 02:45
Yes
(sorry slow response lol)
time for dinner, bbl
Pagnito
@Pagnito
Jun 28 2017 02:50
np
cool see u later
Benny
@BenYoshi
Jun 28 2017 02:57

I tried making an API call to darksky via hardcoding the longitude and latitude, but it's not returning anything. Can anyone explain why?''''''$(function() {
getLocation();
getLocalWeather();
});

function getLocalWeather() {
$.ajax({
url: "https://api.darksky.net/forecast/f17c8b5d53438b900745165f543d92a3/37.8267,-122.4233",
success: function(response) {
$("#response").html(response.longitude);
}
});
}'''''''

CamperBot
@camperbot
Jun 28 2017 02:57
:bulb: to format code use backticks! ``` more info
Benny
@BenYoshi
Jun 28 2017 02:57
well that didnt work
$(function() { getLocalWeather(); }); function getLocalWeather() { $.ajax({ url: "https://api.darksky.net/forecast/f17c8b5d53438b900745165f543d92a3/37.8267,-122.4233", success: function(response) { $("#response").html(response.longitude); } });
ah screw it, here's the pen: https://codepen.io/BenYoshi/pen/MoErbx
Why isn't it calling the API?
Gulsvi
@gulsvi
Jun 28 2017 03:20
@BenYoshi add dataType: 'jsonp' to your $.ajax call. Some APIs don't allow cross origin requests (codepen.io -> api.darksy.net) so you have to use JSONP to work around it.
Benny
@BenYoshi
Jun 28 2017 03:22
thanks, but I added that and still nothing
Gulsvi
@gulsvi
Jun 28 2017 03:22
@BenYoshi looks like it's working just fine now
Check again
Erick Delfin
@Nifled
Jun 28 2017 03:23
Anyone mind helping me?
Benny
@BenYoshi
Jun 28 2017 03:23
oh that's weird, looks like it is
thank you @SkyC0der
CamperBot
@camperbot
Jun 28 2017 03:23
benyoshi sends brownie points to @skyc0der :sparkles: :thumbsup: :sparkles:
:star2: 1866 | @skyc0der |http://www.freecodecamp.com/skyc0der
Erick Delfin
@Nifled
Jun 28 2017 03:23
I'm trying to get rid of the gap between the butons and the quote div
If I override the align-content flexbox attr It works but they get pushed upward, instead of being vertically aligned
CallMeOrange
@EgnaroDev
Jun 28 2017 03:59
@SkyC0der you on?
This is about Factorialize a Number, but forget it, I want to figure this out by myself
Gulsvi
@gulsvi
Jun 28 2017 04:17
@MCTwoDigitZero Okay, forgot about it :p
CallMeOrange
@EgnaroDev
Jun 28 2017 04:17
@SkyC0der well maybe not..
I tried to use for loop
Gulsvi
@gulsvi
Jun 28 2017 04:17
for loop should work well
CallMeOrange
@EgnaroDev
Jun 28 2017 04:18
yeah
But Im able to multiply parameter and i's last number
Gulsvi
@gulsvi
Jun 28 2017 04:18
5
*4
*3
*2
*1
= 120
CallMeOrange
@EgnaroDev
Jun 28 2017 04:18
Yeah I know how number! work
musa B sesay
@musasesay
Jun 28 2017 04:18
hi any every one i need help on java
CallMeOrange
@EgnaroDev
Jun 28 2017 04:18
Like 6! = 1 2 3 4 5 * 6 = ...
...
Gulsvi
@gulsvi
Jun 28 2017 04:19
yes
CallMeOrange
@EgnaroDev
Jun 28 2017 04:19
Yeah I heard about it before on Quora lol
Used in calculus or something..

function factorialize(num) {
  for (var i = 0; i < num; i++) {
console.log(i); // 1,2,3,4
  }
  return num*i;
}

factorialize(5);
musa B sesay
@musasesay
Jun 28 2017 04:20
Algorithm 1 IR-tree Construction
Input: a document set, D; minimal node fanout, min;
maximal node fanout, max;
Output: the root of an IR-tree;
Procedure:
1: N e ← ∅
2: for each d ∈ D do
3: geo-code d and represent L d with MBB m d ;
4: if ∃e ∈ N e ,m e = m d then
5: add d to e’s document set D e ;
6: else
7: create a new entry e;
8: set m e ← m d and D e ← {d};
9: N e ← N e ∪ {e};
10: for each e ∈ N e do
11: build inverted file with each list l w w.r.t. every word w in at
least one document d ∈ D e ;
12: while |N e | > n max do
13: cluster N e according to min/max into nodes, represented as
new entries N 0 e ; form document summary for e in N 0 e ;
14: N e ← N 0 e ;
15: create the root node to cover N e and their document summaries;
16: output the root node;
CallMeOrange
@EgnaroDev
Jun 28 2017 04:20
I know this dont work like that but I just started it
musa B sesay
@musasesay
Jun 28 2017 04:20
coding it with java
Gulsvi
@gulsvi
Jun 28 2017 04:20
i is only defined inside the for() loop
CallMeOrange
@EgnaroDev
Jun 28 2017 04:20
oh right

function factorialize(num) {
  for (var i = 0; i < num; i++) {
console.log(i); // 1,2,3,4
    return num*i;
  }
}

factorialize(5);
Yeah only multiply parameter and i's number
Forgot to change 0 to 1, since it start at 1..
Gulsvi
@gulsvi
Jun 28 2017 04:21
@musasesay I think you're in the wrong chat room
@MCTwoDigitZero return exits the for() loop
musa B sesay
@musasesay
Jun 28 2017 04:22
@SkyC0der im sorry really
Gulsvi
@gulsvi
Jun 28 2017 04:22
So, you need to define a variable and multiply it by i on every loop. when the loop is done, return that variable
CallMeOrange
@EgnaroDev
Jun 28 2017 04:22
oh right again..

function factorialize(num) {
  for (var i = 0; i < num; i++) {
console.log(i); // 1,2,3,4
    var arr = num*i;
  }
return arr;
}

factorialize(5);
Will that work?
Gulsvi
@gulsvi
Jun 28 2017 04:23
@musasesay No worries - if you're working on problems like that, you can probably help us a lot here :)
musa B sesay
@musasesay
Jun 28 2017 04:24
ok
CallMeOrange
@EgnaroDev
Jun 28 2017 04:24
hm, cant return that is used out of scope
Gulsvi
@gulsvi
Jun 28 2017 04:24
In that code, on the first loop you do
arr = num * 1
which is 5
then arr = num * 2
now arr = 10
then arr = num * 3
arr = 15
CallMeOrange
@EgnaroDev
Jun 28 2017 04:25
yeah..
Gulsvi
@gulsvi
Jun 28 2017 04:25
you end with arr = num * 4 which is 20
CallMeOrange
@EgnaroDev
Jun 28 2017 04:26
I see
Only multiply the number after loop is done
Gulsvi
@gulsvi
Jun 28 2017 04:27
think of it like this:
5 * 1 = 5
5 * 2 = 10
10 * 3 = 30
30 * 4 = 120
take the answer and multiply it by the next i
CallMeOrange
@EgnaroDev
Jun 28 2017 04:30
Oh I see
Need to figure out how to take that answer then multiply it by i
Gulsvi
@gulsvi
Jun 28 2017 04:31
maybe makes more sense going in reverse:
5 * 4 = 20
20 * 3 = 60
60 *2 = 120
CallMeOrange
@EgnaroDev
Jun 28 2017 04:31
I guess that work too
oh I think I get it...
Gulsvi
@gulsvi
Jun 28 2017 04:32
5*4*3*2*1 = 120
5*4*3*2 = 120
no need to multiply by 1
CallMeOrange
@EgnaroDev
Jun 28 2017 04:33
Yea
I thought of something but that didnt work very well..
Sorry Im eating atm
Gulsvi
@gulsvi
Jun 28 2017 04:36
I'm drinking :beer: :)
CallMeOrange
@EgnaroDev
Jun 28 2017 04:38
Lucky...
:beers:
I changed loop a bit
for reverse
like this, Im confused about reverse..
for (var i = num; i > num; i--) {

}
Im trying console.log in codepen but it doesnt even run..
Gulsvi
@gulsvi
Jun 28 2017 04:39
i > 0
CallMeOrange
@EgnaroDev
Jun 28 2017 04:39
Of course
Gulsvi
@gulsvi
Jun 28 2017 04:39
5,4,3,2,1
or i > 1 since you don't need to multiply by 1
5,4,3,2
CallMeOrange
@EgnaroDev
Jun 28 2017 04:39
Right
or i >= 0?
Never mind :/
bharathbheemireddy
@bharath506315
Jun 28 2017 04:40
Gulsvi
@gulsvi
Jun 28 2017 04:40
5 * 0 = 0
CallMeOrange
@EgnaroDev
Jun 28 2017 04:40
yeah lol
@bharath506315 thanks
CamperBot
@camperbot
Jun 28 2017 04:40
mctwodigitzero sends brownie points to @bharath506315 :sparkles: :thumbsup: :sparkles:
:cookie: 251 | @bharath506315 |http://www.freecodecamp.com/bharath506315
CallMeOrange
@EgnaroDev
Jun 28 2017 04:47
@SkyC0der looks like Im back to same spot...
Gulsvi
@gulsvi
Jun 28 2017 04:48
Let's see your code
CallMeOrange
@EgnaroDev
Jun 28 2017 04:48

function factorialize(num) {
  for (var i = num; i > 1; i--) {
 console.log(i); // 5,4,3,2
 var arr = i;
  }
  return num*arr;
}

factorialize(5);
I know i is only defined inside loop block but is it ok to use variable outside of loop that contain i?
Gulsvi
@gulsvi
Jun 28 2017 04:49
Yes, that's fine
The problem is that you reset the value of arr on every loop
CallMeOrange
@EgnaroDev
Jun 28 2017 04:50
yea.. Im trying to figure it out
How to use value each loop
Never mind, you are talking about arr
Gulsvi
@gulsvi
Jun 28 2017 04:50
yeah, when the loop is done, arr = 2
CallMeOrange
@EgnaroDev
Jun 28 2017 04:51
Yeah
Gulsvi
@gulsvi
Jun 28 2017 04:51
you return num * arr, or 5 * 2
CallMeOrange
@EgnaroDev
Jun 28 2017 04:51
Yes
Gulsvi
@gulsvi
Jun 28 2017 04:51
So, you can't use var inside your for loop
CallMeOrange
@EgnaroDev
Jun 28 2017 04:52
oh
So I guess something like this?
function factorialize(num) {
  for (var i = num; i > 1; i--) {
 console.log(i); // 5,4,3,2
 num = num*i;
  }
  return num;
}

factorialize(5);
Gulsvi
@gulsvi
Jun 28 2017 04:52
better, but now walk through the loop
CallMeOrange
@EgnaroDev
Jun 28 2017 04:53
i return 5 to 2
Gulsvi
@gulsvi
Jun 28 2017 04:53
num starts at 5
i starts at 5
so num = 5 * 5
CallMeOrange
@EgnaroDev
Jun 28 2017 04:54
so
yeah
I was going to say that :/
Gulsvi
@gulsvi
Jun 28 2017 04:54
then you do num = 25 * 4
then 100 * 3
300*2
CallMeOrange
@EgnaroDev
Jun 28 2017 04:54
But I dont know how to do that
Gulsvi
@gulsvi
Jun 28 2017 04:54
You can't change num
CallMeOrange
@EgnaroDev
Jun 28 2017 04:54
so i only?
bharathbheemireddy
@bharath506315
Jun 28 2017 04:54
@MCTwoDigitZero better and if num is 0 you need to return 1 so add if statement
CallMeOrange
@EgnaroDev
Jun 28 2017 04:55
What if I create
@bharath506315 Yeah I plan to add that after I get it
Guess I will add it now..
@SkyC0der but first.. why does my remaining code return 600?
Gulsvi
@gulsvi
Jun 28 2017 04:57
because you change num
bharathbheemireddy
@bharath506315
Jun 28 2017 04:57
@MCTwoDigitZero you are using num = num*i means everytime you are looping i value will be increased
Gulsvi
@gulsvi
Jun 28 2017 04:57
define a new variable to store your answer
CallMeOrange
@EgnaroDev
Jun 28 2017 04:58
@SkyC0der to store it but Im not supposed to return it?
Gulsvi
@gulsvi
Jun 28 2017 04:59
answer = num // 5
answer = answer * 4 // 20
answer = answer * 3 // 60
answer = answer * 2 // 120
return answer // 120
the loop needs to basically do that ^^
5 * 4 * 3 * 2
CallMeOrange
@EgnaroDev
Jun 28 2017 04:59
return 120
Gulsvi
@gulsvi
Jun 28 2017 05:00
5 * 4 = 20
20 * 3 = 60
60 * 2 = 120
return 120
CallMeOrange
@EgnaroDev
Jun 28 2017 05:01
Yeah..
I understand what you are saying but im still clueless..
Sorry, I wont be able to figure it out today
Gulsvi
@gulsvi
Jun 28 2017 05:05
It's okay, think about it. Maybe the answer will hit you tomorrow :)
I have to go to sleep :zzz: anyway
CallMeOrange
@EgnaroDev
Jun 28 2017 05:05
@SkyC0der Night, thanks
CamperBot
@camperbot
Jun 28 2017 05:05
mctwodigitzero sends brownie points to @skyc0der :sparkles: :thumbsup: :sparkles:
:star2: 1868 | @skyc0der |http://www.freecodecamp.com/skyc0der
Gulsvi
@gulsvi
Jun 28 2017 05:07
Night!
Pravin Mache
@pravinmache
Jun 28 2017 05:27
@pravinmache
hi I want wikipedia to return 10 results. below query is returning only one results.
https://en.wikipedia.org/w/api.php?action=query&titles=india&format=jsonfm&prop=extracts&exintro=true&exlimit=5&exsentences=3
Umer Mahmood
@umerqureshi91
Jun 28 2017 05:57
Hello everyone!!!
I stuck with the first intermediate front end project. The random Quote machine project.
I am*
Those of you who have completed this project using XMLHttpRequest way, please suggest me a working quote API.
Pieter Stokkink
@forkerino
Jun 28 2017 06:02
@umerqureshi91 @JLuboff made the following API: https://thesimpsonsquoteapi.glitch.me/quotes
Umer Mahmood
@umerqureshi91
Jun 28 2017 06:04
@forkerino Its working just fine now. Thanks alot.
CamperBot
@camperbot
Jun 28 2017 06:04
umerqureshi91 sends brownie points to @forkerino :sparkles: :thumbsup: :sparkles:
:star2: 2782 | @forkerino |http://www.freecodecamp.com/forkerino
Pieter Stokkink
@forkerino
Jun 28 2017 06:05
all thanks should go to @JLuboff , he made it!
CamperBot
@camperbot
Jun 28 2017 06:05
forkerino sends brownie points to @jluboff :sparkles: :thumbsup: :sparkles:
:star2: 2013 | @jluboff |http://www.freecodecamp.com/jluboff
shivam gupta
@shivamg11000
Jun 28 2017 06:10
anyone can help me with how to use a promise, like am fetching a list of data with $.getJson then I want to console.log the object.
Sahil Sunny
@sahilsunny
Jun 28 2017 06:11
Why is paragraph not centering?
https://jsfiddle.net/#&togetherjs=0pAz4JjBKn
shivam gupta
@shivamg11000
Jun 28 2017 06:11
@sahilsunny use
text-align: center;
Subramanya Chakravarthy
@chakrihacker
Jun 28 2017 06:12
@shivamg11000 can u show code?
Sahil Sunny
@sahilsunny
Jun 28 2017 06:12
@shivamg11000 But it should have done without it I mean with absolute positioning it works but why not with relative
shivam gupta
@shivamg11000
Jun 28 2017 06:13
@sahilsunny use should never use positining propertyfor cntering text
Pieter Stokkink
@forkerino
Jun 28 2017 06:14
@shivamg11000 https://api.jquery.com/jquery.getjson/ about halfway through they describe the Promise interface for getJSON
Sahil Sunny
@sahilsunny
Jun 28 2017 06:15
@shivamg11000 I know but I am experimenting. I want to know the reason why is it not working
Jim Tryon
@jimtryon
Jun 28 2017 06:16
just got it, that was me in the collab session
You want to use text-align: center for center a block element
Subramanya Chakravarthy
@chakrihacker
Jun 28 2017 06:17
@shivamg11000 you are logging the data
Sahil Sunny
@sahilsunny
Jun 28 2017 06:17
@jimtryon I know text-align will work but why previous method was not working? it works with absolute positioning
Jim Tryon
@jimtryon
Jun 28 2017 06:18
@sahilsunny You can use padding to get the vertical align
Sahil Sunny
@sahilsunny
Jun 28 2017 06:19

@jimtryon Thank you brother, But I know how to hack through the problem. But I want to know the reason behind


div {
border: 5px solid green;
width: 250px;
height: 90px;
}

p {
margin: 0;
position: relative;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}


CamperBot
@camperbot
Jun 28 2017 06:19
sahilsunny sends brownie points to @jimtryon :sparkles: :thumbsup: :sparkles:
:cookie: 267 | @jimtryon |http://www.freecodecamp.com/jimtryon
Sahil Sunny
@sahilsunny
Jun 28 2017 06:19
not working
shivam gupta
@shivamg11000
Jun 28 2017 06:20
@chakrihacker yep
iso
@iso1048
Jun 28 2017 06:21
image.png
could someone please tell me if i am linking the stylesheet to the html correctly?
Subramanya Chakravarthy
@chakrihacker
Jun 28 2017 06:28
@shivamg11000 as @forkerino said look into it getJson
Sahil Sunny
@sahilsunny
Jun 28 2017 06:28
@jimtryon Got it the reason it was not working is because parent element was not relative
Subramanya Chakravarthy
@chakrihacker
Jun 28 2017 06:31
you can use fetch_API , it's promise based
Amit Patel
@AmitP88
Jun 28 2017 06:37
hey guys, I've been hacking away at getting the Twitch.tv API project to work, but have had no luck so far: https://codepen.io/AmitP88/pen/xrPLZv?editors=1011 I can't get the channels to show up on my page even after using the API key from twitch
idanperelview
@idanperelview
Jun 28 2017 06:39
How can I run bootstrap and my own css rules on codepen? it looks like they cancel each other. I want to use for example bootstrap's classes and yet give css rules to my H2 class and other classes... any help?
kirbyedy
@kirbyedy
Jun 28 2017 06:42
@idanperelview give a separate class name for your h2 and apply attributes to it
or id
iso
@iso1048
Jun 28 2017 06:44
image.png
Could someone please tell me if I am linking my stylesheet to the html correctly?
Jim Tryon
@jimtryon
Jun 28 2017 06:47
The first one doesn’t look right @gothamknight
You would want to specify the path in the href
iso
@iso1048
Jun 28 2017 06:50
@jimtryon the first link element is working but the second link element is not. is the href in the second link element correct?
Jim Tryon
@jimtryon
Jun 28 2017 06:50
the second one looks good
iso
@iso1048
Jun 28 2017 06:52
@jimtryon oh. the stylesheet is not linking though. any idea why that might be?
Jim Tryon
@jimtryon
Jun 28 2017 06:56
which stylesheet is not linking?
iso
@iso1048
Jun 28 2017 07:08
the second one. (named home.css)
KinderPreet Singh
@kindercappy
Jun 28 2017 07:37
Please checkout my Weather app. Feedback is appreciated.
https://codepen.io/kindercappy/pen/bRaNgo
Baibhav Gautam
@baibhavx
Jun 28 2017 07:45
@kindercappy you should put a button to toggle between Celcius and Farehneit. Also it should show the type of current weather(Sunny, Rainy, windy, snow?) and display appropriate icon. Right now its showing all icons. Other that that your app looks good!
KinderPreet Singh
@kindercappy
Jun 28 2017 07:47
@baibhavx i put all the icons just as a background. styling type. the weather current weather icon is under the city name. i guess i should make all it stand out. thanks
CamperBot
@camperbot
Jun 28 2017 07:47
kindercappy sends brownie points to @baibhavx :sparkles: :thumbsup: :sparkles:
:cookie: 342 | @baibhavx |http://www.freecodecamp.com/baibhavx
Redoy
@redoy786
Jun 28 2017 07:48
@kindercappy nice weather icons.hope it will be a great weather app.
Baibhav Gautam
@baibhavx
Jun 28 2017 07:49
yeah and also display the current weather text. I used the same API, I think its currText or smth.
see below the icon, it says the type of weather
KinderPreet Singh
@kindercappy
Jun 28 2017 07:53
on it @baibhavx
thanks @redoy786
CamperBot
@camperbot
Jun 28 2017 07:53
kindercappy sends brownie points to @redoy786 :sparkles: :thumbsup: :sparkles:
:cookie: 170 | @redoy786 |http://www.freecodecamp.com/redoy786
Baibhav Gautam
@baibhavx
Jun 28 2017 07:55
@kindercappy did you do the animations yourself?
KinderPreet Singh
@kindercappy
Jun 28 2017 07:57
@baibhavx no. i looked it up
Baibhav Gautam
@baibhavx
Jun 28 2017 07:57
I see. Yeah that would have taken a long time and commitment. Goodluck with the rest of your app.
I am doing the TicTacToe right now. Trying to setup the AI, pulling my hair
Kshitijaa Jaglan
@KshitijaaJaglan
Jun 28 2017 08:36
Can anyone pleae help me out with the contacts section of this.
so that the label and input are both in the same line
kirbyedy
@kirbyedy
Jun 28 2017 08:38
Screen Shot 2017-06-28 at 11.38.27.png
you have margin somewhere applied @KshitijaaJaglan
Kshitijaa Jaglan
@KshitijaaJaglan
Jun 28 2017 08:39
no, i used offset @kirbyedy
kirbyedy
@kirbyedy
Jun 28 2017 08:40
well remove it then
shivam gupta
@shivamg11000
Jun 28 2017 08:42

anyone on how can I modify this code

function fetchData(){  
  streamersName.forEach(function(streamer){
    var url = endpoint + streamer + cb;
    $.getJSON(url, function(obj){
       streamerArray.push(obj);
    });
  });
  setTimeout(function(){
    console.log(streamerArray);
  }, 5000);
}

, make it better, like using a promise

Kshitijaa Jaglan
@KshitijaaJaglan
Jun 28 2017 08:42
@kirbyedy done, but still didn't help
kirbyedy
@kirbyedy
Jun 28 2017 08:44
your code is messy
and I think you closed the div on the wrong place
there... now the aligning is ok, you just push it to the center or wherever you want
Screen Shot 2017-06-28 at 11.45.31.png
Kshitijaa Jaglan
@KshitijaaJaglan
Jun 28 2017 08:48
@kirbyedy I just wanted that the label (for example 'first name') and its input field lie in the same line.
kirbyedy
@kirbyedy
Jun 28 2017 08:49
then you should not use this col-md-2 col-sm-2
Kshitijaa Jaglan
@KshitijaaJaglan
Jun 28 2017 08:51
still they are not in the same line
image.png
Sweet Coding :)
@SweetCodingInc
Jun 28 2017 08:56
@shivamg11000
function fetchData() {
  return new Promise( (resolve, reject) => {
    let responses = [];
    streamersName.forEach(streamer => {
      let url = endpoint + streamer + cb;
      responses.push($.getJSON(url));
    });

    Promise.all(responses).then( allResponses => {
      resolve(allResponses);
    });
  });
}

fetchData().then( response => console.log(response)); // Will log an array that contain all the responses
shivam gupta
@shivamg11000
Jun 28 2017 08:57
@SweetCodingInc hey thanks for that, whats let in this code
CamperBot
@camperbot
Jun 28 2017 08:57
shivamg11000 sends brownie points to @sweetcodinginc :sparkles: :thumbsup: :sparkles:
:cookie: 40 | @sweetcodinginc |http://www.freecodecamp.com/sweetcodinginc
Sweet Coding :)
@SweetCodingInc
Jun 28 2017 08:58
@shivamg11000 It's an ES6 syntax. It is like var (but not completely)
shivam gupta
@shivamg11000
Jun 28 2017 08:58
@SweetCodingInc any need of preprocessor?
for that
Sweet Coding :)
@SweetCodingInc
Jun 28 2017 08:59
@shivamg11000 : Here is an ES5 equivalent
function fetchData() {
  return new Promise( function(resolve, reject) {
    var responses = [];
    streamersName.forEach(function (streamer) {
      var url = endpoint + streamer + cb;
      responses.push($.getJSON(url));
    });

    Promise.all(responses).then( function (allResponses) {
      resolve(allResponses);
    });
  });
}

fetchData().then(function(response) {
  console.log(response) // Will log an array that contain all the responses
});

@SweetCodingInc any need of preprocessor?

Not in latest browsers

shivam gupta
@shivamg11000
Jun 28 2017 09:00
@SweetCodingInc ty
CamperBot
@camperbot
Jun 28 2017 09:00
shivamg11000 sends brownie points to @sweetcodinginc :sparkles: :thumbsup: :sparkles:
:warning: shivamg11000 already gave sweetcodinginc points
shivam gupta
@shivamg11000
Jun 28 2017 09:01
what actually the use of ES6
Be1ar
@Be1ar
Jun 28 2017 09:02
How do I make my project images the same size?How do I make my contact form responsive?
heroiczero
@heroiczero
Jun 28 2017 09:04
@Be1ar you can either set the height: and width: attribute in css as the same or in the img tag
@Be1ar first paragraph looks so small when you view it in a phone
Billy Pavlos Korompilias
@divergentbilly
Jun 28 2017 09:07
Hello world! :) If someone can have a look at my pen's JS it could be great! I'm stuck on the weather api implementation https://codepen.io/DivergentBilly/pen/JJrqWy
I was getting across a disabled cross-origin resource sharing (CORS) but now I am getting nothing
Francisco Machado
@CodeFiasco
Jun 28 2017 09:11
@divergentbilly I think it's showing a 404 error on my page
Billy Pavlos Korompilias
@divergentbilly
Jun 28 2017 09:11
yes, didn't work because of the https thing
this exercise sucks on pen!
Francisco Machado
@CodeFiasco
Jun 28 2017 09:13
I just checked mine and it also isn't working haha :D
it was working in 2015 though...
Billy Pavlos Korompilias
@divergentbilly
Jun 28 2017 09:14
well I was looking at other people's apps and none worked!
lol
I think they should reconsider this one
Francisco Machado
@CodeFiasco
Jun 28 2017 09:15
from the page I see they now recommend using the dark sky api
which is what you are using, so probably the issue is somewhere in your code
let me take a look
Billy Pavlos Korompilias
@divergentbilly
Jun 28 2017 09:16
yes, I am not sure if I call correctly
thank you Francisco
Francisco Machado
@CodeFiasco
Jun 28 2017 09:19
@divergentbilly well first thing I see wrong is the way you are building the string
var weatherApi = '"' + weatherUrl + weatherKey + lat + "," + lon + '"';
you are declaring these variables as strings
Michuello
@Michuello
Jun 28 2017 09:20
Hi everyone. I have a huge problem with challenege "Using Objects for Lookups". I got stuck for several hours. What do I do wrong?

// Setup
function phoneticLookup(val) {
var result = "";

// Only change code below this line

var val = {
"alpha": "Adams",
"bravo": "Boston",
"charlie": "Chicago",
"delta": "Denver",
"echo": "Easy",
"foxtrot": "Frank",
};
// Only change code above this line
return result;
}

// Change this value to test
phoneticLookup("charlie");

Francisco Machado
@CodeFiasco
Jun 28 2017 09:20
you don't need '"' in the beginning and end
Billy Pavlos Korompilias
@divergentbilly
Jun 28 2017 09:20
ok
done
Francisco Machado
@CodeFiasco
Jun 28 2017 09:21
@divergentbilly does it work or still nothing?
Billy Pavlos Korompilias
@divergentbilly
Jun 28 2017 09:21
no :/
Francisco Machado
@CodeFiasco
Jun 28 2017 09:25
@divergentbilly another error is your getJson
you only need to pass it the link you want the request to go to
the first time you do it is correct, I don't know why you added 2 arguments there
also you are passing the wrong variable
Billy Pavlos Korompilias
@divergentbilly
Jun 28 2017 09:26
because I got the security error I think
Francisco Machado
@CodeFiasco
Jun 28 2017 09:26
you should be passing weatherApi and not weatherUrl
Billy Pavlos Korompilias
@divergentbilly
Jun 28 2017 09:26
let me check
ok refresh to see the error
Francisco Machado
@CodeFiasco
Jun 28 2017 09:28
it will still give you the cross origin error
Billy Pavlos Korompilias
@divergentbilly
Jun 28 2017 09:28
so is this a dead end?
Francisco Machado
@CodeFiasco
Jun 28 2017 09:29
add this before the weatherAPI 'https://crossorigin.me'
Billy Pavlos Korompilias
@divergentbilly
Jun 28 2017 09:29
with a + ?
ah great!
wait
Francisco Machado
@CodeFiasco
Jun 28 2017 09:30
don't forget a / at the end
should look like this:
$.getJSON('https://crossorigin.me/' + weatherApi).done(function(data)
I am now receiving the data
it seems that you have more errors down the line though...
also you are not using the right values for lat and long by the way
Billy Pavlos Korompilias
@divergentbilly
Jun 28 2017 09:32
ah I get temperature!!! <3 :)
no?
it finds my area
Francisco Machado
@CodeFiasco
Jun 28 2017 09:32
because you probably put in your lat and long in the beginning
the issue is here
var lat = "37.7576793";
var lon = "-122.50764";
var weatherKey = '0f4ed8de35b6f8874bd6fbaf5b64e720/';
var weatherUrl = 'https://api.darksky.net/forecast/';    
var weatherApi = weatherUrl + weatherKey + lat + "," + lon;
Billy Pavlos Korompilias
@divergentbilly
Jun 28 2017 09:33
no this is new york, I added a default, it finds me in Greece now. Why you say I put them wrong?
Francisco Machado
@CodeFiasco
Jun 28 2017 09:33
here you declare the weatherApi variable with lat of 37.7 and lon with -122.5
when you do this:
lat = location.latitude;
lon = location.longitude;
the weatherApi variable won't change
Billy Pavlos Korompilias
@divergentbilly
Jun 28 2017 09:34
yeah I could just remove the first values right?
ah because it is before right?
Francisco Machado
@CodeFiasco
Jun 28 2017 09:34
you need to generate the weatherApi variable only after you get those values
lat = location.latitude;
lon = location.longitude;
var weatherApi = weatherUrl + weatherKey + lat + "," + lon;
this should work
you were getting the right place, but probably not the right weather :D
Billy Pavlos Korompilias
@divergentbilly
Jun 28 2017 09:35
ok did it :)
lol
Francisco Machado
@CodeFiasco
Jun 28 2017 09:36
hope that helped ;)
Billy Pavlos Korompilias
@divergentbilly
Jun 28 2017 09:36
you really helped!
how can I add the units flag to this api?
it doesnt work like others with the &units=something
Francisco Machado
@CodeFiasco
Jun 28 2017 09:37
@divergentbilly I don't know, you can probably find that in the API documentation
Billy Pavlos Korompilias
@divergentbilly
Jun 28 2017 09:37
anyway thank you very much for your time Francisco!!! <3
Francisco Machado
@CodeFiasco
Jun 28 2017 09:37
no problem
Rahul Raman
@rahul1raman
Jun 28 2017 09:38
Hey guys! Need a little help. Suppose you have an array of items [1, 2, 3 , 4]. This is displayed in a dropdown. When the dropdown item 1 is selected, I want 1 to be removed from the dropdown and displayed as a tag. When the tag labelled 1 is removed, it should be added back to the dropdown at the first position as before. How do I go about doing it?
Francisco Machado
@CodeFiasco
Jun 28 2017 09:39
@rahul1raman First add an event listener to the dropdown which checks which value was selected and shows the correspondent tag as well as hides the item in the dropdown
after that add an event listener to the label which does the opposite...
Rahul Raman
@rahul1raman
Jun 28 2017 09:40
but how do i position it back at the same spot , ie index 0 of array
Francisco Machado
@CodeFiasco
Jun 28 2017 09:43
@rahul1raman you can add custom attributes to the html
which would say the index of the item I guess
or instead of removing it you can just hide it...
so once it's showing again you don't need to order it
Rahul Raman
@rahul1raman
Jun 28 2017 09:44
alright i'll try it
Francisco Machado
@CodeFiasco
Jun 28 2017 09:46
@rahul1raman let me make a quick fiddle
Rahul Raman
@rahul1raman
Jun 28 2017 09:46
@CodeFiasco yeah that'll be helpful :)
Be1ar
@Be1ar
Jun 28 2017 09:48
How to make my form stable with scrooling?
Francisco Machado
@CodeFiasco
Jun 28 2017 10:03
@rahul1raman I don't think you can hide options in the select element
you can disable them but even that doesn't have a very good behaviour
Rahul Raman
@rahul1raman
Jun 28 2017 10:03
yeah. i tried hiding it too
i'll have to splice it from array
Francisco Machado
@CodeFiasco
Jun 28 2017 10:04
@rahul1raman how the hell do I share a JSFiddle lol
Rahul Raman
@rahul1raman
Jun 28 2017 10:04
paste the link
Jim Tryon
@jimtryon
Jun 28 2017 10:04
You copy/paste the link to the fiddle @CodeFiasco
Francisco Machado
@CodeFiasco
Jun 28 2017 10:05
@jimtryon ++
The behaviour on the select object isn't very good though
I think you actually need to splice it...
Rahul Raman
@rahul1raman
Jun 28 2017 10:06
@CodeFiasco but then how do i add it back to same position
Francisco Machado
@CodeFiasco
Jun 28 2017 10:07
if the value in the option has the index you can do a while loop
you run through all the options until the index you want is bigger than the previous one and smaller than the next
insert it there
makes sense?
Rahul Raman
@rahul1raman
Jun 28 2017 10:08
it does.
Francisco Machado
@CodeFiasco
Jun 28 2017 10:08
but if you are removing the item from the select there's another issue
which is: which item stays selected after you remove it
Rahul Raman
@rahul1raman
Jun 28 2017 10:09
it wouldnt work that way with strings though.
Francisco Machado
@CodeFiasco
Jun 28 2017 10:09
what do you mean with strings?
Rahul Raman
@rahul1raman
Jun 28 2017 10:10
like my actual array has ['a - b', 'c -d', 'e-f'] something like this
Nathan
@clarken1996
Jun 28 2017 10:11
hey does anyone know why display: none; is making my search icon move? https://codepen.io/ClarkeN/pen/pwWaoo
you tried it!
@you-tried-it
Jun 28 2017 10:12
hi
@divinegift
Francisco Machado
@CodeFiasco
Jun 28 2017 10:12
<select>
  <option value="0">a - b</option>
  <option value="1">c - d</option>
</select>
like this?
Rahul Raman
@rahul1raman
Jun 28 2017 10:13

code

<select>

Jim Tryon
@jimtryon
Jun 28 2017 10:13
Yeah, but also give the options a name attribute
Rahul Raman
@rahul1raman
Jun 28 2017 10:15
<option value="item in arr">{{item}}</option>
Adit
@adittyagi
Jun 28 2017 10:18
Hey, can anyone help me with portfolio challenge ?
EpicTriffid
@EpicTriffid
Jun 28 2017 10:20
Hello all. So Im currently working on changing the text of a message when i initiate a click event. I can change the text, but I dont know how to put the fadein/fadeout into my js code
$("#motiv").on("click", function () {
$(".test").html("Loading Motivational Quote...");
});
that's what im doing to change the text of "please slect quote"
shivam gupta
@shivamg11000
Jun 28 2017 10:21
I have completed the twich api challenge , pls check for error
https://codepen.io/shivamg11000/full/zzPVwR/
I have used jquery for event onclick, I want to use only React, can anyone help me with my project
Nathan
@clarken1996
Jun 28 2017 10:25
hey does anyone know why display: none; is making my search icon move? https://codepen.io/ClarkeN/pen/pwWaoo
you tried it!
@you-tried-it
Jun 28 2017 10:27
hi
i have a question...
there's this guy that i like...
he's into computer science and stuff
how do i get him to notice me?
Jim Tryon
@jimtryon
Jun 28 2017 10:30
are you asking for dating advice?
Nathan
@clarken1996
Jun 28 2017 10:44
@divinegift learn how to code
Roman Struna
@RomchyFCC
Jun 28 2017 10:48
hahahaha
what the xD
question totally off-topic but smite me if the answers weren't 110% on point hahahaha
Francisco Machado
@CodeFiasco
Jun 28 2017 10:58
How do I pass arguments to a callback?
object.addEventListener('click',  myFunction);
i tried myFunction(var) but it actually runs the function when I add the event listener...
h1tag
@h1tag
Jun 28 2017 11:06
@CodeFiasco so do you want to define the function there also?
or is it defined somewhere else in the code?
Francisco Machado
@CodeFiasco
Jun 28 2017 11:07
@h1tag it's somewhere else. I was able to do it using .bind
h1tag
@h1tag
Jun 28 2017 11:08
@CodeFiasco thank you for sharing
CamperBot
@camperbot
Jun 28 2017 11:08
h1tag sends brownie points to @codefiasco :sparkles: :thumbsup: :sparkles:
:cookie: 292 | @codefiasco |http://www.freecodecamp.com/codefiasco
Loris Hanck
@Pouletcoq
Jun 28 2017 11:45
Hello how can i remove the spaces that are on tope of the symbols ':, x, -, +, =' ? :smiley: https://codepen.io/Pouletcoq/pen/awVWxE
Pendramon
@Pendramon
Jun 28 2017 12:28
For those who love helping people here i did a demonstration on how CSS Overriding works which you can just paste the link to people who don't understand it tell me if i am missing something or if my grammar is wrong https://jsfiddle.net/4qoxvhqj/
Eric Weiss
@eweiss17
Jun 28 2017 12:49
@Pendramon are you sure using the css content is the best way to show that...
Pendramon
@Pendramon
Jun 28 2017 12:50
Well.. no xd but all of them are demonstrated so i thought it would be easier for someone to understand it
Eric Weiss
@eweiss17
Jun 28 2017 12:53
that fiddle is real confusing and i understand how overridding works...
i have never seen the content attribute ever....
Pendramon
@Pendramon
Jun 28 2017 12:54
Well you learned something that is good :)
Eric Weiss
@eweiss17
Jun 28 2017 12:55
i assumed you were gonna explain how you can override bootstrap or something and why you can
i don't know the practicality, i feel showing that to a new person would just confuse them
Pendramon
@Pendramon
Jun 28 2017 12:57
Idk i prefer learning like that thought everyone else might aswell
Eric Weiss
@eweiss17
Jun 28 2017 12:58
tl:dr , classes override tags, id's override classes and !important says f*ck the rules?
Pendramon
@Pendramon
Jun 28 2017 13:02
I put it in an order from the lowest to the highest override
Sweet Coding :)
@SweetCodingInc
Jun 28 2017 14:52
@eweiss17 That is correct
It's easier to understand if they start explaining it like, CSS will first apply element rules, then it will apply class rules, then id rules, and then !important rules.
ironically ! in computer science stands for not. Are they saying not important ? :D
Ravi Kishore Thella
@ravikishorethella
Jun 28 2017 14:56
@SweetCodingInc no :smile:
Eric Weiss
@eweiss17
Jun 28 2017 15:22
oh so !important means not important?
Nathan
@clarken1996
Jun 28 2017 15:23
Hey does anyone know why my search icon moves location because of the display:none in my input-group, have been looking at it for agesss https://codepen.io/ClarkeN/pen/pwWaoo
Ravi Kishore Thella
@ravikishorethella
Jun 28 2017 15:25
@eweiss17 no, !important means important
Eric Weiss
@eweiss17
Jun 28 2017 15:26
thought ! means not
Ravi Kishore Thella
@ravikishorethella
Jun 28 2017 15:29
yes, but not in css :smile:
Heather
@GingerJava
Jun 28 2017 15:29
Can someone please take a look at my weather app and tell me why my temperature conversion button is not working? https://codepen.io/G1nger/pen/gWyvNp
Eric Weiss
@eweiss17
Jun 28 2017 15:32
neither of your guys pens even work for me
Ken Haduch
@khaduch
Jun 28 2017 15:32
@GingerJava - you have some javascript syntax errors - run the "Analyze JS" on the JS panels dropdown (upper right corner) and see what it tells you.
@GingerJava - unless you forgot to save, but I was able to get it to load the page by inserting some parentheses and curly braces in the appropriate places.
but the Fahrenheit button isn't working... so I'll check that next
Heather
@GingerJava
Jun 28 2017 15:37
@khaduch it says I am missing a semicolon and I have an unmatched } but I can't see where...
Ken Haduch
@khaduch
Jun 28 2017 15:37
@GingerJava - I think that I fixed things in these two code blocks:
$.ajax({
  url: Weather,
  dataType: "jsonp",
  success: function(data) {
    console.log(data);
    var location = data.location.city;
    var temp = data.current_observation.temp_f;
    var desc = data.current_observation.weather;
    $(".location").html(location);
    $(".temp").html(temp + "°");
    $(".desc").html(desc);

    var tempC = Math.round((temp - 32) * 5 / 9);
    $("temp").text(temp + "°");
  }
});

$(function() {
  $(".switch").change(function() {
    if ($(this).prop("checked")) {
      $(".temp").html(tempC + "° ");
    } else {
      $(".temp").html(temp + "° ");
    }
  });
});
Nathan
@clarken1996
Jun 28 2017 15:38
@khaduch any luck with my codepen?
Ken Haduch
@khaduch
Jun 28 2017 15:38
@clarken1996 - haven't tried it yet... one at a time... :)
@GingerJava - I htink that your other problem is the scope of the tempC and temp variables - they are not available to the function that your switch code is running, they are local to the callback function for your ajax request. Try to make them globals and it will possibly work.
Heather
@GingerJava
Jun 28 2017 15:41
@khaduch how do i do that without messing up the api code?
Ken Haduch
@khaduch
Jun 28 2017 15:43
@GingerJava - just declare them at the same level as your var key variable is declared, and within the ajax callback remove the keyword "var" from the lines where you set them.
Heather
@GingerJava
Jun 28 2017 15:44
@khaduch did i do it right?
@khaduch because now its not working lol
Ken Haduch
@khaduch
Jun 28 2017 15:46
@GingerJava - I didn't reload to see. There seems to be a problem with the "checked" property, for your checkbox., at least when you are accessing "this" - I think that maybe you want your handler to be on the checkbox instead of the ".switch"?
Heather
@GingerJava
Jun 28 2017 15:47
@khaduch so change .switch to .checkbox?
Ken Haduch
@khaduch
Jun 28 2017 15:48
@GingerJava - I added a class of "theBox" to the actual input element, and then in the handler function, I used $(".theBox") and that works, it seems?
Heather
@GingerJava
Jun 28 2017 15:50
@khaduch can you check it now? because now the temp, city and desc are gone... https://codepen.io/G1nger/pen/gWyvNp
@khaduch i really appreciate your help, i've been trying to get this to work for days
Ken Haduch
@khaduch
Jun 28 2017 15:52
@GingerJava - take those computations and settings off the places where you declare var temp and var tempC because you don't have the data at that point to fill them in. Just set them to 0;
FullstopCoding
@FullstopCoding
Jun 28 2017 15:52
hi everyone, just looking for a simple explanation on what I'm missing
lines 126 and 127
Eric Weiss
@eweiss17
Jun 28 2017 15:53
i don't see your result @FullstopCoding
FullstopCoding
@FullstopCoding
Jun 28 2017 15:53
it's just a console log
Heather
@GingerJava
Jun 28 2017 15:53
@khaduch IT WORKS!!!! OMG you're my hero!!!!!! thank you!!!!
CamperBot
@camperbot
Jun 28 2017 15:53
gingerjava sends brownie points to @khaduch :sparkles: :thumbsup: :sparkles:
:star2: 3050 | @khaduch |http://www.freecodecamp.com/khaduch
Heather
@GingerJava
Jun 28 2017 15:53
at least it was just syntax. my code worked for the most part :)
Ken Haduch
@khaduch
Jun 28 2017 15:54
@GingerJava - you're welcome - make sure you understand why it is working now... best of luck with continued lessons!
FullstopCoding
@FullstopCoding
Jun 28 2017 15:54
if I want to put my data into an array properly, so that my streamerAPIJSON.push(apiResponse); matches the sampleList
how would I do that?
Eric Weiss
@eweiss17
Jun 28 2017 15:55
what is this sample list....?
FullstopCoding
@FullstopCoding
Jun 28 2017 15:55
it's declared above
it's a sample JSON response
I don't know how to push my data into an array properly it seems
Heather
@GingerJava
Jun 28 2017 15:55
@khaduch yes i totally get what i did wrong. i knew that i had a scope problem but i wasn't sure how to fix it without messing up the api code. thank you! i've really been trying to get good help on this for awhile now.
CamperBot
@camperbot
Jun 28 2017 15:55
gingerjava sends brownie points to @khaduch :sparkles: :thumbsup: :sparkles:
:warning: gingerjava already gave khaduch points
Ken Haduch
@khaduch
Jun 28 2017 15:56
@clarken1996 - I don't see how you are getting the behavior that you are asking about - although if I put the display:none; back in your group, then I see it... are you just testing by modifying the code? The problem is that when you turn off the input-group, it is removing the div block and then that icon just re-flows up to the end of the previous string. Try putting it in a div of its own and see if that works?
@clarken1996 - that does - it makes it a separate block-level element and it will stay on a row by itself.
@GingerJava - good, happy to be of service... :)
Heather
@GingerJava
Jun 28 2017 15:59
@khaduch i "followed" you :)
Eric Weiss
@eweiss17
Jun 28 2017 15:59
@FullstopCoding stick 126 into 120
and by into i mean under
works when like that
Nathan
@clarken1996
Jun 28 2017 16:01
@khaduch thanks
CamperBot
@camperbot
Jun 28 2017 16:01
clarken1996 sends brownie points to @khaduch :sparkles: :thumbsup: :sparkles:
:star2: 3051 | @khaduch |http://www.freecodecamp.com/khaduch
FullstopCoding
@FullstopCoding
Jun 28 2017 16:01
thanks @eweiss17 I've changed my code a bit since posting the above, I'm going to assume it's the stringify text?
CamperBot
@camperbot
Jun 28 2017 16:01
fullstopcoding sends brownie points to @eweiss17 :sparkles: :thumbsup: :sparkles:
:cookie: 506 | @eweiss17 |http://www.freecodecamp.com/eweiss17
Eric Weiss
@eweiss17
Jun 28 2017 16:01
It's pretty much the data you get form this api
can only be accessed in the function that you call it
i'm trying to look up better info about callback
Kevin
@kevinwr
Jun 28 2017 16:05

Can anyone help me align my content vertically center? I've tried all the suggestions on this site: https://www.w3.org/Style/Examples/007/center.en.html#vertical

But so far, nothing has worked.

right now my site still looks like this:
image.png
Eric Weiss
@eweiss17
Jun 28 2017 16:09
@FullstopCoding It has to do with asynchronous calls, I have a link about it, one sec.
FullstopCoding
@FullstopCoding
Jun 28 2017 16:11
thanks @eweiss17 , I've updated my code a bit, in the console you can see the 2 differences in the array
CamperBot
@camperbot
Jun 28 2017 16:11
fullstopcoding sends brownie points to @eweiss17 :sparkles: :thumbsup: :sparkles:
:warning: fullstopcoding already gave eweiss17 points
FullstopCoding
@FullstopCoding
Jun 28 2017 16:13
basically what I want to do is pull the data into an array, and then manipulate the data after that with jQuery into my page, so I can do multiple things without having to make more api requests...not sure if that makes sense, or is the correct way of doing things, but
that's my goal!
Andrew Hickman
@ahickman3
Jun 28 2017 16:14
@FullstopCoding i had a ton of issue with this with my imgur api, so if you need help, i spent like 2 hours trying to understanding it, then getting it to work properly. Asynch and synch calls are kind of confusing at first
Eric Weiss
@eweiss17
Jun 28 2017 16:14
@kevinwr look up flexbox
FullstopCoding
@FullstopCoding
Jun 28 2017 16:16
@kevinwr The Net Ninja has some good videos on flexbox, https://www.thenetninja.co.uk/courses/css-flexbox-tutorial
shivam gupta
@shivamg11000
Jun 28 2017 16:17
anyone could explain me this, maybe with an example
function successCallback(result) {
  console.log("It succeeded with " + result);
}

function failureCallback(error) {
  console.log("It failed with " + error);
}

doSomething(successCallback, failureCallback);
Eric Weiss
@eweiss17
Jun 28 2017 16:17
@shivamg11000 assuming doSomething is a function?
that code is invalid
unless you give us the doSomething function
FullstopCoding
@FullstopCoding
Jun 28 2017 16:18
yeah @fullmetal7777 I'm working on the TwitchTV API project, and I have it working pulling in my data based on a looped ajax request and then stuffing it into my website, but I want to put it into an array instead, and modify the data in the array after
Andrew Hickman
@ahickman3
Jun 28 2017 16:18
@FullstopCoding i also did that exactly lol
i had an album of pictures that i was using
shivam gupta
@shivamg11000
Jun 28 2017 16:18
@eweiss17 I dont know trying to learn promise in js from here https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Using_promises
Andrew Hickman
@ahickman3
Jun 28 2017 16:19
and depeneding on the name, it would pic one of 8 different pictures relating to that name
@FullstopCoding https://codepen.io/fullmetal7777/pen/RgKagp if you click the quote button, tha background showing up are pulled from that album via imgur api
what you essentially have to do is recall the ajax function anything you want to use json data
anytime*
FullstopCoding
@FullstopCoding
Jun 28 2017 16:21
but don't I just end up making a bunch of API calls?
Eric Weiss
@eweiss17
Jun 28 2017 16:23
@shivamg11000 execute funciton, on success call one function, on failure call other function
shivam gupta
@shivamg11000
Jun 28 2017 16:24
@eweiss17 any example like with $.getJSON()
Ken Haduch
@khaduch
Jun 28 2017 16:24
@clarken1996 - you're welcome...
Nick Sladic
@Nickadiemus
Jun 28 2017 16:25
@fullmetal7777 Is that your finished quote machine?
Eric Weiss
@eweiss17
Jun 28 2017 16:25
@shivamg11000 i have never used promises, but it says right here, "Essentially, a promise is a returned object you attach callbacks to, instead of passing callbacks into a function."
shivam gupta
@shivamg11000
Jun 28 2017 16:26
@eweiss17 yeah , But I also want to understand that approach too that was used in old times
Eric Weiss
@eweiss17
Jun 28 2017 16:26
why are you using promises?
'old times' lol
shivam gupta
@shivamg11000
Jun 28 2017 16:27
@eweiss17 To use with ajax, aschronous code
Eric Weiss
@eweiss17
Jun 28 2017 16:27
why don't you make some doing it the "old way"
then try to convert it to the promise way
FullstopCoding
@FullstopCoding
Jun 28 2017 16:28
maybe it's best I explain why I wanted to put it in an array, this is my properly functioning codepen for my TwitchAPI challenge
shivam gupta
@shivamg11000
Jun 28 2017 16:28
I have understand a little about promise, but I am not getting any idea on the other way of doing it
@eweiss17
Eric Weiss
@eweiss17
Jun 28 2017 16:28
if you don't understand it, why use it
it seems to be a shortcut
FullstopCoding
@FullstopCoding
Jun 28 2017 16:28
I want to be able to sort the data before I display it, and then modify my data with jQuery after, is that the best way to do it? I'm not sure
shivam gupta
@shivamg11000
Jun 28 2017 16:29
@shivamg11000 yeah that thin 'shortcut' leads to nothing
@FullstopCoding I too completed that challenge today
https://codepen.io/shivamg11000/full/zzPVwR/
Eric Weiss
@eweiss17
Jun 28 2017 16:30
sorry man, i'm not confident in the way promises work either. My suggestions, check google and youtube for tutorials
wait for somebody who has used them on here and ask them
or try to understand the documentation more
shivam gupta
@shivamg11000
Jun 28 2017 16:31
@eweiss17 I am already on it google, youtube
higher order functions
Eric Weiss
@eweiss17
Jun 28 2017 16:32
@FullstopCoding not sure what part you are on, but you can definitely modify the data after receiving it.
Andrew Hickman
@ahickman3
Jun 28 2017 16:32
@Nickadiemus yeah thats the finished product!
@FullstopCoding do you need the data to be sorted? Each image i used had like 6 different properties, but i didnt see much a reason to sort it, just to grab the url
Nick Sladic
@Nickadiemus
Jun 28 2017 16:34
@fullmetal7777 Congrats man!
Andrew Hickman
@ahickman3
Jun 28 2017 16:34
@FullstopCoding regardless, youd need to do all that in either the ajax/getJSON call, or create a function outside of the call, and have it call that function inside the ajax/getJSON call. That was the easiest solution for me
@Nickadiemus Thanks broskee, learning the api stuff was such a pain lol im happy with it though. Its simple, and i think the background thing is unique for the average random quote generator project
CamperBot
@camperbot
Jun 28 2017 16:35
fullmetal7777 sends brownie points to @nickadiemus :sparkles: :thumbsup: :sparkles:
:cookie: 327 | @nickadiemus |http://www.freecodecamp.com/nickadiemus
Kevin
@kevinwr
Jun 28 2017 16:37
@eweiss17 I tried flexbox, but it came out all wacky. I tried it by applying "display: flex" to my body element.
Eric Weiss
@eweiss17
Jun 28 2017 16:38
vertical-align: middle?
Kevin
@kevinwr
Jun 28 2017 16:38
@eweiss17 yep. Applied that to the body element as well, and it came out weird. Let me show you
Ashish sb
@ashishsb95
Jun 28 2017 16:39
Guys need help with the FOOTER , how do i make the margin bottom to be zero?https://codepen.io/ashishsb/pen/GEMbMJ
Kevin
@kevinwr
Jun 28 2017 16:40
@eweiss17 it didn't align the content vertically center, but moved the container to the left instead
image.png
image.png
Nick Sladic
@Nickadiemus
Jun 28 2017 16:41
@ashishsb95 make either your paragraph tags have 0 margin or set a class on your paragraph tag in your footer and give it a margin of 0px
@ashishsb95 That should fix it
@ashishsb95 Like this
Kevin
@kevinwr
Jun 28 2017 16:43
naw. I'll give it a look
thanks @eweiss17
CamperBot
@camperbot
Jun 28 2017 16:43
kevinwr sends brownie points to @eweiss17 :sparkles: :thumbsup: :sparkles:
:cookie: 507 | @eweiss17 |http://www.freecodecamp.com/eweiss17
Nick Sladic
@Nickadiemus
Jun 28 2017 16:43
<!-- footer -->
 <div class="myfooter ">
      <!--<div class="container-fluid">
          -->    
        <p class="">&copy; Copyright 2017 - Ashish S B.  All rights reserved.</p>
   <p class = "footerContact">
     Contact at ashishsb40@yahoo.com
   </p>
      <!--</div>-->
    </div>
CSS
.footerContact{
margin: 0px;
}
Kevin
@kevinwr
Jun 28 2017 16:44
oh wait...yes I have
lol
let me read it again though
shivam gupta
@shivamg11000
Jun 28 2017 16:44
can anyone tell me whether my promise is working or not, its not console longing the object


var data ;
function fetch(){

  var endpoint = 'https://api.twitch.tv/kraken/streams/';
  var cb = '?client_id=rolqskxubtqtqn8xmhj7gd3hhufnhw';
  var url = endpoint+'freecodecamp'+cb;
  $.getJSON(url,function(obj){
    data = obj;
  });
}
let promise = fetch();
promise.then(function(){
  console.log(data);
}, function(){
  console.log('faliure');
});
EpicTriffid
@EpicTriffid
Jun 28 2017 16:52
So Im making this Random Quote generator, and I've got no idea where to start on pulling through the API to generate the quotes? Is anyone able to help me?
Nick Sladic
@Nickadiemus
Jun 28 2017 16:56
@EpicTriffid What are you stuck on?
Eric Weiss
@eweiss17
Jun 28 2017 16:58
you using quotes on design? alternatively, you could just make an array of quotes to pull, some people do that.
EpicTriffid
@EpicTriffid
Jun 28 2017 16:59
@Nickadiemus So I've generated the layout I want to use, but now I dont know how to replace my main text with a randomly generated quote. I dont entirely understand how $getJSON works
Thats what it looks like
Eric Weiss
@eweiss17
Jun 28 2017 17:01
do you know what ajax is
EpicTriffid
@EpicTriffid
Jun 28 2017 17:02
Only vaguely. FreeCodeCamp very quickly went over what it was
Eric Weiss
@eweiss17
Jun 28 2017 17:02
well ajax is a mythological hero
was just testing your history
EpicTriffid
@EpicTriffid
Jun 28 2017 17:02
hehe
Fell on his sword
dramatic sod
Gulsvi
@gulsvi
Jun 28 2017 17:02
@shivamg11000 $.getJSON is a promise, so you can do:
function fetch(user){
  var endpoint = 'https://api.twitch.tv/kraken/streams/';
  var cb = '?client_id=rolqskxubtqtqn8xmhj7gd3hhufnhw';
  var url = endpoint+user+cb;
  return $.getJSON(url);
}

fetch('freecodecamp')
  .then(function(data) {
    console.log(data);
  }).catch(function(err) {
    console.error(err);
  });
Be careful about using the function name fetch() though - there's a JavaScript API called fetch()
Ashish sb
@ashishsb95
Jun 28 2017 17:03
@Nickadiemus i don't have any class as footercontact
Nick Sladic
@Nickadiemus
Jun 28 2017 17:04
@ashishsb95 I know you need to create something like that. I gave an example
Eric Weiss
@eweiss17
Jun 28 2017 17:04
@EpicTriffid did you already pick an api to use
Nick Sladic
@Nickadiemus
Jun 28 2017 17:04
@ashishsb95 that will fix your problem
Ashish sb
@ashishsb95
Jun 28 2017 17:05
@Nickadiemus you really though i woudn't have tried that?
EpicTriffid
@EpicTriffid
Jun 28 2017 17:05
Nick Sladic
@Nickadiemus
Jun 28 2017 17:07
@ashishsb95 I don't know. You asked for help so I gave it
Ashish sb
@ashishsb95
Jun 28 2017 17:07
@Nickadiemus should have tried yourself once
Kevin
@kevinwr
Jun 28 2017 17:09
UGH. wtf is it so hard to center vertically in CSS!?!?!
Eric Weiss
@eweiss17
Jun 28 2017 17:09
@kevinwr just say f*ck it, and position: absolute;
then move to wherever
position:absolute: top 50%; left: 50%;
@EpicTriffid i looked at that page and the api call seems to be
Nick Sladic
@Nickadiemus
Jun 28 2017 17:11
@ashishsb95 I fixed your problem within 15 seconds you posting it. Whether you choose to listen or not is dependent upon yourself
Ashish sb
@ashishsb95
Jun 28 2017 17:11
@kevinwr you can use table display and then allign vertically to center
Eric Weiss
@eweiss17
Jun 28 2017 17:11
http://api.forismatic.com/api/1.0/method=getQuote&key=
Ashish sb
@ashishsb95
Jun 28 2017 17:11
@Nickadiemus that setting up of height to 100% worked for me
@Nickadiemus none of which you mentioned
@Nickadiemus thanks for your help
CamperBot
@camperbot
Jun 28 2017 17:12
ashishsb95 sends brownie points to @nickadiemus :sparkles: :thumbsup: :sparkles:
:cookie: 328 | @nickadiemus |http://www.freecodecamp.com/nickadiemus
Ashish sb
@ashishsb95
Jun 28 2017 17:12
@Nickadiemus and your arrogance :-1:
Spetsnaz
@Spetsnaz-Dev
Jun 28 2017 17:12

<img src="https://tinyurl.com/yacptes9" class="img-circle" width="400px" height="340px"placeholder= "Ravindra Kumar Kahar" alt="Front-End Developer" title="An Image of Ravindra Kumar">Front End Web Developer</img>

How can i edit this "Front End Web Developer" text to change its font style and all...

Eric Weiss
@eweiss17
Jun 28 2017 17:13
with js?
Spetsnaz
@Spetsnaz-Dev
Jun 28 2017 17:14
@eweiss17 pls explain with some code....
Ashish sb
@ashishsb95
Jun 28 2017 17:14
@Spetsnaz-Dev the alt text is displayed when the img is not available or when you hover over it
Eric Weiss
@eweiss17
Jun 28 2017 17:14
did u do the jquery lessons yet
Spetsnaz
@Spetsnaz-Dev
Jun 28 2017 17:14
yes.... @eweiss17
Eric Weiss
@eweiss17
Jun 28 2017 17:15
$("img").attr("class", "img-square");
maybe give that an id for better targeting
Spetsnaz
@Spetsnaz-Dev
Jun 28 2017 17:15
@eweiss17 oh..i understood...thank you so much
CamperBot
@camperbot
Jun 28 2017 17:15
spetsnaz-dev sends brownie points to @eweiss17 :sparkles: :thumbsup: :sparkles:
:cookie: 508 | @eweiss17 |http://www.freecodecamp.com/eweiss17
Nick Sladic
@Nickadiemus
Jun 28 2017 17:15
@ashishsb95 my arrogance?
Eric Weiss
@eweiss17
Jun 28 2017 17:15
$("img").css("font-style", "italic");
Spetsnaz
@Spetsnaz-Dev
Jun 28 2017 17:16
@eweiss17 yup...even more convenient
Ashish sb
@ashishsb95
Jun 28 2017 17:16
@Nickadiemus you comment "I fixed your problem within 15 seconds you posting it. Whether you choose to listen or not is dependent upon yourself"
Eric Weiss
@eweiss17
Jun 28 2017 17:16
@Spetsnaz-Dev it's gonna be either attr, or css, check the jquery documentation, i don't know which one is better
Spetsnaz
@Spetsnaz-Dev
Jun 28 2017 17:16
ok
Ashish sb
@ashishsb95
Jun 28 2017 17:16
@Nickadiemus setting margin to 0 never worked
Nick Sladic
@Nickadiemus
Jun 28 2017 17:17
@ashishsb95 It does lol. Do you want me to show you the forked pen?
Ashish sb
@ashishsb95
Jun 28 2017 17:18
@Nickadiemus https://codepen.io/ashishsb/pen/GEMbMJ have a try again i commented my height css
Nick Sladic
@Nickadiemus
Jun 28 2017 17:20
Ashish sb
@ashishsb95
Jun 28 2017 17:23
@Nickadiemus ya it worked , my bad 1
Nick Sladic
@Nickadiemus
Jun 28 2017 17:23
@ashishsb95 I wasn't trying to dog you or anything man, just trying to help
Ashish sb
@ashishsb95
Jun 28 2017 17:23
@Nickadiemus why doesn't the margin work for the footer as a whole then.
@Nickadiemus i kept trying the css for footer as a whole.
Nick Sladic
@Nickadiemus
Jun 28 2017 17:25
@ashishsb95 It does, but because you're using bootstrap, their css has custom margining on all the different tags. Sometimes you have to look at bootstraps source code to either override it or override it manually
Ashish sb
@ashishsb95
Jun 28 2017 17:26
@Nickadiemus thanks again:>
CamperBot
@camperbot
Jun 28 2017 17:26
ashishsb95 sends brownie points to @nickadiemus :sparkles: :thumbsup: :sparkles:
:warning: ashishsb95 already gave nickadiemus points
Kamal
@kpbro
Jun 28 2017 17:30
i need help with a button. how can i add text that appears below mouse pointer when we hover on the button?
Quinn Vinlove
@quin2
Jun 28 2017 17:32
@kpbro look up "CSS hover property"
I haven't used it in years but I think that's how its done
you'd probably use a div with a class to identify the button, and do something like .class:hover{ //css goes here}
Kamal
@kpbro
Jun 28 2017 17:33
#buttonID:hover{

}
but property i have to specify in hover
Quinn Vinlove
@quin2
Jun 28 2017 17:33
juust off the top of my head
Kamal
@kpbro
Jun 28 2017 17:34
which property i have to use for displaying that text
Quinn Vinlove
@quin2
Jun 28 2017 17:34
changing the actual text would be a little harder
You could have the original, non-hovered text be the same color as the button
then change the color to be visible when you hover
there's also CSS transparency, you could set the content to be transparent, then visible when hovered
Kamal
@kpbro
Jun 28 2017 17:36
ok trying
Quinn Vinlove
@quin2
Jun 28 2017 17:36
there's also the visibility property, which is not a hack
visibility:hidden;
Vismay Patil
@vismay02
Jun 28 2017 17:40
https://codepen.io/vismay02/pen/YQwmba
This is my random quote machine , api not working so completed using array's.
It's fulfilling one user story but facing issue with the twitter button.
Ashish sb
@ashishsb95
Jun 28 2017 17:47
guys for my navbar, the scrollspy in bootstrap 4 , the data-offset doesn't seem to be working, the +ve values https://codepen.io/ashishsb/pen/GEMbMJ
FullstopCoding
@FullstopCoding
Jun 28 2017 17:48
I'm wondering if someone can explain to me the differences between my 2 arrays in my code
I console.log 2 arrays, one I can access with bracket and dot notation, the other (the one I made) I cannot
Kamal
@kpbro
Jun 28 2017 17:50
@quin2 found it.. you need to define title property in button tag. <button title="anytext"> button name</button>
FullstopCoding
@FullstopCoding
Jun 28 2017 17:50
sorry I may have linked old code
sorry, I fixed my push to the array I want my stuff in
Nathan
@clarken1996
Jun 28 2017 17:52
if I give something the cursor:pointer should a click function work?
EpicTriffid
@EpicTriffid
Jun 28 2017 17:53
Why wont this log anything to my console? $(document).ready(function() {
$("#motiv").on("click", function () {
$getJSON('http://quotesondesign.com/wp-json/posts?filter[orderby]=rand&filter[posts_per_page]=1&callback=', function(quote) {
console.log (quote.content);
});
});
Eric Weiss
@eweiss17
Jun 28 2017 17:59
switched to quotes on design?...
@clarken1996 giving it pointer doesn't affect anything besides the visual
EpicTriffid
@EpicTriffid
Jun 28 2017 18:01
Yeah, the other didn't seem to work for jquery
Ashish sb
@ashishsb95
Jun 28 2017 18:01
Guys just finished with my "Build a Personal Portfolio Webpage Complete  " Took around a week to complete this . Any suggestions, improvements or remarks are most welcome https://codepen.io/ashishsb/pen/GEMbMJ
Nathan
@clarken1996
Jun 28 2017 18:02
@eweiss17 thanks, do you know how I can fix my x button?https://codepen.io/ClarkeN/pen/pwWaoo
CamperBot
@camperbot
Jun 28 2017 18:02
clarken1996 sends brownie points to @eweiss17 :sparkles: :thumbsup: :sparkles:
:cookie: 509 | @eweiss17 |http://www.freecodecamp.com/eweiss17
dorealex
@dorealex
Jun 28 2017 18:06
Hello all
What's the secret for links leading out of Codepen again?
target = "blank"?
Nathan
@clarken1996
Jun 28 2017 18:07
@dorealex target="_blank"
dorealex
@dorealex
Jun 28 2017 18:08
@nathan thanks. Pretty sure that's what I put, but it doesn't seem to work...
CamperBot
@camperbot
Jun 28 2017 18:08
dorealex sends brownie points to @nathan :sparkles: :thumbsup: :sparkles:
:warning: @nathan's account is not linked with freeCodeCamp. Please visit the settings and link your GitHub account.
dorealex
@dorealex
Jun 28 2017 18:09
@clarken1996 thanks, sorry
CamperBot
@camperbot
Jun 28 2017 18:09
dorealex sends brownie points to @clarken1996 :sparkles: :thumbsup: :sparkles:
:cookie: 269 | @clarken1996 |http://www.freecodecamp.com/clarken1996
I think it's set properly, doesn't seem to work...
SavvasLimassol
@SavvasLimassol
Jun 28 2017 18:15
Hello guys, I'm doing the contact form on my portfolio. Is there anyway I can receive the inputs on my PC without turning it into a server? Because I also have no idea how to do that and I don't wanna compromise my computer. :P
SAURABH SHEORAIN
@SSheorain
Jun 28 2017 18:18
help me improve it.. provide ur feedback
https://codepen.io/SShero_2/full/KqXmvV/
CallMeOrange
@EgnaroDev
Jun 28 2017 18:19
That looks great!
FullstopCoding
@FullstopCoding
Jun 28 2017 18:19
can someone explain the difference between the 2 arrays I'm console.logging here?
CallMeOrange
@EgnaroDev
Jun 28 2017 18:19
Its not designed for mobile support but that is good enough for normal screen size
FullstopCoding
@FullstopCoding
Jun 28 2017 18:19
I can get the .length of one (sampleList) but not of the other (streamerKVP)
one list I made by pushing the API response into an array
the other is a premade JSON response
Nathan
@clarken1996
Jun 28 2017 18:23
@dorealex what part is not working?
Ken Haduch
@khaduch
Jun 28 2017 18:26
@FullstopCoding - the difficulty might be that you are trying to coneole.log them (the streamerKVP array) outside of the $.ajax request callback function - the way that this works is that the request goes out to the net, response comes back some time later... in the meanwhile, your code goes right along and tries to console.log the variable, which most likely hasn't been populated yet? The only way you'll see the contents of streamerKVP is after the callback function is invoked by the return from your request. Try to move the console.log(streamerKVP) into the success function of your ajax callback.
Ashish sb
@ashishsb95
Jun 28 2017 18:26
I just finished my portfolio challenge , how long do you guys think it will take me before i can start with the intermediate front-end challenge (i know a bit of JS, did competetive programming earlier(c++))?
FullstopCoding
@FullstopCoding
Jun 28 2017 18:27
I have a .push on the api response into an array
~ line 174
Ken Haduch
@khaduch
Jun 28 2017 18:28
@FullstopCoding - The only way you'll see the contents of streamerKVP is after the callback function is invoked by the return from your request. Try to move the console.log(streamerKVP) into the success function of your ajax callback.
FullstopCoding
@FullstopCoding
Jun 28 2017 18:29
so you can't exactly store responses from an API callback into an array?
CallMeOrange
@EgnaroDev
Jun 28 2017 18:29
Hello, Im still stuck on this challenge called Factorialize a Number..
FullstopCoding
@FullstopCoding
Jun 28 2017 18:29
should I try storing like apiResponse.object1.property1 or something similar into an array instead?
or am I going to get the same issues?
Ashish sb
@ashishsb95
Jun 28 2017 18:30
@MCTwoDigitZero what are you facing/
Ken Haduch
@khaduch
Jun 28 2017 18:30
@FullstopCoding - anything that you do within the success callback function will only be visible after the function is invoked. You can push whatever you want into the array, but it won't be there until the callback function runs.
@MCTwoDigitZero - what's your code look like?
Ashish sb
@ashishsb95
Jun 28 2017 18:30
@MCTwoDigitZero i mean regarding factorials
CallMeOrange
@EgnaroDev
Jun 28 2017 18:31
function factorialize(num) {
  if (num === 0) {
return 1;
  }

  for (var i = num; i > 1; i--) {

    var answer = num;
    answer *= i;

}
  return answer;
}

factorialize(5);
Im trying to figure out how to add one to i each time I multiply
FullstopCoding
@FullstopCoding
Jun 28 2017 18:31
I don't know what you mean by the callback function running
is this the asynchronous part of ajax? :D
Ken Haduch
@khaduch
Jun 28 2017 18:32
@MCTwoDigitZero - you don't have to add one to th enumber each time. multiplying 1 * 2 * 3 * 4 * 5 is the same as multiplying 5 * 4 * 3 * 2 * 1 so you can subtract from it as well as add.
CallMeOrange
@EgnaroDev
Jun 28 2017 18:33
but i is 2 after loop end
Ken Haduch
@khaduch
Jun 28 2017 18:33
@FullstopCoding - yes, exactly, the asynchronous part of ajax. Just put a console.log inside of your function, make it just output some text like "Hello there"... watch the console and see what happens.
FullstopCoding
@FullstopCoding
Jun 28 2017 18:34
yeah the console.logging is part of trying to understand it, realistically what I'm trying ot do is store the returned data in an array so I can manipulate it later...make 1 get request, store the data, and then mess with it after
Ken Haduch
@khaduch
Jun 28 2017 18:34
@MCTwoDigitZero - initialize your var answer to 1 before the for loop is entered. that might do it.
CallMeOrange
@EgnaroDev
Jun 28 2017 18:36
function factorialize(num) {
  if (num === 0) {
return 1;
  }
  var answer = 1;
  for (var i = num; i > 1; i--) {

   answer = num*i;
}
  return answer;
}

factorialize(5);
Like this?
Ken Haduch
@khaduch
Jun 28 2017 18:36
@FullstopCoding - yes, but you still have to synchronize with the return of the data, so within the callback function you can then manipulate the data, or after the callback function runs, but the sequence of events does not follow the sequence of the code in your JS panel. If you have something else that you need to do after the data is returned, then you have to invoke that from within your callback function...
@MCTwoDigitZero - yes - that's what I was thinking. Does it work any better?
@MCTwoDigitZero - oh, wait, you also changed your calculation line. Put that back as you originally had it: answer *= i;
CallMeOrange
@EgnaroDev
Jun 28 2017 18:38
No, not really, once i assign num to answer
Yeah like that
@khaduch I was going to do that but had num instead of i
@khaduch thanks
CamperBot
@camperbot
Jun 28 2017 18:38
mctwodigitzero sends brownie points to @khaduch :sparkles: :thumbsup: :sparkles:
:star2: 3052 | @khaduch |http://www.freecodecamp.com/khaduch
CallMeOrange
@EgnaroDev
Jun 28 2017 18:39
Seems I need to know more about loop a bit better
Ken Haduch
@khaduch
Jun 28 2017 18:39
@MCTwoDigitZero - take your code to http://pythontutor.com/javascript.html and plug it in and watch how it works.
CallMeOrange
@EgnaroDev
Jun 28 2017 18:39
I use that all time :D
Yep, I understand that code now