These are chat archives for FreeCodeCamp/HelpFrontEnd

23rd
Jun 2017
aRtoo
@artoodeeto
Jun 23 2017 00:01
how do you center an img??
Johnny
@jtan3
Jun 23 2017 00:02
@artoodeeto text-align: center the div the image is in
aRtoo
@artoodeeto
Jun 23 2017 00:02
@jtan3 i tried but nothing happens
Johnny
@jtan3
Jun 23 2017 00:03
@artoodeeto can you show your codepen?
aRtoo
@artoodeeto
Jun 23 2017 00:03
@jtan3 bro nevermind it worke
thanks bro
labyu
shelton louis
@louiss0
Jun 23 2017 00:04
@jtan3 pleas look at the code and change it i still cant see a thing
Johnny
@jtan3
Jun 23 2017 00:06
@louiss0 did you save your project? i don't see openweather api in your code
shelton louis
@louiss0
Jun 23 2017 00:08
i did you should see it now
Johnny
@jtan3
Jun 23 2017 00:08
@louiss0 you're not suppose to hard code your coordinates in your openweather api link.
shelton louis
@louiss0
Jun 23 2017 00:09
what do i do then
Johnny
@jtan3
Jun 23 2017 00:09
@louiss0 you got your coordinates from your ip api right?
shelton louis
@louiss0
Jun 23 2017 00:10
i think the problem is the api is not showing up on my console
yes
and put https://cors-anywhere.herokuapp.com/ in front of your ip-api url
shelton louis
@louiss0
Jun 23 2017 00:15
i did it
Johnny
@jtan3
Jun 23 2017 00:16
@louiss0 no spaces between the 2 urls and then console.log(data)
Dhrumit Thakkar
@Dhrumit14
Jun 23 2017 00:19

$(document).ready(function() {
var WikiData = "";

$.support.cors = true;
$("#WikiMe").on("click", function() {
    var SearchValue = $("#SearchMe").val();

    console.log(SearchValue);


    var GETWIKISEARCH = 'https://en.wikipedia.org/w/api.php?action=query&format=json&gsrlimit=15&generator=search&origin=*&gsrsearch=' + SearchValue;
    $.getJSON(GETWIKISEARCH).done(function(wiki) {



        console.log(wiki);
        var temp = wiki.query.pages[57570];
        console.log(temp);
        for (var i = 0; i < wiki.query.pages.length; i++) {
            WikiData = wiki.query.pages[i].title;
            console.log(WikiData);
        }

    })



})

})

can any one tell me why console.log(WikiData) is getting undefined ?
Johnny
@jtan3
Jun 23 2017 00:20
@louiss0 console.log(data) after you call your weather api
shelton louis
@louiss0
Jun 23 2017 00:22
can you be more specific i replaced api with data
CallMeOrange
@EgnaroDev
Jun 23 2017 00:22
Now Im working on Counting Cards..
Johnny
@jtan3
Jun 23 2017 00:23
$.getJSON(api, function(data){ console.log(data } @louiss0
glitz20
@glitz20
Jun 23 2017 00:28
Can anyone help me wit my progress bar? Appropriate color is not shown in the bar. https://codepen.io/sabin20/pen/QgMLJv
shelton louis
@louiss0
Jun 23 2017 00:29
got it
@jtan3 got it
Johnny
@jtan3
Jun 23 2017 00:33
@louiss0 cool
shelton louis
@louiss0
Jun 23 2017 00:35
the data is still not appearing on my buttons and one of the api on my console says undefined
Johnny
@jtan3
Jun 23 2017 00:42
@louiss0 right click your button and click "inspect", then look at the console in your browser. This will show you what errors you have. You can debug this way.
CallMeOrange
@EgnaroDev
Jun 23 2017 00:46
Anyone here watch Attack on Titan?
aRtoo
@artoodeeto
Jun 23 2017 00:49
hello. question how can i center the bubble speech? i just took the css code from the net. help please.
heres the code pen:
https://codepen.io/artoo/pen/owwKzW
Jorge
@flawedLogic506
Jun 23 2017 00:52
@sabin20 im showing red .. what color do u want?
CallMeOrange
@EgnaroDev
Jun 23 2017 00:53
@OrangeKulture have you do card counting before?
Jorge
@flawedLogic506
Jun 23 2017 00:54
@artoodeeto how are you rendering ralph's image?
@MCTwoDigitZero as in blackjack?
CallMeOrange
@EgnaroDev
Jun 23 2017 00:55
yea
Jorge
@flawedLogic506
Jun 23 2017 00:55
i know the theory, havent done it myself ..
CallMeOrange
@EgnaroDev
Jun 23 2017 00:55
I see...
Jorge
@flawedLogic506
Jun 23 2017 00:55
why u ask?
CallMeOrange
@EgnaroDev
Jun 23 2017 00:55
I dont like to work on algs for game I dont know about...
Just asking
I know how to play blackjack but this is different...
Jorge
@flawedLogic506
Jun 23 2017 00:56
yeah but where does the question stems from? is it a JS thing or just in general?
fdemaa
@fdemaa
Jun 23 2017 00:56
So guys anyone can give me a hint, i can't return all my biggest number, but at least i can when im doing console.log any suggestion ?
CallMeOrange
@EgnaroDev
Jun 23 2017 00:56
@OrangeKulture JS
Jorge
@flawedLogic506
Jun 23 2017 00:56
@fdemaa what challenge?
fdemaa
@fdemaa
Jun 23 2017 00:56
return largest number in arrays
Jorge
@flawedLogic506
Jun 23 2017 00:56
@MCTwoDigitZero is it a challenge ? or ..
CallMeOrange
@EgnaroDev
Jun 23 2017 00:56
yeah..
aRtoo
@artoodeeto
Jun 23 2017 00:57
@OrangeKulture im just changing the src bro. $('.testimg').attr("src",img);
Jorge
@flawedLogic506
Jun 23 2017 00:57
@artoodeeto ahh no i mean where is the src
i see the the quote API returns an image too
maaan i love the simpsons
CallMeOrange
@EgnaroDev
Jun 23 2017 00:58
lol quote machine for simpsons was good idea @artoodeeto
aRtoo
@artoodeeto
Jun 23 2017 00:58
@OrangeKulture heres the link bro. https://thesimpsonsquoteapi.glitch.me/
CallMeOrange
@EgnaroDev
Jun 23 2017 00:58
Anyone here watch Attack on Titan?
Jorge
@flawedLogic506
Jun 23 2017 00:58
yeah the problem is that you are specifying specific screen coordinates for the bubble class
aRtoo
@artoodeeto
Jun 23 2017 00:58
@MCTwoDigitZero its not really mine bro. i just asked for a quote API and i fellow sent it to me. hes also here in fcc
CallMeOrange
@EgnaroDev
Jun 23 2017 00:59
oh
Jorge
@flawedLogic506
Jun 23 2017 00:59
yeah the actual API has a pretty awesome UI
aRtoo
@artoodeeto
Jun 23 2017 00:59
@OrangeKulture the bubble is centered now bro. thanks
CamperBot
@camperbot
Jun 23 2017 00:59
artoodeeto sends brownie points to @orangekulture :sparkles: :thumbsup: :sparkles:
:cookie: 420 | @orangekulture |http://www.freecodecamp.com/orangekulture
Jorge
@flawedLogic506
Jun 23 2017 00:59
sure thing! glad to hear u solved it
CallMeOrange
@EgnaroDev
Jun 23 2017 00:59
@OrangeKulture Congrats reaching 420
aRtoo
@artoodeeto
Jun 23 2017 00:59
@OrangeKulture ikr. the one who made that is @JLuboff
Jorge
@flawedLogic506
Jun 23 2017 00:59
maaan .. i just noticed that lol
it's a sign
CallMeOrange
@EgnaroDev
Jun 23 2017 00:59
lol
fdemaa
@fdemaa
Jun 23 2017 01:00
4:20
CallMeOrange
@EgnaroDev
Jun 23 2017 01:00
I was surprised
Jorge
@flawedLogic506
Jun 23 2017 01:00
yeah i did look into the simpsons api when i was doing my project
CallMeOrange
@EgnaroDev
Jun 23 2017 01:00
Alright bye going to watch anime
Jorge
@flawedLogic506
Jun 23 2017 01:00
@fdemaa what was your problem dude?
cya later @MCTwoDigitZero
fdemaa
@fdemaa
Jun 23 2017 01:02
i dont know how to return my biggest number, im missing something,
if i use console.log the number are correct, but when i return, just return the First Biggest number of the first subarray
@OrangeKulture
Jorge
@flawedLogic506
Jun 23 2017 01:02
what was the challenge called?
fdemaa
@fdemaa
Jun 23 2017 01:02
Return Largest Numbers in Arrays
Jorge
@flawedLogic506
Jun 23 2017 01:03
haha duuh
sry, checking
fdemaa
@fdemaa
Jun 23 2017 01:03
haha lol
no problem
dont tell me the answer also please
maybe can you give me a hint?
Jorge
@flawedLogic506
Jun 23 2017 01:04
yeah sure .. i usually dont give out the answer btw ..
maybe look into the Math.max() method?
i used the spread operator, but that is for ES6 .. so if you are not too familiar with that, there are several ways you can handle it
what do you have so far?
fdemaa
@fdemaa
Jun 23 2017 01:06

Of course man sorry! , but some guys, just give away the answer, if i want it i just look on google haha lol

okey i have this

function largestOfFour(arr) {

var finalArray = [] ;
var comparator = 0;

    for ( var i = 0; i<arr.length; i++) {
  for(var j= 0; j<arr[i].length; j++){
    if(arr[i][j] > comparator ){
      comparator = arr[i][j]
    }
  }  
  console.log(comparator);
    }
}

largestOfFour([[4, 5, 1, 3], [13, 27, 18, 26], [32, 35, 37, 39], [1000, 1001, 857, 1]]);
Jorge
@flawedLogic506
Jun 23 2017 01:07
@fdemaa ohh yeah no definitely a good thing to say before you get someone to answer
that looks really good actually
the challenge asks that you return an array tho
fdemaa
@fdemaa
Jun 23 2017 01:07
yes
i can use push or something like
that ?
i dont remeber well
but i think there was a way i learn in fcc
Jorge
@flawedLogic506
Jun 23 2017 01:08
exactly, a push() would send that number to the new array
fdemaa
@fdemaa
Jun 23 2017 01:08
cool
Jorge
@flawedLogic506
Jun 23 2017 01:08
math.max is a great way to handle this tho
because it returns the largest number of an array
fdemaa
@fdemaa
Jun 23 2017 01:09
im not familiar with that, i will check it then
Sam
@sdedison
Jun 23 2017 01:10
Hi there, I'm trying to access the dark sky API for my weather app project, and I'm getting this error: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'https://s.codepen.io' is therefore not allowed access. I've read that this is related to something called CORS, but haven't been able to find a solution... Any documentation or solutions you would recommend?
Jorge
@flawedLogic506
Jun 23 2017 01:10
consider the following:
var arr = [1,2,3,4];

var max =  Math.max(arr);   // max = 4
fdemaa
@fdemaa
Jun 23 2017 01:10
@OrangeKulture thats great man
!
Jorge
@flawedLogic506
Jun 23 2017 01:10
yeah it's pretty useful
@sdedison how are you getting the response? ajax? getJSON ?
Sam
@sdedison
Jun 23 2017 01:11
@OrangeKulture I'm using getJSON, here's the codepen: https://codepen.io/sdedison/pen/weJYQP
Jorge
@flawedLogic506
Jun 23 2017 01:12
holy shit dude exceptional error handling ... thats one thing im too lazy to do :D
there's a couple ways you can get around the CORS error .. either using proxy(not good) or send a request to receive data in jsonp
Sam
@sdedison
Jun 23 2017 01:13
haha came across it as I researched HTML5 geolocation, seemed to make sense to use!
Jorge
@flawedLogic506
Jun 23 2017 01:14
nah its actually good ..
well first off, there's an error with your URL string
probably due to all the concat .. should close with " or '
Jean-Paul Sauve
@jp-sauve
Jun 23 2017 01:14
Can someone look at what I did on lines 49-62 to make this work in firefox on linux? It is the only thing that has worked, but doesn't make sense to me. And it doesn't work for FF android. https://github.com/jp-sauve/mister-weather/blob/master/js/script.js resulting page is here: https://jp-sauve.github.io/mister-weather/
Jorge
@flawedLogic506
Jun 23 2017 01:15
@sdedison woops nope, sorry .. i think i might deleted it accidentally
Sam
@sdedison
Jun 23 2017 01:15
@OrangeKulture haha ah! gotcha
@OrangeKulture how do I use jsonp?
@OrangeKulture I've seen it referenced, but haven't been able to see how to implement it
Jorge
@flawedLogic506
Jun 23 2017 01:16
its just a dataType request .. with an ajax call its a key-value pair within the data object .. with getJSON .. id have to play around a bit ... shortway is adding &callback=?
but i think one is able to pass in params onto the Darsky endpoint url .. something like &format=jsonp
Amit Patel
@AmitP88
Jun 23 2017 01:17
hey guys, I need a little help with my local weather app. I'm trying to get the weather json data to show up in the dev console based off of the users' location, but I run into the error: "cannot read property of readyState of undefined" at line 50 js. I have no idea how to resolve this and I need a little direction. Any help would be highly appreciated :) https://codepen.io/AmitP88/pen/oWVjqL?editors=0010
and yeah, I've been told to use jQuery for this, but I want to see if I can do it using vanilla JS, as it will give me a deeper understanding of how Ajax works
Sam
@sdedison
Jun 23 2017 01:18
@OrangeKulture ah! sounds good - I'll take a look at the API doc and try it out, thanks!
CamperBot
@camperbot
Jun 23 2017 01:18
:cookie: 421 | @orangekulture |http://www.freecodecamp.com/orangekulture
sdedison sends brownie points to @orangekulture :sparkles: :thumbsup: :sparkles:
Jorge
@flawedLogic506
Jun 23 2017 01:18
@sdedison sure thing, welcome!
@jp-sauve u mean its not returning the location object? this might be above my expertise tho
@jp-sauve think i see what u mean, high accuracy not kicking in for me on chrome
Jean-Paul Sauve
@jp-sauve
Jun 23 2017 01:21
yeah. If you take out the check for InstallTrigger and just use the "else" options, which are the sane ones, FF never gives the object, so the success callback is never called.
Jorge
@flawedLogic506
Jun 23 2017 01:21
@AmitP88 httpLocation is only available to the location request function
Jean-Paul Sauve
@jp-sauve
Jun 23 2017 01:23
I guess it's "working", so I should finish the project, but it's annoying that one browser doesn't work. I haven't even added the bit for locating by ip if geolocation isn't available, or handling errors.
Amit Patel
@AmitP88
Jun 23 2017 01:23
@OrangeKulture hmmm, if I move it outside the function to make it a global variable (within the window.onload function) it still says the same error, except that it applies to appliedWeather and window.onload
Jorge
@flawedLogic506
Jun 23 2017 01:24
yeah .. i know what u mean .. its kinda hard. For me, I decided that this was simply a showcase project, u know .. i found myself wasting entirely too much time trying to figure it all out, when in reality it could be used maybe a couple dozen times
Jean-Paul Sauve
@jp-sauve
Jun 23 2017 01:24
isn't within the window.onload function's scope one below global?
except for the function name, which would be global
Jorge
@flawedLogic506
Jun 23 2017 01:25
u know ppl looking at it, prospect employers and what not .. if it was a commercial release, i would definitely handle errors and do all the other stuff , but i just kinda settled for a simple usage .. and it works in every browser .. ip based location was crap, but i used the google maps api
Amit Patel
@AmitP88
Jun 23 2017 01:25
technically yes, I guess. but when I watched a tutorial on ajax, they wrapped the environment in a window.onload function
Jorge
@flawedLogic506
Jun 23 2017 01:25
@AmitP88 i dont think moving the variable is the solution, think about scope ..
u can have functions nested within the get location function ..
its basically manipulating the location data and rendering for the user
@AmitP88 why dont u use getJSON or an ajax call instead of the xmlhttps object
Amit Patel
@AmitP88
Jun 23 2017 01:29
@OrangeKulture well, I wanted to see if I could do it via regular JS so that I could get a deeper understanding of how it works. But, I suppose since that's the popular way, I should redo it using that
Jean-Paul Sauve
@jp-sauve
Jun 23 2017 01:29
@AmitP88 you have to check for the state
Amit Patel
@AmitP88
Jun 23 2017 01:29
@OrangeKulture so basically nest the other functions under the LocationRequest function?
Jorge
@flawedLogic506
Jun 23 2017 01:29
getJSON is a jquery method
Jean-Paul Sauve
@jp-sauve
Jun 23 2017 01:30
@AmitP88 you should only respond on state 4. also check for status==200
Amit Patel
@AmitP88
Jun 23 2017 01:30
@jp-sauve I thought I did though within the appendWeather function
Jorge
@flawedLogic506
Jun 23 2017 01:30
@AmitP88 im just throwing ideas out there .. not giving you the actual response
yeah also the state checks .. that defo needs to be done
Jean-Paul Sauve
@jp-sauve
Jun 23 2017 01:31
oh sorry I missed that
Amit Patel
@AmitP88
Jun 23 2017 01:31
yeah, I did that for both the location and weather requests under the functions appendLocation and appendWeather using if statements
I dunno how I'm going to finish the front end cert by the end of the month. I want to start learning React by beginning of next month
Jean-Paul Sauve
@jp-sauve
Jun 23 2017 01:32
@AmitP88 what browser are you using? You aren't checking for the other browser's objects, like IE
Amit Patel
@AmitP88
Jun 23 2017 01:33
@jp-sauve chrome
Jorge
@flawedLogic506
Jun 23 2017 01:34
@AmitP88 u dont have to if u dont want .. ui can still use the xmlhttps request
im just saying, the error you mentioned, it's due to scope
Amit Patel
@AmitP88
Jun 23 2017 01:35
@OrangeKulture I figure since the Intermediate Front End projects are primarily working with Ajax and APIs, I could do this project via xmlhttps request and the others using jquery Ajax and getJSON. That way I know how to do it both ways.
@OrangeKulture I had a feeling it would be. I think what I'll do is un-nest my functions so that they're on their own and think about what's happening logically. Then I'll try nesting again and see if it makes sense
@OrangeKulture I definitely have to work on my scoping knowledge
Jorge
@flawedLogic506
Jun 23 2017 01:36
yeah that makes sense for sure ... its good to have understading of both .. with some play around, you can definitely find the solution
Amit Patel
@AmitP88
Jun 23 2017 01:36
btw, how good should I be at JS before learning react? I've learned a bit of JSX but not much
Jean-Paul Sauve
@jp-sauve
Jun 23 2017 01:37
@AmitP88 what's the first if for? if (httpLocation.readyState === XMLHttpRequest.DONE) {
Jorge
@flawedLogic506
Jun 23 2017 01:37
it's just testint testing testing, at least thats how i do it
Amit Patel
@AmitP88
Jun 23 2017 01:37
@jp-sauve it's to check if the request for a response is completed. I followed that from MDN on Ajax
Jean-Paul Sauve
@jp-sauve
Jun 23 2017 01:38
that's what response code 4 is for. I was working through head-first ajax, and they didn't do that. and it works
function showUsernameStatus() {
    if (req.readyState == 4) {
        if (req.status == 200) {
            if (req.responseText == "okay") {
            document.getElementById("username").className = "approved";
            document.getElementById("register").disabled = false;
            }
            else {
                document.getElementById("username").className = "denied";
                document.getElementById("register").disabled = true;
                document.getElementById("username").focus();
                document.getElementById("username").select();
            }
     //       console.log(req);
        }
    }
}
I also read that you should nest, so you can deal with finished requests that aren't 200
Moisés Man
@moigithub
Jun 23 2017 01:41
@AmitP88 asynchronous code dont execute immediatelly.. each request takes time to resolve,
how much time?? many factors.. like server load, internet trafic, ISP and dunno what
also multiple request wont be resolved in same order
Amit Patel
@AmitP88
Jun 23 2017 01:41
@jp-sauve yeah, I was thinking the same thing. I just kind of read the doc and followed the example on MDN, but that makes more sense. I don't know why they included that in their example
@moigithub understood. I'm gonna carefully read through my code and refactor
Jean-Paul Sauve
@jp-sauve
Jun 23 2017 01:42
@AmitP88 oh right, I see. You declared "var jsonLocation" in your appendLocation function. That limits its scope, so it's not available for weather request.
Muhammad Hasham
@MohammadHasham
Jun 23 2017 01:43
any js folk here to help me out
Jean-Paul Sauve
@jp-sauve
Jun 23 2017 01:43
your location detection works for me, but you need to check for IE when getting the object:
```
function createRequest() {
    try {
        request = new XMLHttpRequest();
    } catch (tryMS) {
        try {
            request = new ActiveXObject("Msxml2.XMLHTTP");
        } catch (otherMS) {
            try {
                request = new ActiveXObject("Microsoft.XMLHTTP");
            } catch (failed) {
            request=null;
        }
    }
    }
    return request;
}
Amit Patel
@AmitP88
Jun 23 2017 01:44
@jp-sauve yeah, I tried experimenting with that variable. If I were to move it outside that function to make it more globally accessable, the location no longer appears in the app
@jp-sauve I guess that's why xml is going out of fashion huh? I think I read about that somewhere in a textbook
Jean-Paul Sauve
@jp-sauve
Jun 23 2017 01:45
really? a nested function should be able to access a parent's variable
Amit Patel
@AmitP88
Jun 23 2017 01:48
@jp-sauve yeah, if I try to move that variable outside the function (either above or below that function), it no longer renders the users' location
Jean-Paul Sauve
@jp-sauve
Jun 23 2017 01:48
can you link me to it again? I closed it
CallMeOrange
@EgnaroDev
Jun 23 2017 01:49
for Counting Cards, Can I use switch statements?
I cant find whats the different between if and switch statements? they are pretty much the same but switch is faster I think
Amit Patel
@AmitP88
Jun 23 2017 01:50
@jp-sauve here you go: https://codepen.io/AmitP88/pen/oWVjqL?editors=0010 I actually un-nested everything so that each function stands on its' own within window.onload function
Vincent Yan
@envincebal
Jun 23 2017 02:00
Hey guys, I'm stuck on my pomodoro project. I can't figure out where to use the clearTimeout method to stop the timer when I click on the circle. Any help would be appreciated.
Jorge
@flawedLogic506
Jun 23 2017 02:06
@MCTwoDigitZero if/else and switch work pretty much the same ... except you have more control with if/else at times, depending on what u wanna do
i think for pomodoro, setInterval works better than setTimeout
just a thought tho ..
Vincent Yan
@envincebal
Jun 23 2017 02:09
@OrangeKulture Okay thanks. I'll try that. But can you tell me where I should use clearInterval?
CamperBot
@camperbot
Jun 23 2017 02:09
envincebal sends brownie points to @orangekulture :sparkles: :thumbsup: :sparkles:
:cookie: 422 | @orangekulture |http://www.freecodecamp.com/orangekulture
Nathan
@clarken1996
Jun 23 2017 02:10
hey guys can someone tell me why my ul goes on the next line of my navbar instead of to the right?
    <nav class= "navbar navbar-default navbar-fixed-top">
        <div class= "container-fluid">
            <div class= "navbar-header">
                                <button type="button" class= "navbar-toggle collapsed" data-toggle= "collapse" data-target=".navHeaderCollapse" aria-expanded= "false">
                                    <span class= "sr-only">Toggle Navigation</span>
                                    <span class= "icon-bar"></span>
                                    <span class= "icon-bar"></span>
                                    <span class= "icon-bar"></span>
                                </button>
                        <h1 class= "navbar-brand">Nathan Clarke</h1>

            <div class= "collapse navbar-collapse navHeaderCollapse">
                <ul class= "nav navbar-nav navbar-right">
                    <li class= "active"><a href= "#">About Me</a></li>
                    <li><a href= "#">Portfolio</a></li>
                    <li><a href= "#">Contact Me</a></li>
                </ul>
            </div>
            </div>
                    </div>
    </nav>
Jean-Paul Sauve
@jp-sauve
Jun 23 2017 02:11
@AmitP88 where do you call weatherRequest?
Jorge
@flawedLogic506
Jun 23 2017 02:12
i mean, it all depends on your flow .. it's kinda hard for me to know right off the bat without the comments on the code, same happens to me with mine, someone else would have trouble .. what I did was something like this:
var timer = setInterval(function(){
// all the magic for the clock here
},1000);

$('#stopButton').on('click', function(){
clearInterval(timer);
})
Jean-Paul Sauve
@jp-sauve
Jun 23 2017 02:12
@AmitP88 I don't think you did. also remove capital W. I think maybe that's your error.
Jorge
@flawedLogic506
Jun 23 2017 02:12
obviously theres a lot more code, but just so that you get the idea
@clarken1996 u working on codepen?
Jean-Paul Sauve
@jp-sauve
Jun 23 2017 02:13
@AmitP88 I set the variable to null, and it passed on that error, so I knew that the XHR wasn't working
Vincent Yan
@envincebal
Jun 23 2017 02:13
@OrangeKulture right, sorry about that. I'll take care of the comments and come back.
Jorge
@flawedLogic506
Jun 23 2017 02:13
@envincebal naah dont be dude .. i dont comment anything :D my code isall over the plave
place
Flashtzu
@Flashtzu
Jun 23 2017 02:14
is there any way to "work offline" threw the lessons?
Vincent Yan
@envincebal
Jun 23 2017 02:14
@OrangeKulture lol okay, but I still should anyways. I have a habit of not doing that.
Nathan
@clarken1996
Jun 23 2017 02:16
@OrangeKulture no just doing my 100DaysOfCode and wanted to make a better portfolio, my old one actually works okay on codepen but trying not to copy
Amit Patel
@AmitP88
Jun 23 2017 02:17
@jp-sauve thanks for the resource :) When I removed the if statement where it equals Xmlhttprequest.DONE the alert popup comes up, so I'm working on restoring that atm. and yeah, I forgot to call weatherRequest
CamperBot
@camperbot
Jun 23 2017 02:17
amitp88 sends brownie points to @jp-sauve :sparkles: :thumbsup: :sparkles:
:warning: @jp-sauve's account is not linked with freeCodeCamp. Please visit the settings and link your GitHub account.
Amit Patel
@AmitP88
Jun 23 2017 02:17
@jp-sauve working on it atm
Jorge
@flawedLogic506
Jun 23 2017 02:18
@clarken1996 ahh ok sorry .. yeah it's cuz it's easier to look at one sec
Nathan
@clarken1996
Jun 23 2017 02:19
just pasted it into codepen, let me know what you think
Jorge
@flawedLogic506
Jun 23 2017 02:20
yeah i did copy it into codepen myself, looking at it ..
umm not sure at first glance .. it could be an error in the classes, it could be u need bootstrap jquery
Nathan
@clarken1996
Jun 23 2017 02:21
yeah I have them, just didnt want to ask on stack as it has been asked so many times
Jorge
@flawedLogic506
Jun 23 2017 02:21
do u need the collapse and toggle
Jean-Paul Sauve
@jp-sauve
Jun 23 2017 02:23
I don't get why it says my github account isn't linked. :(
Nathan
@clarken1996
Jun 23 2017 02:24
not really but have already commented them out I dont think they are the issue
Jean-Paul Sauve
@jp-sauve
Jun 23 2017 02:24
would someone please thank me to see if I can get points again?
Amit Patel
@AmitP88
Jun 23 2017 02:25
@jp-sauve thank you :)
CamperBot
@camperbot
Jun 23 2017 02:25
:cookie: 298 | @jp-sauve |http://www.freecodecamp.com/jp-sauve
amitp88 sends brownie points to @jp-sauve :sparkles: :thumbsup: :sparkles:
Amit Patel
@AmitP88
Jun 23 2017 02:25
@jp-sauve it said that I sent you points
Jean-Paul Sauve
@jp-sauve
Jun 23 2017 02:25
thanks! It did this time.
Amit Patel
@AmitP88
Jun 23 2017 02:26
@jp-sauve np :)
Jean-Paul Sauve
@jp-sauve
Jun 23 2017 02:26
maybe my authorization had lapsed? unsure
Amit Patel
@AmitP88
Jun 23 2017 02:26
@jp-sauve hmmm, could be a small hickup.
Amit Patel
@AmitP88
Jun 23 2017 02:26
@jp-sauve btw I restored the if statement so that annoying popup shouldn't show https://codepen.io/AmitP88/pen/oWVjqL?editors=0010
Jean-Paul Sauve
@jp-sauve
Jun 23 2017 02:30
@AmitP88 are you using the developer tools?
Jorge
@flawedLogic506
Jun 23 2017 02:30
@clarken1996 definitely is .. because you are telling bootstrap to expect a collapse menu
@clarken1996 in any case, you can do it like so:
<nav class="navbar navbar-default navbar-fixed-top">
  <div class="container-fluid">
    <div class="navbar-header">
      <a class="navbar-brand" href="#">Nathan Clarke</a>
    </div>
    <ul class="nav navbar-nav">
      <li class="active"><a href="#">About Me</a></li>
      <li><a href="#">Portfolio</a></li>
      <li><a href="#">Contact Me</a></li>
    </ul>
  </div>
</nav>
use the navbar-right class if u want it to the right
Jose
@astis1
Jun 23 2017 02:33
Hi guys! Talking about navbars, how does one link a <button> to a specific <div> in the document? I can't seem to figure it out.
Jean-Paul Sauve
@jp-sauve
Jun 23 2017 02:35
@AmitP88 you're trying to read a variable "jsonLocation" which was declared in another function with var, limiting its scope to that function.
Jose
@astis1
Jun 23 2017 02:35
I've tried an href="" inside the button element to link to the class of the div I want;
but, can't get it to go.
Johnny
@jtan3
Jun 23 2017 02:35
@astis1 you need to use anchor tags
@astis1 https://www.w3schools.com/html/html_links.asp lookup " create a bookmark"
Jose
@astis1
Jun 23 2017 02:36
I did use a <a href=".section2"> The only thing I don't like is it make it a link more than a button
so i did <button><a href=""></a></button> .
J-Mag Guthrie
@baseballpoetess
Jun 23 2017 02:36
Use an id @astis1
Nathan
@clarken1996
Jun 23 2017 02:36
J-Mag Guthrie
@baseballpoetess
Jun 23 2017 02:37
<a href="#aboutMe">About</a> and then have <div id="aboutMe">
Jose
@astis1
Jun 23 2017 02:37
I'll try adding the class to the div.
:)
Nathan
@clarken1996
Jun 23 2017 02:37
@baseballpoetess was that towards me?
J-Mag Guthrie
@baseballpoetess
Jun 23 2017 02:38
no, an ID, not a class.
Nathan
@clarken1996
Jun 23 2017 02:38
nvm
J-Mag Guthrie
@baseballpoetess
Jun 23 2017 02:38
no, @astis1
Pagnito
@Pagnito
Jun 23 2017 02:41
hey im looking for a method like splice but for a string, i need to literally cut out a section of the string, i tried subtr and substring but those dont change the content of the original string
J-Mag Guthrie
@baseballpoetess
Jun 23 2017 02:42
strings I don't thing are mutable
I think that's also javascript maybe
Jean-Paul Sauve
@jp-sauve
Jun 23 2017 02:42
yeah. strings are immutable
J-Mag Guthrie
@baseballpoetess
Jun 23 2017 02:42
you have to assign it to a new var
Johnny
@jtan3
Jun 23 2017 02:43
@Pagnito str.replace() maybe?
J-Mag Guthrie
@baseballpoetess
Jun 23 2017 02:43
Can you do vars in CSS? I want to not have to use color codes in a zillion places and say, mainColor, etc.
Pagnito
@Pagnito
Jun 23 2017 02:43
@jtan3 yea but i think i might have to go with replace and slice together since i need to be using variable for an algorithm
Jean-Paul Sauve
@jp-sauve
Jun 23 2017 02:43
@baseballpoetess SASS
J-Mag Guthrie
@baseballpoetess
Jun 23 2017 02:44
that sounds like a "no".
Pagnito
@Pagnito
Jun 23 2017 02:44
@jtan3 im just trying to use as least amount of processing as possible, im surprised that slice() subtr() and subtr() all seem to do a the same thing and none of em do what splice does for arrays
glitz20
@glitz20
Jun 23 2017 02:44
I have been having problem in creating footer. Can anyone help me, the footer has id "contacts" https://codepen.io/sabin20/pen/QgMLJv
Jean-Paul Sauve
@jp-sauve
Jun 23 2017 02:45
@Pagnito arrays are mutable
Nathan
@clarken1996
Jun 23 2017 02:45
@OrangeKulture yeah but has to look nice when viewed on tablet/phone or it will drive me crazy :worried:
@OrangeKulture thanks for your help
Pagnito
@Pagnito
Jun 23 2017 02:45
@jp-sauve is that why they couldnt make a method like splice for strings?
Jean-Paul Sauve
@jp-sauve
Jun 23 2017 02:46
@Pagnito yes. once a string is set, you can't change it. You can only copy parts in to a new string.
Pagnito
@Pagnito
Jun 23 2017 02:47
hmm, @jp-sauve k thanks
CamperBot
@camperbot
Jun 23 2017 02:47
pagnito sends brownie points to @jp-sauve :sparkles: :thumbsup: :sparkles:
:cookie: 299 | @jp-sauve |http://www.freecodecamp.com/jp-sauve
Jean-Paul Sauve
@jp-sauve
Jun 23 2017 02:47
you can split a string at the spaces, and copy it in to an array, if you need an array.
arrayOwords = myString(' ');
oops. I meant
arrayOwords = myString.split(' ');
that way you can remove words, reorder, and later use .join(' ') to put it back in to a string.
Jorge
@flawedLogic506
Jun 23 2017 02:53
@clarken1996 welcome! it is responsive for me, btw
u just need to center the text
aichellie
@aichellie
Jun 23 2017 02:59
Can anyone point me to resources about jQuery and JSON, so I can practice and learn more?
Jean-Paul Sauve
@jp-sauve
Jun 23 2017 03:00
@aichellie the official documentation.
aichellie
@aichellie
Jun 23 2017 03:00
and AJAX, I guess. I'm on the intermediate front end dev part but not sure how to proceed
Jean-Paul Sauve
@jp-sauve
Jun 23 2017 03:01
@aichellie api.jquery.com https://developer.mozilla.org/en-US/
head first ajax is a pretty good book for ajax. I've been using that.
Christoph Szczechowicz
@christophszcz
Jun 23 2017 03:02
This channel might be helpful for JSON, AJAX and APIs: https://www.youtube.com/watch?v=rJaXOFfwGVw&list=PLRqwX-V7Uu6a-SQiI4RtIwuOrLJGnel0r
Jean-Paul Sauve
@jp-sauve
Jun 23 2017 03:02
@aichellie you could also transition from codepen to github pages, if you haven't already.
get yourself a proper development setup.
aichellie
@aichellie
Jun 23 2017 03:02
thanks for the suggestions
I'm not quite ready to dive into github yet, not super serious about this whole coding thing yet :)
Jean-Paul Sauve
@jp-sauve
Jun 23 2017 03:05
if you want to get better at Javascript, there's a free book series that would scare you if you're not serious yet. It's called "You don't know JS". Google it and bookmark it for later. You could also work on these challenges using JS. https://projecteuler.net/ That would help you get familiar.
Christoph Szczechowicz
@christophszcz
Jun 23 2017 03:05
FCC gives you a great introduction into the coding world so I think that you will know if it's for you if you study the course materials for a month or two
Jean-Paul Sauve
@jp-sauve
Jun 23 2017 03:06
github isn't terribly hard. it makes it a lot easier to work on something on your own machine and then push it online with a few simple commands.
aichellie
@aichellie
Jun 23 2017 03:06
@jp-sauve how do you use books in conjunction with coding? command line?
I've tried things before freecodecamp and they didn't stick as well because I can't see the results right away
CallMeOrange
@EgnaroDev
Jun 23 2017 03:07
@jp-sauve does that book really help?
Jean-Paul Sauve
@jp-sauve
Jun 23 2017 03:07
and working in something like Brackets (what I use) or Sublime is far better than codepen. yeah, I start projects locally and follow the examples in the book.
CallMeOrange
@EgnaroDev
Jun 23 2017 03:07
I have one, I guess I will read it a while
Jean-Paul Sauve
@jp-sauve
Jun 23 2017 03:07
it does if you want to be able to do ajax manually. libraries like jQuery do all the heavy lifting though, until they don't.
@MCTwoDigitZero you've got head first ajax?
CallMeOrange
@EgnaroDev
Jun 23 2017 03:08
I have "UP & GOING"
First one :/
I havent read it yet so..
Jean-Paul Sauve
@jp-sauve
Jun 23 2017 03:09
oh, probably something similar. it might be a bit much if you don't already program some js.
Ashish sb
@ashishsb95
Jun 23 2017 03:10
Guys just started learning transitions in css https://codepen.io/ashishsb/pen/rwwNLb can anyone go through and point out if any redundant statements are there?
BeauBo
@BeauBo
Jun 23 2017 03:11
hi folks. I added pull-right class to a navigation bar. But after pull-right, the order is totally opposite. Anyone has any idea to fix it?
Jean-Paul Sauve
@jp-sauve
Jun 23 2017 03:12
getting a real code editor is worth it though!
CallMeOrange
@EgnaroDev
Jun 23 2017 03:13
@jp-sauve I know basic JS and did some of basic algs challenge and will "UP & GOING" be able to help?
Jean-Paul Sauve
@jp-sauve
Jun 23 2017 03:14
up until a point!
CallMeOrange
@EgnaroDev
Jun 23 2017 03:15
hm...
Anyway if I finish first one, Should I get one in order or randomly pick one?
I will need second one after this
just want to learn more about scopes/global functions
I guess there is no need for me to ask... Will have to read first
Amit Patel
@AmitP88
Jun 23 2017 03:25
@jp-sauve yeah, I always have dev console open.
Danny
@WaterYourRoots
Jun 23 2017 03:28
Hey guys, working on the portfolio page beginner project, don't mind the content (i cant do all that stuff, it would be for a future portfolio), i'm struggling being able to make all my icons fit on a horizonatl row when I switch from desktop to laptop, I don't have a full understanding of boot strap or media queries and my code is a bit of a frankenstein mashupo of flexbox and bootstrap, any help would be appreciated!
and general responsiveness as a whole, I know this page is far from it
Ahmed Abd El Hameed
@ajvhallen
Jun 23 2017 03:37
hello , can some one tell me why the text css are not working please ? and how can I center the photo in the div ?
@WaterYourRoots did u make that page only using the experience u gained in the past courses ? or u had previous experience ?
Hayk Simonyan
@hayksim
Jun 23 2017 03:39
Ahmed you can add "text-center" class to center text.
Christoph Szczechowicz
@christophszcz
Jun 23 2017 03:39
set text-align:center on that div
Ahmed Abd El Hameed
@ajvhallen
Jun 23 2017 03:40
they aint working , like check the margin I am giving , and it's not applied for some reason
text properties aint working for some reason
Christoph Szczechowicz
@christophszcz
Jun 23 2017 03:42
Remove col-md-8 and col-md-4 classes
Danny
@WaterYourRoots
Jun 23 2017 03:42
@ajvhallen i did it with a mix of what I learned on here and codeacademy and then a ton of different research on the internet to learn some of those tricks. I kind of researched different portfolio pages, designed my own layout on a piece of paper and then pieced together how I wanted it to look aestetically, now I'm just filling in the different code I need to make it do and look how I want and kind of learnoing as I do it
@christophszcz were you talking to me??
nvm
Christoph Szczechowicz
@christophszcz
Jun 23 2017 03:43
Sorry I was talking to @ajvhallen
Danny
@WaterYourRoots
Jun 23 2017 03:44
@christophszcz i figured no worries
Ahmed Abd El Hameed
@ajvhallen
Jun 23 2017 03:47
@christophszcz but then how can I get the pic and text lined up together in the same div ? ._. excuse me Iam only one day old to all of this :/ and google aint helping that much
Christoph Szczechowicz
@christophszcz
Jun 23 2017 03:48
@WaterYourRoots I can help you out if you
@WaterYourRoots and @ajvhallen hold on a minute
Vincent Yan
@envincebal
Jun 23 2017 03:50
Hey guys, I think I coded my way into a corner in the pomodoro clock. Where can I call the clearTimeout method to stop the timer when I click the circle? Any help would be appreciated.
Danny
@WaterYourRoots
Jun 23 2017 03:51
@christophszcz for sure, no rush, much appreciated
@christophszcz also, I'm about to go to bed, If you dont get to it tonight no worries, but illl check up in the am
Christoph Szczechowicz
@christophszcz
Jun 23 2017 03:59
@ajvhallen Then set .text{ text-align: center} and .image{ text-align: center} in your css and you will have your text above your image all centered
Ahmed Abd El Hameed
@ajvhallen
Jun 23 2017 04:02
so I can use text align on images too ? to center them?
Christoph Szczechowicz
@christophszcz
Jun 23 2017 04:03
You use text align on the div but to center the image you use them in conjunction
@WaterYourRoots are you still there?
Ahmed Abd El Hameed
@ajvhallen
Jun 23 2017 04:04
@christophszcz alright thanks a lot
CamperBot
@camperbot
Jun 23 2017 04:04
ajvhallen sends brownie points to @christophszcz :sparkles: :thumbsup: :sparkles:
:cookie: 401 | @christophszcz |http://www.freecodecamp.com/christophszcz
Christoph Szczechowicz
@christophszcz
Jun 23 2017 04:04
No problem
@WaterYourRoots your icons look fine to me. If you want, you can email me at (cjszczechowicz@gmail.com) and I can try to help you out with any media query and/or flex box questions .
Ken Haduch
@khaduch
Jun 23 2017 04:09
@envincebal - it looks like you are using setTimeout for all of your timer functions, is that correct? It is hard to analyze the code in detail and give a quick answer, but basically it seems that you should be able to have a state value in your code that indicates that you have a timer running, and when you click the circle, take the appropriate action to set up the state which you should use to control the next invocation of setTimeout. If the state is set, call it something like continueRunning, then allow the next setTimeout, otherwise do not allow the next setTimeout.
Vincent Yan
@envincebal
Jun 23 2017 04:11
@khaduch Yes you are correct, I think I over-complicated it by setting the entire inner function to setTimeout. When you say "state" do you mean like setting up a boolean?
Matt Andrade
@andrade1379
Jun 23 2017 04:12
Hey guys… I was wondering… if I wanted 3 divs displayed inline to each other and on page load I’d like the backgrrounds to change from left to right and back from right to left with CSS. How can this be done?
Keyframes?
Ken Haduch
@khaduch
Jun 23 2017 04:14
@envincebal - yes, exactly what I mean. When you have it set to a value that means continue counting, then you can start the next timeout. If you set it to the value that will mean "stop counting", when you prevent the start of the next setTimeout. Note that to use clearTimeout, you have to save the ID value that is returned from setTimeout. But I was thinking that since your timeouts are always 1 second, that just preventing the next setTimeout would probably be adequate. It would just require adding additional logic to a few places, from the looks of things? I hope that you can sort it out with this idea. And I'm sure that someone would be able to help you along, since I'm going offline in a few minutes.
Vincent Yan
@envincebal
Jun 23 2017 04:16
@khaduch oh okay, that makes more sense. Thank you so much!
CamperBot
@camperbot
Jun 23 2017 04:16
envincebal sends brownie points to @khaduch :sparkles: :thumbsup: :sparkles:
:star2: 3031 | @khaduch |http://www.freecodecamp.com/khaduch
Ken Haduch
@khaduch
Jun 23 2017 04:17
@envincebal - great, you're welcome, and good luck!
Baibhav Gautam
@baibhavx
Jun 23 2017 04:30
Guys I am gonna start the calculator project. I am comfortable with the logic but in terms the user interface, is it advisable to build the calculator UI from stratch using HTML and CSS?
Mukul Agrawal
@mukul09
Jun 23 2017 04:51
can anybody tell me what is wrong in this code
 var api="https://api.darksky.net/forecast/08edb063fb44851af13bdcea3c608e86/"+latlon;
    $.getJSON(api,function(data){
    var currentTemp = data.currently.temperature;
      $("#temp").text(currentTemp);

    });
shivam gupta
@shivamg11000
Jun 23 2017 04:53
@mukul09 add
?callback=?
at the end of your uel
url*
Mukul Agrawal
@mukul09
Jun 23 2017 04:54
@shivamg11000 ya that work but how
shivam gupta
@shivamg11000
Jun 23 2017 04:55
@mukul09 bcs due to cross 'origin policy' you cannot fetch data using json, by adding callback the data fectched in jsonp which bypasses the same origin policy
Mukul Agrawal
@mukul09
Jun 23 2017 04:55
@shivamg11000 what if i use .ajax() method
shivam gupta
@shivamg11000
Jun 23 2017 04:56
@mukul09 I don't know ajax
Mukul Agrawal
@mukul09
Jun 23 2017 04:57
@shivamg11000 ok thanks
CamperBot
@camperbot
Jun 23 2017 04:57
mukul09 sends brownie points to @shivamg11000 :sparkles: :thumbsup: :sparkles:
:cookie: 307 | @shivamg11000 |http://www.freecodecamp.com/shivamg11000
Jorge
@flawedLogic506
Jun 23 2017 05:11
@baibhavx yeah .. basically u need to also do the UI
newdeveloper15
@newdeveloper15
Jun 23 2017 06:23
hello everyone !
I need help in building a tribute page !
how should i add image in CodePen ?
Johnny
@jtan3
Jun 23 2017 06:25
@newdeveloper15 https://postimage.io/ you can use this to upload your image
CallMeOrange
@EgnaroDev
Jun 23 2017 06:25
@jtan3 I think he meant how to add image in html
@newdeveloper15 Do you know how to add an image to html?
Johnny
@jtan3
Jun 23 2017 06:28
@newdeveloper15 <img src="url">
CallMeOrange
@EgnaroDev
Jun 23 2017 06:29
Probably exploring postimage...
newdeveloper15
@newdeveloper15
Jun 23 2017 06:30
@jtan3 i know the img tag, in src we have to give image name or url but I can't give my local drive path in url
what should i do ?
CallMeOrange
@EgnaroDev
Jun 23 2017 06:30
@newdeveloper15 You want your own image to upload?
Shubham Sharma
@shubhamsrkdev
Jun 23 2017 06:30
Guys I made my second project (portfolio) It looks fine in desktop but while viewing in my phone every element just occupy random places(even text) and the page looks very ugly and unreadable,What should I do?
CallMeOrange
@EgnaroDev
Jun 23 2017 06:30
Use postimage.com to upload an image from your file
newdeveloper15
@newdeveloper15
Jun 23 2017 06:32
@MCTwoDigitZero thank you ! done :)
CamperBot
@camperbot
Jun 23 2017 06:32
newdeveloper15 sends brownie points to @mctwodigitzero :sparkles: :thumbsup: :sparkles:
:cookie: 295 | @mctwodigitzero |http://www.freecodecamp.com/mctwodigitzero
CallMeOrange
@EgnaroDev
Jun 23 2017 06:32
Well that what he told you in first place but no problem
@jtan3 can you help me with JS challenge?
Counting Cards
Jorge
@flawedLogic506
Jun 23 2017 06:32
@shubhamsrkdev u need bootstrap dude
Johnny
@jtan3
Jun 23 2017 06:33
@MCTwoDigitZero what do you have?
CallMeOrange
@EgnaroDev
Jun 23 2017 06:33
@shubhamsrkdev try container-fluid classes
@jtan3 hold on not done with last statement

var count = 0;

function cc(card) {
  if (card >= 2 && card <=6) {
  return " Bet"; / +
  } else if (card >= 7 && card <= 9) {
  return " Hold"; / current
  }  else if (card >= 10, 'J', 'Q', 'K', 'A') {
  return " Hold"; / -
  }
}

// Add/remove calls to test your function.
// Note: Only the last will display
cc(2); cc(3); cc(7); cc('K'); cc('A');
I had switch statements but changed it to if/ else if statements
Should I change it back?
Johnny
@jtan3
Jun 23 2017 06:35
@MCTwoDigitZero you can do either way i think
CallMeOrange
@EgnaroDev
Jun 23 2017 06:35
So only if/else if statements alone is fine?
I saw some guys did both
But its complicated for me
I dont know if last else if statement is correct
If you have 10 or other symbols, you Hold?
Jorge
@flawedLogic506
Jun 23 2017 06:36
last else if is not working
CallMeOrange
@EgnaroDev
Jun 23 2017 06:38
how?
Well I think you are a expert in blackjack so... what would you do if you had 10 or other symbols (10)
I think Hold?
@OrangeKulture last else if is working
Just change the text then test it
Jorge
@flawedLogic506
Jun 23 2017 06:40
it only tests for 10
CallMeOrange
@EgnaroDev
Jun 23 2017 06:40
yeah
That what I expected?
Jorge
@flawedLogic506
Jun 23 2017 06:41
its the same as if you would say else if (card >= 10) { some code}
CallMeOrange
@EgnaroDev
Jun 23 2017 06:41
You mean this? cc(2); cc(3); cc(7); cc('K'); cc('A');
Jorge
@flawedLogic506
Jun 23 2017 06:41
no need to include the letters
CallMeOrange
@EgnaroDev
Jun 23 2017 06:41
I think I need to include the letters..
cc(2); cc(3); cc(7); cc('K'); cc('A'); only test it at last
Jorge
@flawedLogic506
Jun 23 2017 06:42
yeah you do ...
im saying that the last else if only test for 10
CallMeOrange
@EgnaroDev
Jun 23 2017 06:42
oh
but 10 is same as other letters
Jorge
@flawedLogic506
Jun 23 2017 06:42
how can you tell a computer that card is less than a string literal
i think you are looking at the problem wrong ... you have to use the count to make the decisions, not the cards
CallMeOrange
@EgnaroDev
Jun 23 2017 06:43
Yeah... I had to make sure if all statements are correct
then use count
@OrangeKulture I can change else if for 10 and other letters to switch statement
Marius Nicolae
@bytao7mao
Jun 23 2017 06:44
morning guys :coffee:
Jorge
@flawedLogic506
Jun 23 2017 06:44
well, your if else/if statement is returning some logic based on the cards
not the count
morning? dammit .. what time is it
CallMeOrange
@EgnaroDev
Jun 23 2017 06:44
if I changed all return to count = then return count at end
Jorge
@flawedLogic506
Jun 23 2017 06:44
:D
CallMeOrange
@EgnaroDev
Jun 23 2017 06:44
work same way
@bytao7mao morning
@OrangeKulture did you do Counting Cards?
Jorge
@flawedLogic506
Jun 23 2017 06:45
yeah
CallMeOrange
@EgnaroDev
Jun 23 2017 06:45
oh
Then you will be able to help me?
:/
Jorge
@flawedLogic506
Jun 23 2017 06:46
im trying
Johnny
@jtan3
Jun 23 2017 06:46
@MCTwoDigitZero return " Hold"; / - don't think the /- will work you'll get an error
CallMeOrange
@EgnaroDev
Jun 23 2017 06:46

var count = 0;

function cc(card) {
  if (card >= 2 && card <=6) {
  count =  " Bet";
  } else if (card >= 7 && card <= 9) {
  count = " Hold";
  }  else if (card >= 10, 'J', 'Q', 'K', 'A') {
  count =  " Hold";
  }
  return count;
}

// Add/remove calls to test your function.
// Note: Only the last will display
cc(2); cc(3); cc(7); cc('K'); cc('A');
@jtan3 thats just a comment?
Marius Nicolae
@bytao7mao
Jun 23 2017 06:47
i have a question : if i have this var x = [a,b,defg,h,i,j];
and i will input x.length
will count each data from the array but why does not count each letter ?
Jorge
@flawedLogic506
Jun 23 2017 06:47
nope .. you are still trying to evaluate a string
CallMeOrange
@EgnaroDev
Jun 23 2017 06:47
@jtan3 oh you are right... I need two // to get comment
well I already deleted t
@OrangeKulture You mean Bet and Hold strings?
Jorge
@flawedLogic506
Jun 23 2017 06:48
think about it this way .. the problem says , if the count is positive, return bet ... if its negative or 0 , return hold
its a matter of manipulating the count variable depending on the argument passed in
CallMeOrange
@EgnaroDev
Jun 23 2017 06:49
add this?
else if (card <= 0) {
return " Hold"
}
Marie Salad
@marieensalada
Jun 23 2017 06:49
Working on tribute page on code pen and cant get link to open a new page. used target="_blank" but still wont open a new page. help!
Jorge
@flawedLogic506
Jun 23 2017 06:49
@bytao7mao because each item is separated by a comma .. also that array would have to be c = ["a","b","defg","h"]
u need quotes for string literals ...
Marius Nicolae
@bytao7mao
Jun 23 2017 06:50
yeah i figgured it that i typed it wrong :D
Jorge
@flawedLogic506
Jun 23 2017 06:50
@MCTwoDigitZero how do you make the count variable positive or negative?
Marius Nicolae
@bytao7mao
Jun 23 2017 06:50
@OrangeKulture it will count each letter only if i type "defg".length ?
CallMeOrange
@EgnaroDev
Jun 23 2017 06:50
- and +?
Jorge
@flawedLogic506
Jun 23 2017 06:50
@bytao7mao no .. "defgeojeoprijpeor" and "a" are the same inside an array
.length on an array will give the amount of items it contains
Marius Nicolae
@bytao7mao
Jun 23 2017 06:51
well, in which case it will count only letters?
Jorge
@flawedLogic506
Jun 23 2017 06:51
[1,2,3] // 3 items
[212516165161,1,0] // 3 items
CallMeOrange
@EgnaroDev
Jun 23 2017 06:51
Hold on... I dont understand what is string literals, I thought it just means the text around quote?
Shubham Sharma
@shubhamsrkdev
Jun 23 2017 06:51
@marieensalada have u used <a href="https://" target="_blank">Click here </a> ?
Jorge
@flawedLogic506
Jun 23 2017 06:51
yeah.. a string literal is a string that's already been defined
CallMeOrange
@EgnaroDev
Jun 23 2017 06:52
@shubhamsrkdev look at href attribute
@OrangeKulture so all of my strings is fine?
Jorge
@flawedLogic506
Jun 23 2017 06:52
var a = "this is a string literal" it just means a variable that has been instantiated as a string
CallMeOrange
@EgnaroDev
Jun 23 2017 06:52
oh
Jorge
@flawedLogic506
Jun 23 2017 06:52
@MCTwoDigitZero nope
Marie Salad
@marieensalada
Jun 23 2017 06:52
@marieensalada have u used <a href="https://" target="_blank">Click here </a> ? Yeah thats exactly what i did. Didnt work.
CallMeOrange
@EgnaroDev
Jun 23 2017 06:52
right... forgot to post my code that I challenge
Jorge
@flawedLogic506
Jun 23 2017 06:52
how do you make the count variable positive or negative?
CallMeOrange
@EgnaroDev
Jun 23 2017 06:53
count -= or +=?
Jorge
@flawedLogic506
Jun 23 2017 06:53
exactly
CallMeOrange
@EgnaroDev
Jun 23 2017 06:53
okay
I already added count = so I will just add -/+
Jorge
@flawedLogic506
Jun 23 2017 06:53
so.. what you need to do is .. if card A = 2,3,4 ..etc , then count -= 1
CallMeOrange
@EgnaroDev
Jun 23 2017 06:53
I thought +?
Jorge
@flawedLogic506
Jun 23 2017 06:53
next .. if card is = x,y,z ...
Johnny
@jtan3
Jun 23 2017 06:53
@marieensalada can you share your codepen?
Jorge
@flawedLogic506
Jun 23 2017 06:53
well yeah im just saying .. u know what i mean
CallMeOrange
@EgnaroDev
Jun 23 2017 06:54
I see

var count = 0;

function cc(card) {
  if (card >= 2 && card <=6) {
  count +=  " Bet";
  } else if (card >= 7 && card <= 9) {
  count = " Hold";
  }  else if (card >= 10, 'J', 'Q', 'K', 'A') {
  count -=  " Hold";
  }
  return count;
}

// Add/remove calls to test your function.
// Note: Only the last will display
cc(2); cc(3); cc(7); cc('K'); cc('A');
Shubham Sharma
@shubhamsrkdev
Jun 23 2017 06:54
@marieensalada Check if the link is correct or you haven't missed any angle brackets because that is absolutely correct
Marie Salad
@marieensalada
Jun 23 2017 06:55
@jtan3 uhhh how?
Jorge
@flawedLogic506
Jun 23 2017 06:55
look at your code .. you are initializing the value of count to an integer
Marius Nicolae
@bytao7mao
Jun 23 2017 06:55
@OrangeKulture in which case counts me the letters only ?
"cake".length
Jorge
@flawedLogic506
Jun 23 2017 06:55
how would you minus or plus a string?
@bytao7mao ohh sry dude ...
CallMeOrange
@EgnaroDev
Jun 23 2017 06:55
...
Johnny
@jtan3
Jun 23 2017 06:55
@marieensalada paste your codepen url
Marie Salad
@marieensalada
Jun 23 2017 06:55
@shubhamsrkdev i will check again!
Jorge
@flawedLogic506
Jun 23 2017 06:55
yeah .. u can use the .length method on a string
@bytao7mao not like that tho .. remember to use variables
var text = "cake";
console.log(text.length)  // 4
CallMeOrange
@EgnaroDev
Jun 23 2017 06:56
@OrangeKulture count -/+ string?
Marius Nicolae
@bytao7mao
Jun 23 2017 06:56
ohh , i see @OrangeKulture thx man
CamperBot
@camperbot
Jun 23 2017 06:56
bytao7mao sends brownie points to @orangekulture :sparkles: :thumbsup: :sparkles:
:cookie: 423 | @orangekulture |http://www.freecodecamp.com/orangekulture
Jorge
@flawedLogic506
Jun 23 2017 06:57
that is not possible at all .. what if I said, hey dude, I got 5 apples, well, someone added a love song, so now i got ?? 5 apples?
@bytao7mao sure thing!
CallMeOrange
@EgnaroDev
Jun 23 2017 06:57
Sorry... I guessed :/
function cc(card) {
  if (card >= 2 && card <=6) {
  count +=  " Bet";
  } else if (card >= 7 && card <= 9) {
  count = " Hold";
  }  else if (card >= 10, 'J', 'Q', 'K', 'A') {
  count -=  " Hold";
  }
  return count;
}
Whats wrong with it again?
Jorge
@flawedLogic506
Jun 23 2017 06:57
lol no problem .. i mean i can give you the answer, just like Sky does .. but i find it's best to get you in the right state of mind to tackle problems
CallMeOrange
@EgnaroDev
Jun 23 2017 06:58
Yeah I would prefer solving it not an answer
Marius Nicolae
@bytao7mao
Jun 23 2017 06:58
@MCTwoDigitZero shame shame shame
=))
Jorge
@flawedLogic506
Jun 23 2017 06:58
why are you trying to perform math operations on strings
CallMeOrange
@EgnaroDev
Jun 23 2017 06:58
@OrangeKulture Sky gave you some answer?
good question..
Jorge
@flawedLogic506
Jun 23 2017 06:59
no i mean he usually helps a lot of ppl at the same time, so he has to just throw out the logic instead of me trying to get it out from you :D
CallMeOrange
@EgnaroDev
Jun 23 2017 07:00
Do I need to understand how blackjack works? :/
Shubham Sharma
@shubhamsrkdev
Jun 23 2017 07:00
@marieensalada Hey you used : instead of "=" after href
Jorge
@flawedLogic506
Jun 23 2017 07:00
not at all .. no
CallMeOrange
@EgnaroDev
Jun 23 2017 07:00
ok lol
Johnny
@jtan3
Jun 23 2017 07:00
@marieensalada href=
CallMeOrange
@EgnaroDev
Jun 23 2017 07:00
I know blackjack only like picking one of two card up to 21...
Jorge
@flawedLogic506
Jun 23 2017 07:00
ok think of it like this .. say we are in a blackjhack game, and u know that to count cards, u substract 1 if its lower than 10, right ... lets just assume its only that one thing
so u come over and I say .. dude, the count is +16
and u see the next card is a 5 .... then count would be ?
CallMeOrange
@EgnaroDev
Jun 23 2017 07:01
I never heard of substracting cards... that is why Im confused
Jorge
@flawedLogic506
Jun 23 2017 07:01
the challenge has a table for you to see that
CallMeOrange
@EgnaroDev
Jun 23 2017 07:01
oh yeah
Jorge
@flawedLogic506
Jun 23 2017 07:02
or add .. its all the same, substract is its 10+
CallMeOrange
@EgnaroDev
Jun 23 2017 07:02
Like add one if its 2 to 6?
Jorge
@flawedLogic506
Jun 23 2017 07:02
exactly
Marie Salad
@marieensalada
Jun 23 2017 07:02
@shubhamsrkdev @jtan3 THANKSS!!
CamperBot
@camperbot
Jun 23 2017 07:02
marieensalada sends brownie points to @shubhamsrkdev and @jtan3 :sparkles: :thumbsup: :sparkles:
:cookie: 121 | @shubhamsrkdev |http://www.freecodecamp.com/shubhamsrkdev
:cookie: 422 | @jtan3 |http://www.freecodecamp.com/jtan3
Johnny
@jtan3
Jun 23 2017 07:02
@marieensalada if you click the "down arrow" in the html section there's a "analyze html" . You can see all the errors you have in your html if you have any.
Marius Nicolae
@bytao7mao
Jun 23 2017 07:02
@MCTwoDigitZero what is that card game, FCC chall ?
CallMeOrange
@EgnaroDev
Jun 23 2017 07:03
@OrangeKulture 2 to 6 = +
@bytao7mao Counting Cards in JS section
Jorge
@flawedLogic506
Jun 23 2017 07:03
so ... in this case, count is 0 .. your logic is , if the card is between 2 and 6 .. what should you do ?
CallMeOrange
@EgnaroDev
Jun 23 2017 07:03
add one?
Marius Nicolae
@bytao7mao
Jun 23 2017 07:03
i see
Jorge
@flawedLogic506
Jun 23 2017 07:03
exactly
to what? to count .. right
so its count += 1
CallMeOrange
@EgnaroDev
Jun 23 2017 07:03
but that what I did?
Jorge
@flawedLogic506
Jun 23 2017 07:03
not at all , no .. look at your code again
CallMeOrange
@EgnaroDev
Jun 23 2017 07:04
oh... 1...
just count += 1?
Jorge
@flawedLogic506
Jun 23 2017 07:04
exactly .. that's what the table says and the challenge explains
Marie Salad
@marieensalada
Jun 23 2017 07:04
@jtan3 aw shit. hey, thanks!
CamperBot
@camperbot
Jun 23 2017 07:04
marieensalada sends brownie points to @jtan3 :sparkles: :thumbsup: :sparkles:
:warning: marieensalada already gave jtan3 points
CallMeOrange
@EgnaroDev
Jun 23 2017 07:04
function cc(card) {
  if (card >= 2 && card <=6) {
  count += 1 + " Bet";
  }
Jorge
@flawedLogic506
Jun 23 2017 07:05
almost .. yeah. I would concat Bet, because you dont know the count obviously you do, because its 1 card, but if it was more, then you would have like count = 1Bet2Bet3Hold or something weird
so just have another if else for the count variable
if count > 0
CallMeOrange
@EgnaroDev
Jun 23 2017 07:06
then return Hold?
Never mind
let me write else if first
Jorge
@flawedLogic506
Jun 23 2017 07:07
this is what it says:
The function will then return a string with the current count and the string "Bet" if the count is positive, or "Hold" if the count is zero or negative. The current count and the player's decision ("Bet" or "Hold") should be separated by a single space.
CallMeOrange
@EgnaroDev
Jun 23 2017 07:07
else if (count < 0) {
    count -= -1;
Wrong sign...
and I should add = too
never mind
Jorge
@flawedLogic506
Jun 23 2017 07:08
no worries .. u almost got it i can feel the tests passing already :D
CallMeOrange
@EgnaroDev
Jun 23 2017 07:09
So that else if statement is correct?
Shouldn't I add = too?
Less than 0 or equal to 0?
Jorge
@flawedLogic506
Jun 23 2017 07:10
yes but u are evaluating count and then changing it .. thats not good
CallMeOrange
@EgnaroDev
Jun 23 2017 07:10
Want to see my code again? :/
Jorge
@flawedLogic506
Jun 23 2017 07:10
u need two else/if ... first one to determine what the count is based on the card passed in .. and then u need to make a decision of either bet or hold based on count .. not the card
sure
CallMeOrange
@EgnaroDev
Jun 23 2017 07:10
111
var count = 0;

function cc(card) {
  if (card >= 2 && card <=6) {
  count += 1 + " Bet";
  }
  else if (count < 0) {
    count -= -1;
  } else if (card >= 7 && card <= 9) {
  count = " Hold";
  }  else if (card >= 10, 'J', 'Q', 'K', 'A') {
  count -= 1 + " Hold";
  }
  return count;
}
Jorge
@flawedLogic506
Jun 23 2017 07:11
u are still trying to assign a string to count
CallMeOrange
@EgnaroDev
Jun 23 2017 07:11
..
So thats incorrect?
I dunno what to supposed to do..
Jorge
@flawedLogic506
Jun 23 2017 07:12
its alright .. we all have these stuck moments and it's frustrating .. trust me, i know
try this ...
CallMeOrange
@EgnaroDev
Jun 23 2017 07:12
Yeah.. this is only challenge I got stuck on
Johnny
@jtan3
Jun 23 2017 07:12
@MCTwoDigitZero what count do you get for 7-9?
CallMeOrange
@EgnaroDev
Jun 23 2017 07:13
@jtan3 just leave it
well according to table, count changes is 0
Johnny
@jtan3
Jun 23 2017 07:13
@MCTwoDigitZero why is it "hold" then?
CallMeOrange
@EgnaroDev
Jun 23 2017 07:13
I was not sure...
... I will change it to Bet then :/
Jorge
@flawedLogic506
Jun 23 2017 07:14
function cc(card){
// if the card is between 2 and 6, subtract from count.

//if card is between 7 and 9 it remains 0

// if card is 10 or greater, add to count

}
that is only for the count variable ...
then ...
CallMeOrange
@EgnaroDev
Jun 23 2017 07:14
alright will try that
function cc(card){
// if the card is between 2 and 6, subtract from count.
Bet
//if card is between 7 and 9 it remains 0
Bet
// if card is 10 or greater, add to count
Hold
}
Right?
Jorge
@flawedLogic506
Jun 23 2017 07:15
we are not done with count yet .. why are you jumping steps
hold or bet is the second part
we are manipulating the count variable
so .. if count = 3 and the card is 5, what happens?
CallMeOrange
@EgnaroDev
Jun 23 2017 07:16
hold on.. count and card?
I should understand blackjack :/
Jorge
@flawedLogic506
Jun 23 2017 07:17
u dont need to dude .. ive told you, if the card is between 2 or 6 , u subtract 1
CallMeOrange
@EgnaroDev
Jun 23 2017 07:17
yeah
Jorge
@flawedLogic506
Jun 23 2017 07:17
so .. if count = 3 and a card is 5 .. u subtract 1
CallMeOrange
@EgnaroDev
Jun 23 2017 07:17
But what about the table?
Jorge
@flawedLogic506
Jun 23 2017 07:17
so .. if count = 2 and u subtract 1 , what is count?
CallMeOrange
@EgnaroDev
Jun 23 2017 07:17
@OrangeKulture I dont understand the different count and card..
@OrangeKulture 1?
Jorge
@flawedLogic506
Jun 23 2017 07:18
exactly
and if count is greater than 0 , then what should u do? bet or hold?
count is the total ... thats all, its like the score
CallMeOrange
@EgnaroDev
Jun 23 2017 07:19
ok this is what I wrote..
function cc(card) {
  if (card >= 2 && card <=6) {
  count -= 1 + " Bet";
  }
  else if (card >= 7 && card <= 9) {
  count = " Bet";
  }
  else if (card >= 10, 'J', 'Q', 'K', 'A') {
  count += 1 + " Hold";
  }
  return count;
}
@OrangeKulture hold I think
Jorge
@flawedLogic506
Jun 23 2017 07:20
ok yeah ...
CallMeOrange
@EgnaroDev
Jun 23 2017 07:20
so..
Jorge
@flawedLogic506
Jun 23 2017 07:20
then, u need to return a string , which include the count + space + decision(either bet or hold)
CallMeOrange
@EgnaroDev
Jun 23 2017 07:21
oo space
Jorge
@flawedLogic506
Jun 23 2017 07:21
it doesnt matter, your logic is still flawed
CallMeOrange
@EgnaroDev
Jun 23 2017 07:21
What about the space in decision?
Jorge
@flawedLogic506
Jun 23 2017 07:21
u are still trying to assign a string and a number to the same variable
remember that a variable cannot be two things at the same time
CallMeOrange
@EgnaroDev
Jun 23 2017 07:22
function cc(card) {
  if (card >= 2 && card <=6) {
  count -= 1 + " " + "Bet";
  }
  else if (card >= 7 && card <= 9) {
  count = + " " + "Bet";
  }
  else if (card >= 10, 'J', 'Q', 'K', 'A') {
  count += 1 + " " + "Hold";
  }
  return count;
}
oh
Jorge
@flawedLogic506
Jun 23 2017 07:22
have another variable to hold either bet or hold string
and concat both variables
CallMeOrange
@EgnaroDev
Jun 23 2017 07:23
I see so that is why output act like werid
Jorge
@flawedLogic506
Jun 23 2017 07:23
also this else if (card >= 10, 'J', 'Q', 'K', 'A') will never work, because u cannot compare a number to a letter .. how can you know if a card is greater to or equal to Q
u know because u know the value .. but a computer doesnt know
CallMeOrange
@EgnaroDev
Jun 23 2017 07:24
unction cc(card) {
  var bet = "Bet";
  var hold = "Hold";
  if (card >= 2 && card <=6) {
  count -= 1 + " " + bet;
  }
  else if (card >= 7 && card <= 9) {
  count = + " " + bet;
  }
  else if (card >= 10, 'J', 'Q', 'K', 'A') {
  count += 1 + " " + hold;
  }
  return count;
}
So I will remove =
Jorge
@flawedLogic506
Jun 23 2017 07:24
no .. it still doesnt know
CallMeOrange
@EgnaroDev
Jun 23 2017 07:24
seriously?
No need for letters then?
Jorge
@flawedLogic506
Jun 23 2017 07:24
how should it know that the A card is greater than a K card
CallMeOrange
@EgnaroDev
Jun 23 2017 07:24
I can use else for letters
Hm..
Jorge
@flawedLogic506
Jun 23 2017 07:25
exactly!
CallMeOrange
@EgnaroDev
Jun 23 2017 07:25
Well lol
so not else if? just else then return either bet or hold
Jorge
@flawedLogic506
Jun 23 2017 07:25
also .. dont concat on the same operation .. i think that count += 1 + " " + hold will throw an error
CallMeOrange
@EgnaroDev
Jun 23 2017 07:26
So I should store just space and string hold or bet in a variable?
Jorge
@flawedLogic506
Jun 23 2017 07:27
how about
var text = '';

if count is something, then text = bet ...
CallMeOrange
@EgnaroDev
Jun 23 2017 07:27
so like count += 1 + hold var hold = " " + "Hold";
Is both fine?
@OrangeKulture honestly I dont understand your example
Jorge
@flawedLogic506
Jun 23 2017 07:28
yes but how do u know which one to return if they are passing a lot of different cards to test
it's better explain if i show you
```
var count = 0;

function cc(card) {
  var resp = '';

  if(card<=6){
    count += 1;
  }else if(card>6&&card<10){
    count+= 0;
  }else{
    count-= 1;
  }

  if(count>0){
    resp = 'Bet';
  }else{
    resp = 'Hold';
  }

  return count+" "+resp; 

}
u cannot have count hold both the count and the string
CallMeOrange
@EgnaroDev
Jun 23 2017 07:30
oh...
So store each in different variable?
Jorge
@flawedLogic506
Jun 23 2017 07:31
yes
CallMeOrange
@EgnaroDev
Jun 23 2017 07:31
but.. will count in variable changes?
Jorge
@flawedLogic506
Jun 23 2017 07:31
this is the long way to illustrate the point .. theres a lot of variations , u can concat and return after evaluating count and so on
what do u mean?
CallMeOrange
@EgnaroDev
Jun 23 2017 07:32
Like how would it return 5 Hold for example
Jorge
@flawedLogic506
Jun 23 2017 07:32
return count+" "+resp;
CallMeOrange
@EgnaroDev
Jun 23 2017 07:32
that it?
Jorge
@flawedLogic506
Jun 23 2017 07:32
well yeah .. im using an if /else statement to assing a value to the variable count ..
then using count as a case, i assign either bet or hold to a string variable
and then i return both variables
CallMeOrange
@EgnaroDev
Jun 23 2017 07:33
Can I use empty quote in a decision?
Jorge
@flawedLogic506
Jun 23 2017 07:33
return is not a decision tho
but yes .. u could, potentially, depending on what u are trying to do
CallMeOrange
@EgnaroDev
Jun 23 2017 07:34
I meant what I do with empty quote? in var or in decision
Jorge
@flawedLogic506
Jun 23 2017 07:34
what empty quote? not sure i follow
u mean when i did var resp = '' ;
CallMeOrange
@EgnaroDev
Jun 23 2017 07:34
Oh by empty quote I meant the space :/
Like +" "+
Jorge
@flawedLogic506
Jun 23 2017 07:35
space is being concatenated into the return statement
CallMeOrange
@EgnaroDev
Jun 23 2017 07:36
function cc(card) {
  var bet = "Bet";
  var hold = "Hold";
  if (card >= 2 && card <=6) {
  count -= 1 + " " + bet;
  }
  else if (card >= 7 && card <= 9) {
  count = + " " + bet;
  }
  else if (card >= 10) {
  count += 1 + " " + hold;
  } else {
    count = hold;
  }
  return count;
}
Jorge
@flawedLogic506
Jun 23 2017 07:37
you are still trying to do the same thing .. count cant be a string and a number at the same time
CallMeOrange
@EgnaroDev
Jun 23 2017 07:37
hold count = + " " + bet; I think first addition operator should be removed..
but I stored string in a variable?
Jorge
@flawedLogic506
Jun 23 2017 07:37
yes ... but only a string
CallMeOrange
@EgnaroDev
Jun 23 2017 07:37
so add space also?
Jorge
@flawedLogic506
Jun 23 2017 07:37
var a = 2
var a="2"
is not the same
CallMeOrange
@EgnaroDev
Jun 23 2017 07:38
So I remove quote in var then put quote around variable in decision?
Jorge
@flawedLogic506
Jun 23 2017 07:39
the quotes represent a string ...
CallMeOrange
@EgnaroDev
Jun 23 2017 07:39
oh well..
What can I do about a string...
damn it I dont get it
Jorge
@flawedLogic506
Jun 23 2017 07:40
var a = "bee"
var b = "sting"

return a+b ; //beesting
return a+" "+b;  // bee sting
CallMeOrange
@EgnaroDev
Jun 23 2017 07:41
ooh, number is supposed to be string?
I dont get what you mean by your example... I dont see what I did wrong with concat..
Jorge
@flawedLogic506
Jun 23 2017 07:42
well yes and no .. haha it get's tricky because it gets evaluated, probably
its not wrong, it just doesnt work
u need to evaluate count for the letters... assign values and suc
CallMeOrange
@EgnaroDev
Jun 23 2017 07:43
suc?
by letters you mean the letters represents 10?
omg I have been at this challenge for an hour
Jorge
@flawedLogic506
Jun 23 2017 07:44
such *
in reality, yes.. it is wrong
CallMeOrange
@EgnaroDev
Jun 23 2017 07:44
the letters?
Jorge
@flawedLogic506
Jun 23 2017 07:45
u cant do an operation and a string concatenation to a variable ... if count = 0 .. u cant say, ok, add 1 to count and then throw in some space in there and at the end, append the string Hold
doesnt work like that at all
CallMeOrange
@EgnaroDev
Jun 23 2017 07:46
so I just add space in variable? var bet = " Bet"
Jorge
@flawedLogic506
Jun 23 2017 07:46
no
i already show you the code .. understand why it works how it works
showed even
CallMeOrange
@EgnaroDev
Jun 23 2017 07:47
that was your code?
Jorge
@flawedLogic506
Jun 23 2017 07:47
yes
CallMeOrange
@EgnaroDev
Jun 23 2017 07:47
...
Jorge
@flawedLogic506
Jun 23 2017 07:48
i think u need to better understand how variable types work
CallMeOrange
@EgnaroDev
Jun 23 2017 07:49
oh... you just create if statements for 1 and 0
was that it?
Marius Nicolae
@bytao7mao
Jun 23 2017 07:50
@OrangeKulture do you suggest doing alghoritms for better understanding of how programming works ? what's your opinion
Jorge
@flawedLogic506
Jun 23 2017 07:50
ohh totally .. yeah .. sometimes its fun, but it can get frustrating
CallMeOrange
@EgnaroDev
Jun 23 2017 07:50
:/
I hate Counting Cards
Jorge
@flawedLogic506
Jun 23 2017 07:51
@MCTwoDigitZero well look at the code .. i told you evaluate count, then based on count, decide whether to hold or bet
CallMeOrange
@EgnaroDev
Jun 23 2017 07:51
yeah I get it
Jorge
@flawedLogic506
Jun 23 2017 07:53
if you want to do it in a single line , then it would be
if(card>2&&card<=6){
count += 1;
resp = "hold";
return count + [space] + resp;  // 5 hold
}
CallMeOrange
@EgnaroDev
Jun 23 2017 07:53
wow
Marius Nicolae
@bytao7mao
Jun 23 2017 07:55
magic
CallMeOrange
@EgnaroDev
Jun 23 2017 07:55

var count = 0;

function cc(card) {
  var bj = '';
  if (card > 1 && card < 7) {
  count -= 1;
  }
  else if (card > 6 && card < 10) {
  count += 0;
  }
  else if (card >= 10) {
  count += 1;
  }

  else if (count > 0) {
    return "Bet";
  } else {
    return "Hold";
  }
  return count+' '+bj;
}

// Add/remove calls to test your function.
// Note: Only the last will display
cc(2); cc(3); cc(7); cc('K'); cc(5);
Jorge
@flawedLogic506
Jun 23 2017 07:55
that wont work
CallMeOrange
@EgnaroDev
Jun 23 2017 07:56
Sigh I knew something was wrong
Jorge
@flawedLogic506
Jun 23 2017 07:56
once you execute a return statement, the function says, ok im done with this.. here you go => the return statement
u are mising the letters .. you are doing an else if to evaluate the string, which wont work
CallMeOrange
@EgnaroDev
Jun 23 2017 07:57
I give up
I was kinda copying half of your answer but I will come back once Im done with JS section...
Jorge
@flawedLogic506
Jun 23 2017 07:58
yeah sorry dude .. im gonna go, but i pasted the answer, yeah for sure .. look at it on your own and try to figure it out
CallMeOrange
@EgnaroDev
Jun 23 2017 07:58
Yeah thanks @OrangeKulture I have actually learned a lot of things from you
CamperBot
@camperbot
Jun 23 2017 07:58
mctwodigitzero sends brownie points to @orangekulture :sparkles: :thumbsup: :sparkles:
:cookie: 424 | @orangekulture |http://www.freecodecamp.com/orangekulture
Jorge
@flawedLogic506
Jun 23 2017 07:59
sure thing! welcome dude
on that note, im gonna go crash ...
see u guys in the AM
CallMeOrange
@EgnaroDev
Jun 23 2017 07:59
Cya
Marius Nicolae
@bytao7mao
Jun 23 2017 07:59
@OrangeKulture seeya
Jorge
@flawedLogic506
Jun 23 2017 07:59
peace
CallMeOrange
@EgnaroDev
Jun 23 2017 08:00
Ok bye Im going to read a book
:runner:
Abhya Tripathi
@abhya004
Jun 23 2017 09:06
How do I insert a picture in HTML from my computer?
kirbyedy
@kirbyedy
Jun 23 2017 09:08
@abhya004 you have to host it somewhere on the internet
for example: https://postimage.io/
or github, or dropbox or some similar service
Abhya Tripathi
@abhya004
Jun 23 2017 09:12
Okay Great.
Got it.
Thanks.
Marius Nicolae
@bytao7mao
Jun 23 2017 09:30
@abhya004 from your computer, you only have to specify src (source)
like so : <img src="pic_mountain.jpg" alt="Mountain View" style="width:304px;height:228px;">
but if you have the image in a folder images, you will type src="images/pic_mountain.jpg"
JamesVitaly
@JamesVitaly
Jun 23 2017 09:34
Ok so i am doing the API twitch thing, and I have created three functions that output whether the stream is online or offline, seems to work ok, but when I add a new variable, meant to hodl the value of the game being streamed, it suddenly wont output any information , can someone check out my codepen and possibly give me a clue where i am going wrong
JamesVitaly
@JamesVitaly
Jun 23 2017 09:41
it seems to work for my ESL stream but not the others
JamesVitaly
@JamesVitaly
Jun 23 2017 09:46
any takers? :) really stuck atm
Jim Tryon
@jimtryon
Jun 23 2017 09:53
I’ll take a look but can’t promise I’ll spot the problem @JamesVitaly
kirbyedy
@kirbyedy
Jun 23 2017 09:55
@JamesVitaly but wait freecodecamp and robotcaleb are offline what do you expect to see ?
only that esl is online
JamesVitaly
@JamesVitaly
Jun 23 2017 09:57
when i add in gamePlayed variable as an if statement (so that itll show up if they come online) it doenst output anything to my div
ive just seemingly worked a fix on it but it doesnt make sense to me why it would work now, although it seems to
but effecitvely i had a variable which reported the stream status, but then if i added in the gameplayed variable the whole function stopped working
now i have added an if statement that says if streamstutus is not equal to null then gaeplayed variable exists and it seems to work
I hate making things work and not knowing why :(
Jim Tryon
@jimtryon
Jun 23 2017 10:00
Yeah @JamesVitaly you don’t want to adopt the practice of just hacking stuff until it works
You want to be able to explain why it works/doesn’t work
JamesVitaly
@JamesVitaly
Jun 23 2017 10:00
exactly
kirbyedy
@kirbyedy
Jun 23 2017 10:01
so you will basically make function for each of your channels ?
so if you have 10 channels thats 10 functions
and if you want to add another 5, you will have to add another 5 functions ?
JamesVitaly
@JamesVitaly
Jun 23 2017 10:02
yah seems like a long way round
Jim Tryon
@jimtryon
Jun 23 2017 10:02
I’d have one of the guys in the main chat take a look like @psyperl @nahuel @apottr to name a few
kirbyedy
@kirbyedy
Jun 23 2017 10:02
isn`t that a bit odd ?
Jim Tryon
@jimtryon
Jun 23 2017 10:02
@kirbyedy might be able to help too, got a doctor’s appointment, good night!
JamesVitaly
@JamesVitaly
Jun 23 2017 10:02
i guess but without a way of updat @kirbyedy ng the api
updating* the api
i could make an array and do it liek that
kirbyedy
@kirbyedy
Jun 23 2017 10:03
you might want to take a look at foreach method on arrays
JamesVitaly
@JamesVitaly
Jun 23 2017 10:03
ok yeh would probably be simpler
so you will have just one function, but it will run through all the elements of your array
abraham anak agung
@padunk
Jun 23 2017 10:05
i think gamePlayed won't work because there is no data in offline player
newdeveloper15
@newdeveloper15
Jun 23 2017 10:07
hi, i am working on tribute website on codepen.io but there bootstrap grid system is not working. I had included bootstrap in settings. Any idea ?
Afiur Rahman Fahim
@faahim
Jun 23 2017 10:10
@newdeveloper15 hey, I'm also working on my tribute page. Did you include bootstrap from the CSS menu
newdeveloper15
@newdeveloper15
Jun 23 2017 10:14
@faahim yes, bootstrap is working for other elements but not for rows and columns
@faahim here is code

<div class="row">

<div class="col-md-2">hello</div>

<div class="col-md-8">

  <h3>Here's a time line of Dr. Borlaug's life:</h3>

</div>

<div class="col-md-2">world</div>

</div>
<!--row-1 end-->

Ken Haduch
@khaduch
Jun 23 2017 10:20
@newdeveloper15 - which bootstrap version are you using? Do you have a container or container-fluid div as the parent of your grid content? Do you want to post your URL?
newdeveloper15
@newdeveloper15
Jun 23 2017 10:24
bootstrap version is 3.
I am using container-fluid.
Afiur Rahman Fahim
@faahim
Jun 23 2017 10:25
@newdeveloper15 what's the output?
Okay, I'm taking a look
@newdeveloper15 Okay, so you are placing an h3 outside of any colum dive
*div
Ken Haduch
@khaduch
Jun 23 2017 10:26
@newdeveloper15 - I just made a really simple pen with your code and it works. It looks like it is working in your pen as well? At least, there are three columns.
Afiur Rahman Fahim
@faahim
Jun 23 2017 10:28
as h3 is an block-level element, it's taking up the whole space. You can wrap the h3 in a div. That will solve the problem I guess.
Oh, no! I'm wrong. Sorry. you have your h3 insdie a div. Sorry again1
Ken Haduch
@khaduch
Jun 23 2017 10:29
@newdeveloper15 - there are three columns, if your screen is set to a wide enough setting. Not sure if you want to have some other added styling for it, like margins on the side of the page? Use a container instead of container-fluid because that has side margins?
Afiur Rahman Fahim
@faahim
Jun 23 2017 10:31

@newdeveloper15 your pen is just fine. maybe your codepen output window is smaller than what bootstrap consider medium size. resize to check.

Also, try using col-sm- instead of col-md-

newdeveloper15
@newdeveloper15
Jun 23 2017 10:31
@khaduch Sir its very strange, its not working in my pen. I have to no idea what is wrong in my code.
Ken Haduch
@khaduch
Jun 23 2017 10:33
@newdeveloper15 - check your screen width as compared to the size you are using - change them all to col-xs-* to make it always have the three columns. That probably isn't what you want, ultimately, but it will insure that you are going to see the data formatted in columns regardless of your screen size.
because it seems to be working fine just as you have it set up, when I view your page on a full screen width of my laptop. And it formats into a single column when I reduce the width of the page below the sm width setting.
@newdeveloper15 - this is what I see from a screenshot showing the bottom of my screen, although I did change the parent div to container to get the side margins:
image.png
andoreilly
@andoreilly
Jun 23 2017 10:39
hi guys im having an issue with my footer (its an image with a link) but the image will not show and the alt is showing up in the body
Afiur Rahman Fahim
@faahim
Jun 23 2017 10:40
@andoreilly show us the code buddy? :)
Ken Haduch
@khaduch
Jun 23 2017 10:40
@andoreilly - if you post your URL we can take a look.
newdeveloper15
@newdeveloper15
Jun 23 2017 10:40
@khaduch Sir when i change col size to xs, now it is working
andoreilly
@andoreilly
Jun 23 2017 10:40

<footer>
<a target="_blank" title="find us on Facebook" href="http://www.facebook.com/PLACEHOLDER"><img alt="find us on facebook" src="//login.create.net/images/icons/user/facebook-c_130x50.png" border=0></a>

</footer>

</html>

newdeveloper15
@newdeveloper15
Jun 23 2017 10:41
@khaduch thank you so much for taking out time for me ! :)
CamperBot
@camperbot
Jun 23 2017 10:41
newdeveloper15 sends brownie points to @khaduch :sparkles: :thumbsup: :sparkles:
:star2: 3032 | @khaduch |http://www.freecodecamp.com/khaduch
add http and the image will hopefully display.
andoreilly
@andoreilly
Jun 23 2017 10:43
@faahim thank you kind sir!life saver
CamperBot
@camperbot
Jun 23 2017 10:43
andoreilly sends brownie points to @faahim :sparkles: :thumbsup: :sparkles:
:cookie: 121 | @faahim |http://www.freecodecamp.com/faahim
Afiur Rahman Fahim
@faahim
Jun 23 2017 10:44
Not to mention! :smile: @andoreilly
Okay, so I have a div with fixed height. I'm applying margin on both horizontal and vertical sides. The vertical margins is working where as the horizontal isn't. I want to center it.
Here is the issue:
Screenshot from 2017-06-23 16-00-55.png
Anyone have any idea?
Ken Haduch
@khaduch
Jun 23 2017 10:47
@newdeveloper15 - you're welcome. The thing that you want to do, ultimately, is set the page up so that the content displays in a "friendly" way on all devices. The larger size column settings format the display for a desktop / laptop wider screen, where you would likely be able to view columns side by side at a comfortable viewing size. The idea is that they reformat to a single column on a narrower screen so that you don't have this view of really narrow columns with a couple words on each line of text, which is difficult to read. You have do decide where the breakpoints are, but the xs size means that on the smallest viewport size the columns will be what you specify. If you use a larger size setting such as sm or md - if the viewport size gets below the threshold for the size that you selected, then it default to making the columns full-width on the device. So xs forces the exact column layout, but it might not be usable on a mobile device, for example. You have to experiment and find something that works well, regardless of the device that is being used to view your page.
Afiur Rahman Fahim
@faahim
Jun 23 2017 10:50
Okay, so when I apply absolute margin using px, it works. But when I use 'auto', it doesn't :worried:
andoreilly
@andoreilly
Jun 23 2017 10:50
has anyone had an issue with their footer showing up in the middle of the page
?
Ken Haduch
@khaduch
Jun 23 2017 10:55
@faahim - the settings for your .quote class might be conflicting with the styling that you are trying to achieve with the rows and columns? Since rows and columns use varying width percentages to determine how much horizontal space they occupy. It's hard to know exactly what is happening. I always play around with the devtools and see where the conflicts are, sometimes it's not obvious (at least to me) what is happening.
Afiur Rahman Fahim
@faahim
Jun 23 2017 10:56
I was thinking exactly the same thing. I am applying this class on the same div that have col-md-12
So maybe there's something conflicting.
But what the best approach to center the div in your opinion sir?
remove the bootstrap class?
Ken Haduch
@khaduch
Jun 23 2017 10:57
@faahim - in that screenshot that you posted - you can see that the width: 100%; for the col-md-12 is crossed out, meaning that it is overridden by some other setting - the one that you have in your .quote. You have to be careful, I would say, when using the grid so that you don't have conflicts that break the way the grid is designed to work.
@faahim - If you always want that particular piece of data to be centered, I would say just put it in a div that is not part of the row and column of the grid, so it will just be a block-level element with its own styling. That might be what you want for that?
Afiur Rahman Fahim
@faahim
Jun 23 2017 11:00
yes, I overridden the width on purpose so that it centers horizontally. But as it turn out, it's not working!
Ken Haduch
@khaduch
Jun 23 2017 11:00
@andoreilly - are you trying to fix your footer to the bottom of the screen?
Afiur Rahman Fahim
@faahim
Jun 23 2017 11:01
@khaduch Thank you sir. That's the best thing to do I guess :)
CamperBot
@camperbot
Jun 23 2017 11:01
faahim sends brownie points to @khaduch :sparkles: :thumbsup: :sparkles:
:star2: 3033 | @khaduch |http://www.freecodecamp.com/khaduch
Varun Pandey
@varun30300
Jun 23 2017 11:03

why isnt the colour changing to blue when i bring my curser on the options ?

https://codepen.io/varun30300/pen/rwzjZb

alpox
@alpox
Jun 23 2017 11:07
@varun30300 Nesting CSS expressions is not allowed. This is a feature of pre-processors only
Afiur Rahman Fahim
@faahim
Jun 23 2017 11:08
@varun30300 aren't you using plain CSS? you can not nest rule inside other CSS rule! write them separately, and it'll work :)
Sweet Coding :)
@SweetCodingInc
Jun 23 2017 11:09

@varun30300 :

1) Set your preprocessor to either LESS or SCSS in CSS settings
2) It's background-color not back-ground-color

tundeiness
@tundeiness
Jun 23 2017 11:10
can anyone show me how to bring in images into codepen? I am not a pro user for now and I need to use an image on my task.
Afiur Rahman Fahim
@faahim
Jun 23 2017 11:11
@varun30300
Like This:
ul li a {
    text-decoration:none;
    color:white;
    display:block;    
  }

ul li a:hover {
      back-ground-color:blue;
    }
Varun Pandey
@varun30300
Jun 23 2017 11:11
thank you @SweetCodingInc @faahim @alpox
CamperBot
@camperbot
Jun 23 2017 11:11
varun30300 sends brownie points to @sweetcodinginc and @faahim and @alpox :sparkles: :thumbsup: :sparkles:
:cookie: 122 | @faahim |http://www.freecodecamp.com/faahim
:cookie: 26 | @sweetcodinginc |http://www.freecodecamp.com/sweetcodinginc
:star2: 1168 | @alpox |http://www.freecodecamp.com/alpox
Varun Pandey
@varun30300
Jun 23 2017 11:11
it worked
Afiur Rahman Fahim
@faahim
Jun 23 2017 11:11
:+1: @varun30300
alpox
@alpox
Jun 23 2017 11:12
:clap:
Sweet Coding :)
@SweetCodingInc
Jun 23 2017 11:12
@varun30300 Assuming you've set your CSS Preprocessor to LESS or SCSS You need this code. Your original code has nesting issue
ul {
  margin: 20px;
  list-style: none;
}
ul li {
  float: left;
  background-color: green;
  opacity: .8;
  width: 230px;
  height: 40px;
  text-align: center;

  a {
    text-decoration: none;
    color: white;
    display: block;
  }
  a:hover {
    background-color: blue;
  }
}

body {
  background: url("https://s20.postimg.org/wyflcl1vx/waterfall.jpeg.jpg");
  background-size: cover;
  color: white;
  font-size: 30px;
}
note: If you're gonna nest your a elements, it should be just a and a:hover not ul li a and ul li a:hover
This is pure CSS equivalent of the same
ul {
  margin: 20px;
  list-style: none;
}
ul li {
  float: left;
  background-color: green;
  opacity: .8;
  width: 230px;
  height: 40px;
  text-align: center;
}

ul li a {
  text-decoration: none;
  color: white;
  display: block;
}
ul li  a:hover {
  background-color: blue;
}

body {
  background: url("https://s20.postimg.org/wyflcl1vx/waterfall.jpeg.jpg");
  background-size: cover;
  color: white;
  font-size: 30px;
}
Afiur Rahman Fahim
@faahim
Jun 23 2017 11:14
@khaduch
Oh such a fool I am! If I want to center it, I can just create a col-md-8 and then I can have a col-md-offset-2 to have some margin on left! That's the proper way via using grid. :)
Varun Pandey
@varun30300
Jun 23 2017 11:33

guys , how do i fix my contact option(bring your cursor on it ) ?

https://codepen.io/varun30300/pen/rwzjZb

Tom
@moT01
Jun 23 2017 11:49
whats the problem? @varun30300
Alexander Domikov
@AlexanderDom
Jun 23 2017 12:00
@varun30300 i's because <ul> by default has padding-left
padding-left: 0 must help :)
and sorry looked too fast
in your css you have ul { margin: 20px }
il works for ul inside an ul too
Juli Cheng
@julicheng
Jun 23 2017 12:25

Hello so I'm doing the "Factorialize a Number" challenge and I managed to get it right which is

function factorialize(num) {
  var total = num;
  for (var i = 1; i < num; i++) {
    total *= i;
    }
    if (num === 0) {
      total=1;
  }
  return total;
}

factorialize(5);

I then looked at another solution onlinebut I don't really understand it. Could someone please explain? There isn't a loop so would it just return 5 * 4?

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

factorialize(5);
wouldn't it just return*
Usman Ahmad Saeed
@UsmanAhmadSaeed
Jun 23 2017 12:27
Lol no understanding of js at the moment but try makimg an algorithm before program to get it better
Ravi Kishore Thella
@ravikishorethella
Jun 23 2017 12:27
@ahmeah the second method is a recursive method
@ravikishorethella factorialize(num-1) will loop
Juli Cheng
@julicheng
Jun 23 2017 12:28
@ravikishorethella is it because the function is called within the function?
Eric Weiss
@eweiss17
Jun 23 2017 12:29
that is recursion, yes
you need to make sure there it doesn't go on infinity in recursion though
Ravi Kishore Thella
@ravikishorethella
Jun 23 2017 12:29
Juli Cheng
@julicheng
Jun 23 2017 12:36
Thanks @ravikishorethella @eweiss17 so recursion is like calling its own function it is in?
CamperBot
@camperbot
Jun 23 2017 12:36
ahmeah sends brownie points to @ravikishorethella and @eweiss17 :sparkles: :thumbsup: :sparkles:
:cookie: 491 | @eweiss17 |http://www.freecodecamp.com/eweiss17
:cookie: 826 | @ravikishorethella |http://www.freecodecamp.com/ravikishorethella
Ravi Kishore Thella
@ravikishorethella
Jun 23 2017 12:36
@ahmeah yes
Juli Cheng
@julicheng
Jun 23 2017 12:36
Why does it return 1 though when num === 0??
Ken Haduch
@khaduch
Jun 23 2017 12:45
@faahim - oh, yes that makes sense to do that. I guess I'm a little rusty, either with the bootstrap grid or because it's too early in the morning... :point_up: June 23, 2017 7:14 AM
@ahmeah - because 0! = 1 Another way to look at it is as you subtract 1 from the number, you eventually get to the value of 0 so if your function returned 0 when num === 0, then your final result would be multiplied by 0 and the answer would be 0...
Juli Cheng
@julicheng
Jun 23 2017 12:54
thanks @khaduch
CamperBot
@camperbot
Jun 23 2017 12:54
ahmeah sends brownie points to @khaduch :sparkles: :thumbsup: :sparkles:
:star2: 3034 | @khaduch |http://www.freecodecamp.com/khaduch
Ashley Owens
@yelhsa
Jun 23 2017 13:21
:) I Think i finally finished the portfolio. Would love some feedback. https://codepen.io/yelhsa/full/YQKewG/
Tom
@moT01
Jun 23 2017 13:25
@yelhsa looks good
kirbyedy
@kirbyedy
Jun 23 2017 13:32
@yelhsa nice, are those your pictures ?
Ashley Owens
@yelhsa
Jun 23 2017 13:33
No. I just grabbed them from pexel. @kirbyedy
thanks @moT01 :) I'm really proud this is like 3 weeks and 4 iterations in.
CamperBot
@camperbot
Jun 23 2017 13:33
yelhsa sends brownie points to @mot01 :sparkles: :thumbsup: :sparkles:
:cookie: 733 | @mot01 |http://www.freecodecamp.com/mot01
Kaushal Malkan
@kaushalmalkan
Jun 23 2017 13:33
Hey everyone, I need your help. Can someone please tell me how to tweet a particular text that is saved in a variable in java script. I want it for my random quote machine. Here's the link : https://codepen.io/kaushalmalkan/pen/PjpBMV
Tom
@moT01
Jun 23 2017 13:36
@kaushalmalkan window.open("https://twitter.com/intent/tweet/?text=" + variable);
thats how ive seen most people do it
Gulsvi
@gulsvi
Jun 23 2017 13:37
@yelhsa Nice work :)
Try to remove your inline styles and put them in your CSS.
Instead of <br /> use the CSS margin property. That tag is meant for poems and addresses.
You have a duplicate ID in your HTML:
    <div id="navbarlist" class = "collapse navbar-collapse">
      <ul id = "navbarlist" class = "navbar-nav pull-right">
@kaushalmalkan Here are the instructions for tweeting text: https://dev.twitter.com/web/tweet-button/web-intent
Here's a few ways to create a link in JavaScript: https://stackoverflow.com/questions/4772774/how-do-i-create-a-link-using-javascript
Ashley Owens
@yelhsa
Jun 23 2017 13:40
:0 will get on that id thing. how can I let it know to skip a line in other ways? @SkyC0der
Usman Ahmad Saeed
@UsmanAhmadSaeed
Jun 23 2017 13:41
What do you mean by skip a line?
Gulsvi
@gulsvi
Jun 23 2017 13:42
@yelhsa The best way to handle that is to add a class to each of your links with the images in them and use margin-top in your CSS
Basic example:
<div class="portfolio-image">
  <a target="_blank" href="#">
    <img src="https://images.pexels.com/photos/33688/delicate-arch-night-stars-landscape.jpg?h=350&auto=compress&cs=tinysrgb" alt="Night Sky">
  </a>
</div>
.portfolio-image {
  margin-top: 1em;
}
Tom
@moT01
Jun 23 2017 13:45
<!--skip html-->
/*skip css or multiple lines of js*/
//skip single lines of js
@yelhsa
Leonardo de Melo
@Leonardo-demeloweb
Jun 23 2017 13:46
Hello guys, I am getting trouble when I try to install the packages from the repository vue-google-maps, experimenting with VUE.js. I am using yarn install and the error message is on the package.json archive, ant help https://github.com/GuillaumeLeclerc/vue-google-maps/
any help*?
Tom
@moT01
Jun 23 2017 13:47
@yelhsa those are comments, ...you maybe wanted to know something else
Gulsvi
@gulsvi
Jun 23 2017 13:49
@moT01 They're referring to alternates for the <br> tag
@Leonardo-demeloweb https://gitter.im/vuejs/vue
Tom
@moT01
Jun 23 2017 13:50
thats kind of what i thought after reading
Ashley Owens
@yelhsa
Jun 23 2017 13:59
That sounds good. I will look into doing a little more formatting. I want to make it so the home image shows the laptop on every screen and those thumbnails on the desktop order themselves into rows and get less huge. @SkyC0der
Leonardo de Melo
@Leonardo-demeloweb
Jun 23 2017 13:59
@SkyC0der thanks
CamperBot
@camperbot
Jun 23 2017 13:59
leonardo-demeloweb sends brownie points to @skyc0der :sparkles: :thumbsup: :sparkles:
:star2: 1811 | @skyc0der |http://www.freecodecamp.com/skyc0der
Gulsvi
@gulsvi
Jun 23 2017 14:03
@yelhsa Use the background-position property in your CSS (e.g., background-position: center center;). Here's an example of how to put your images into rows: https://codepen.io/skycoder/pen/mWyQVG
Nick Sladic
@Nickadiemus
Jun 23 2017 14:21
Whats up guys!
johnnydemol
@johnnydemol
Jun 23 2017 14:41
Hey guys, I'm building the tic-tac-toe game and I'm kinda stuck right now. Every move calls the State constructor to construct a new state from the old one. I want to use an if statement to call the function aiMove() every time 'O' is up, so effectively letting the computer play 'O'.
https://codepen.io/svenhendrikx/pen/ZyLGBw?editors=1010
you can set toggleAI to false to play both X and O
Amit Patel
@AmitP88
Jun 23 2017 14:50
hey guys, I'm working on my Local Weather App and I need a little help. I've gotten the users' location to show up but I'm struggling to figure out how to get the weather to show up with my code. I've looked at this stackoverflow post to help me out: https://stackoverflow.com/questions/407048/accessing-variables-from-other-functions-without-using-global-variables and I tried to implement that solution, but it didn't work. I'm using XMLhttpRequest method since I used jquery's ajax and getJSON methods in the last project (I figure it would be best to learn Ajax both via jQuery and regular JS). I really don't want to have to refactor my code using jQuery and basically start over since I've come this far in the project. I feel like I'm so close to getting this part to work, but I just can't see what to do to resolve the problem. Please guys, any and all help will be highly appreciated :) https://codepen.io/AmitP88/pen/oWVjqL?editors=0010
Gulsvi
@gulsvi
Jun 23 2017 14:56
@AmitP88 No one here ever uses pure XMLhttpRequest :( Since your APIs do not have any cross-origin restrictions, perhaps you would want to try fetch()?
Here's your pen, forked and using Fetch(): https://codepen.io/skycoder/pen/WOEevv
Elizabeth Paul
@Kowalatam
Jun 23 2017 14:57
hi, i am on build a random quote machine, how do i make the tweet the quote button
Eric Weiss
@eweiss17
Jun 23 2017 14:58
I would like to assume that every company that uses JS on the reg has JQuery implemented.
one way is to stick the quote into the url
Amit Patel
@AmitP88
Jun 23 2017 14:59
@SkyC0der hmmmm, that seems a lot simpler than how I was doing it lol. Seems like I was doing it the long way around. I'll study your solution and look up the doc for fetch method. Yeah, I know XMLhttpRequest is pretty much used by no one nowadays. I just wanted to see if I could figure out how to do it via regular JS in case I was asked in an interview or something. I dunno, I thought it would be better to learn both ways, but I guess not lol
@SkyC0der thank you for your solution though, I really appreciate it. :) I really want to get good at Ajax and working with APIs, so this helps me out a lot
CamperBot
@camperbot
Jun 23 2017 15:00
amitp88 sends brownie points to @skyc0der :sparkles: :thumbsup: :sparkles:
:star2: 1812 | @skyc0der |http://www.freecodecamp.com/skyc0der
Eric Weiss
@eweiss17
Jun 23 2017 15:00
@Kowalatam
href=https://twitter.com/intent/tweet?text='+yourQuoteTextGoesHere
Gulsvi
@gulsvi
Jun 23 2017 15:01
@AmitP88 Wish I could help you figure it out with XMLhttpRequest :/
Eric Weiss
@eweiss17
Jun 23 2017 15:01
that is one way to do it
i know twitter has documentation on how to do it, but i know some get stuck on that
Elizabeth Paul
@Kowalatam
Jun 23 2017 15:02
@eweiss17 . Okay thanks.
CamperBot
@camperbot
Jun 23 2017 15:02
kowalatam sends brownie points to @eweiss17 :sparkles: :thumbsup: :sparkles:
:cookie: 492 | @eweiss17 |http://www.freecodecamp.com/eweiss17
Gulsvi
@gulsvi
Jun 23 2017 15:02
@Kowalatam Lots of examples on the Free Code Camp Forums, and on Stack Overflow: https://stackoverflow.com/questions/34248006/i-need-to-be-able-to-press-a-button-to-tweet-out-a-quote
What have you tried that isn't working?
Amit Patel
@AmitP88
Jun 23 2017 15:02
@SkyC0der I feel like I was close (as I all I had to do was get the weather request function to be able to use the JSON.response variable from the location request function in the weather url) but idk, maybe XMLhttpRequest method is weird when it comes to doing something like that
Eric Weiss
@eweiss17
Jun 23 2017 15:03
@Kowalatam The method I did you can implement with JQuery, give the tweet button the attribute everytime the get new quote button is pressed
Amit Patel
@AmitP88
Jun 23 2017 15:03
@SkyC0der maybe that's why no one is no longer using XML? lol
Eric Weiss
@eweiss17
Jun 23 2017 15:03
there are different ways to do it that all work, up 2 u
Elizabeth Paul
@Kowalatam
Jun 23 2017 15:04
@SkyC0der , i could get to twitter, and share url but dont know how to insert the current showing quote
Gulsvi
@gulsvi
Jun 23 2017 15:04
@AmitP88 jQuery's ajax and getJSON all use XMLhttpRequest under the hood, it's just a matter of getting the implementation right.
Ghost
@ghost~593024a8d73408ce4f63eac0
Jun 23 2017 15:05

Hello people.
Please see this pen
https://codepen.io/KshitijaaJaglan/full/weeYvv/

and give your reviews. This one is my first.
Thanks

Elizabeth Paul
@Kowalatam
Jun 23 2017 15:05
@eweiss17 im using DOM, I couldnt get any of jquery stuff to work on codepen so i gave up on it. :worried:
Gulsvi
@gulsvi
Jun 23 2017 15:05
@Kowalatam That's a good start - sometimes it's just a matter of getting your variables set up correctly. Feel free to share your code, maybe a small change we can help with
Eric Weiss
@eweiss17
Jun 23 2017 15:05
XML is still used
Shawn Kelly
@stuffedmunkey
Jun 23 2017 15:05
could someone help me figure out how to get data from an api using json and putting it in html
Eric Weiss
@eweiss17
Jun 23 2017 15:06
@Kowalatam What doesn't work with jquery? i haven't had problems with it on codepen
Gulsvi
@gulsvi
Jun 23 2017 15:06
Fortran is still used too @eweiss17 :) I think what @AmitP88 is saying is that more people gravitating toward JSON nowadays.
Eric Weiss
@eweiss17
Jun 23 2017 15:06
you doing document.getElementById("") and whatnot?
Amit Patel
@AmitP88
Jun 23 2017 15:07
lol yeah, that's what I meant
Eric Weiss
@eweiss17
Jun 23 2017 15:07
yaya, and C is the most popular language
Elizabeth Paul
@Kowalatam
Jun 23 2017 15:07
@eweiss17 nothing was working, it was giving me an error message, so i assumed i didnt understand jquery
you doing document.getElementById("") and whatnot?. yes
Gulsvi
@gulsvi
Jun 23 2017 15:08
@stuffedmunkey Sure, we can help
Eric Weiss
@eweiss17
Jun 23 2017 15:08
$("#element");
is equivalent to the document.getElementById("element")
Amit Patel
@AmitP88
Jun 23 2017 15:08
alright, well, I gotta get back to studying the solution Sky gave me. I may end up redoing it in Jquery to see the difference, but idk. I just wanna make sure I learn this stuff right lol. @SkyC0der thanks! :)
CamperBot
@camperbot
Jun 23 2017 15:08
amitp88 sends brownie points to @skyc0der :sparkles: :thumbsup: :sparkles:
:warning: amitp88 already gave skyc0der points
Elizabeth Paul
@Kowalatam
Jun 23 2017 15:08
@eweiss17 yes, thats what im doing querySelector and all the rest
Eric Weiss
@eweiss17
Jun 23 2017 15:09
share your jquery? maybe simple syntax error
Gulsvi
@gulsvi
Jun 23 2017 15:09
@AmitP88 Happy to help - still good to look into other alternatives. fetch() would not have worked with Weather Underground or Dark Sky - they both have cross origin restrictions, so you'd be back to square one ;) or using a CORS proxy to get your data.
Eric Weiss
@eweiss17
Jun 23 2017 15:09
trust me that document.get.... vanilla js crap is hard to read and a pain to write out
Shawn Kelly
@stuffedmunkey
Jun 23 2017 15:09
great! googling it isnt helping. I tried the freecodecamp version of sending api data through json but it did not do anything when i hit my button
Elizabeth Paul
@Kowalatam
Jun 23 2017 15:09
@eweiss17 i dont have the jquery anymore, gave up on it days ago and learnt DOM. :)
Shawn Kelly
@stuffedmunkey
Jun 23 2017 15:10
I am trying the random quote machine
'
Gulsvi
@gulsvi
Jun 23 2017 15:10
@stuffedmunkey Do you have any errors in your debug console? (Ctrl+Shift+J on Windows / Command+Option+J on Mac)
Elizabeth Paul
@Kowalatam
Jun 23 2017 15:11

lol.

trust me that document.get.... vanilla js crap is hard to read and a pain to write out

Amit Patel
@AmitP88
Jun 23 2017 15:11
@SkyC0der lol yeah, I looked into those (as well as Open Weather API) and ran into issues with http vs https, CORS, etc. In fact, I think even CORS didn't even work with Dark Sky lol. ugh, what a headache that was
Eric Weiss
@eweiss17
Jun 23 2017 15:13
share your pen
Shawn Kelly
@stuffedmunkey
Jun 23 2017 15:13
Uncaught ReferenceError: $ is not defined
at pen.js:35:10
Amit Patel
@AmitP88
Jun 23 2017 15:13
@SkyC0der damn....yeah, your solution was just straight to the point. Mine seems like it was waaay drawn out lol
Shawn Kelly
@stuffedmunkey
Jun 23 2017 15:13
that error came up
Amit Patel
@AmitP88
Jun 23 2017 15:14
@SkyC0der I guess MDN solutions likes to do that haha
Gulsvi
@gulsvi
Jun 23 2017 15:14
@stuffedmunkey That means you don't have jQuery added to your project
@AmitP88 You wanted to start with the basics :p
Unfortunately, the basics are really complicated. jQuery and Fetch() helps encapsulate all of that for us
Amit Patel
@AmitP88
Jun 23 2017 15:15
@SkyC0der lol true. sometimes I confuse myself. like one part of me wants to learn the basics and learn it right. The other wants to learn the simplest and most straight forward way of doing things. I guess both tend to be really different lol
Shawn Kelly
@stuffedmunkey
Jun 23 2017 15:16
how do i add the jquery to my project? i dont see anything differet from fcc version of what im trying to do
Eric Weiss
@eweiss17
Jun 23 2017 15:17
I'm not sure a company would be impressed by knowing the 'Basic' ways of doing things. I feel knowing the most current is preferred.
Amit Patel
@AmitP88
Jun 23 2017 15:19
@eweiss17 ah I see. so I should just learn the simplest and most efficient way of making apps? A friend of mine told me to get really good at core JS first before learning jQuery and JS frameworks
Gulsvi
@gulsvi
Jun 23 2017 15:19
@AmitP88 By the way, I think I got your old code working :p lol you were calling both the LocationRequest and WeatherRequest functions at the same time, so the WeatherRequest function was running before it had any location data
(you were really, really close)
Eric Weiss
@eweiss17
Jun 23 2017 15:20
understanding the basics is very good
Gulsvi
@gulsvi
Jun 23 2017 15:20

You also have:

document.getElementById("location").append(jsonLocation.city + ',' + jsonLocation.country);

Instead of:

document.getElementById("location").innerHTML = jsonLocation.city + ',' + jsonLocation.country;
Amit Patel
@AmitP88
Jun 23 2017 15:20
@SkyC0der facepalm dammit lol
Eric Weiss
@eweiss17
Jun 23 2017 15:21
I know a lot of job requirement descriptions say "Up to date with most current standard and practices for __"
Nadja Stojanovic
@nadjastojanovic
Jun 23 2017 15:22
Does anybody know how to set three images in a row to have the same height and still be responsive? The problem are the three pictures on the bottom of my tribute page https://codepen.io/nadjastojanovic/full/jwbJrZ/
Eric Weiss
@eweiss17
Jun 23 2017 15:22
If you worked at a company that did use vanilla JS xmlHTTP requests like that, you could be like 'hey lets implement JQuery, it is a lot easier to understand and works well'
Shawn Kelly
@stuffedmunkey
Jun 23 2017 15:22
@SkyC0der maybe you could tell me what it is i am missing
Amit Patel
@AmitP88
Jun 23 2017 15:24
@eweiss17 ah I see. yeah, that's a good point. I guess I was thinking what if I got tested on how to do something if I had to use reg JS when most people would use jQuery
Eric Weiss
@eweiss17
Jun 23 2017 15:26
would you be applying for a senior dev position
Gulsvi
@gulsvi
Jun 23 2017 15:26
@stuffedmunkey Click Settings -> JavaScript -> Quick-Add -> jQuery
After that, you'll see a Mixed Content Error because your API URL needs to be:
https://quotesondesign.com/wp-json/posts?filter[orderby]=rand&filter[posts_per_page]=1&callback=
Change those two things and you'll see JSON in your HTML
Amit Patel
@AmitP88
Jun 23 2017 15:27
@eweiss17 lol nope. Jr position
Eric Weiss
@eweiss17
Jun 23 2017 15:28
depends on the company then, but Jr positions I would expect to still be learning on the job
Shawn Kelly
@stuffedmunkey
Jun 23 2017 15:29
@SkyC0der Thank you for the help! got to keep in mind the external resources. What is the difference in that link and the one i had?
CamperBot
@camperbot
Jun 23 2017 15:29
stuffedmunkey sends brownie points to @skyc0der :sparkles: :thumbsup: :sparkles:
:star2: 1813 | @skyc0der |http://www.freecodecamp.com/skyc0der
Gulsvi
@gulsvi
Jun 23 2017 15:30
@stuffedmunkey
Your Link / The New Link:
'http://quotesondesign.com/wp-json/posts?filter[orderby]=rand&filter[posts_per_page]=1&_jsonp=mycallback'
'https://quotesondesign.com/wp-json/posts?filter[orderby]=rand&filter[posts_per_page]=1&callback='
The new link, the second one listed, is the one they give in the documentation at: https://quotesondesign.com/api-v4-0/
Plus, I added https to the beginning - always use HTTPS if you can. Especially important in codepen since they require HTTPS
Amit Patel
@AmitP88
Jun 23 2017 15:30
@eweiss17 that's true. Idk, I haven't really been on many dev interviews, but I know that jr positions are competitive to get, so I want to make sure that I'm good first as I'm applying
Gulsvi
@gulsvi
Jun 23 2017 15:32
@AmitP88 Your XMLHttpRequest working: https://codepen.io/skycoder/pen/YQxYyV?editors=0011
Study the difference, let me know if I can help explain anything
Sunny Wong
@swong194
Jun 23 2017 15:33
good morning!!
Dante M Brown
@Vyceroy
Jun 23 2017 15:34
I need some help with a navbar
with bootstrap 4
Amit Patel
@AmitP88
Jun 23 2017 15:37
@SkyC0der hmmm, that's interesting. so when you wrote this: WeatherRequest(jsonLocation); is that calling the WeatherRequest function with parameter jsonLocation within the appendLocation function?
Gulsvi
@gulsvi
Jun 23 2017 15:38
@AmitP88 Yes. To get the weather, you need the location data so you can build the correct URL, so as soon as you parse the locationResponse, you send it to the weatherRequest function to build the URL and get the weatherResponse
It's basically a chain: requestLocation -> getLocation -> requestWeather -> getWeather
Amit Patel
@AmitP88
Jun 23 2017 15:40
@SkyC0der ah ok. and it doesn't matter that the WeatherRequest function is downstream from the appendLocation function because both functions are asynchronous right?
Gulsvi
@gulsvi
Jun 23 2017 15:41
@AmitP88 Correct, though you don't really need that appendLocation function at all - the location is returned with the weather json
(would require some code refactoring, of course)
To really break it down, requestLocation -> getLocation-> buildWeatherUrl -> requestWeather -> getWeather -> displayLocationAndWeather
Amit Patel
@AmitP88
Jun 23 2017 15:46
@SkyC0der hmmm, I see. that makes sense. Although, as I was coding, I was wondering, is it bad that since I'm using two request functions and two append functions, that I'm basically repeating the same methods? just one for location and one for weather. Would my code be considered bad practice?
KinderPreet Singh
@kindercappy
Jun 23 2017 15:47
@Vyceroy Paste code with question. Someone will help
Gulsvi
@gulsvi
Jun 23 2017 15:47
@AmitP88 Yeah, you could minimize repeated code with some more generic funcitons, like:
  function apiRequest(url, callback) {
    httpRequest = new XMLHttpRequest();

    if (!httpRequest) {
      alert("Giving up :( Cannot create an XMLHttp instance");
      return false;
    }

    httpRequest.onreadystatechange = callback;
    httpRequest.open("GET", url, true);
    httpRequest.send();
  }
(Edited with a more generic variable name)
Dante M Brown
@Vyceroy
Jun 23 2017 15:49
@kindercappy i got some help in the general help part
KinderPreet Singh
@kindercappy
Jun 23 2017 15:50
@Vyceroy great
Amit Patel
@AmitP88
Jun 23 2017 15:53
@SkyC0der that makes sense. lol I feel like I learned a lot just in this last hour haha
Gulsvi
@gulsvi
Jun 23 2017 15:53
Me too lol, never used that stuff before :)
Eric Weiss
@eweiss17
Jun 23 2017 15:53
lol
Gulsvi
@gulsvi
Jun 23 2017 15:53
I might try to simplify it a bit and see... much better than the other solution I had with pure JS
appending scripts is ugly lol
Varun Pandey
@varun30300
Jun 23 2017 15:54

guys i am having some issues with the contact button (bring your cursor on the button and u'll know what i am talking about), how can i resolve it.

https://codepen.io/varun30300/pen/rwzjZb?editors=0100

Eric Weiss
@eweiss17
Jun 23 2017 15:55
mmmm your css is confusing
ul li ul li
is that intuitive ?
use some classes
Varun Pandey
@varun30300
Jun 23 2017 15:57
ok , but that not the thing i am talking about
Eric Weiss
@eweiss17
Jun 23 2017 15:59
yes, but it is hard for others to help you if it is difficult to read
Varun Pandey
@varun30300
Jun 23 2017 15:59
ok , i'll keep that in mind
Amit Patel
@AmitP88
Jun 23 2017 16:01
@SkyC0der oh yeah, some parts of your original solution were a bit puzzling, like with this line: return fetch("https://ipinfo.io/json").then(res => res.json()); I don't get the res => res.json()); part. Is that a written shortcut for parsing the JSON response?
Gulsvi
@gulsvi
Jun 23 2017 16:04
@AmitP88 Yes, that's a way to parse the JSON response, could also be written as:
return fetch("https://ipinfo.io/json").then(function(response) {
  return response.json();
});
Amit Patel
@AmitP88
Jun 23 2017 16:14
@SkyC0der ah I see. so fetch is only used for Ajax when using vanilla JS?
Nikki L.R.
@nikkilr88
Jun 23 2017 16:15
Hey, everyone! I just wanted your opinions... Would you say it's better to dynamically change a divs text on a button click or just have separate divs that already have all of the information and just show and hide them.
Eric Weiss
@eweiss17
Jun 23 2017 16:15
dynamically change
Thomas Mullen
@t-mullen
Jun 23 2017 16:15
@AmitP88 fetch is new in ES6. XMLHTTPRequests are still the supported standard.
Nikki L.R.
@nikkilr88
Jun 23 2017 16:17
@eweiss17 Thanks!
CamperBot
@camperbot
Jun 23 2017 16:17
nikkilr88 sends brownie points to @eweiss17 :sparkles: :thumbsup: :sparkles:
:cookie: 493 | @eweiss17 |http://www.freecodecamp.com/eweiss17
Amit Patel
@AmitP88
Jun 23 2017 16:17
@RationalCoding ahhh I see. good to know. I still gotta get into ES6 lol
how long does it take to learn ES6 btw?
Thomas Mullen
@t-mullen
Jun 23 2017 16:18
Not long if you know ES5 ("normal" Javascript)
Amit Patel
@AmitP88
Jun 23 2017 16:20
@RationalCoding I'm not sure if I know ES5 lol. I just know the basics: variables, functions, loops, if-statements, etc
Thomas Mullen
@t-mullen
Jun 23 2017 16:22
@AmitP88 Well learn that first. The hardest part is really just the general programming concepts. Syntax is easy compared to that.
Amit Patel
@AmitP88
Jun 23 2017 16:23
@RationalCoding for sure. I'm actually reading through Eloquent JS first to get a good foundation of the core concepts before moving onto standards, frameworks, etc
Thomas Mullen
@t-mullen
Jun 23 2017 16:24
That's an excellent book
Vineet Kumar
@vineetkumarr260
Jun 23 2017 16:24
hey fellas i recently completed my wikipedia viewer app
please take time to review my work
Eric Weiss
@eweiss17
Jun 23 2017 16:25
"I'm feeling lucky" (from google I assume) does not refer to random
I believe it automatically selected the top result
nvm i have no idea they changed that
Vineet Kumar
@vineetkumarr260
Jun 23 2017 16:26
i added a tooltip on the button
@eweiss17
Eric Weiss
@eweiss17
Jun 23 2017 16:26
ya forget what i said in my comment
Vineet Kumar
@vineetkumarr260
Jun 23 2017 16:27
so do you like it @eweiss17
Amit Patel
@AmitP88
Jun 23 2017 16:28
@RationalCoding yeah, I've heard that it's pretty much a requirement these days lol. It's dense, but it's good
Eric Weiss
@eweiss17
Jun 23 2017 16:28
wow ya, it looks real nice, like a search engine
Eric Weiss
@eweiss17
Jun 23 2017 16:34
figured it out i assume?
bharathbheemireddy
@bharath506315
Jun 23 2017 16:39
hai friends i am just done with random quote generator
https://codepen.io/bharath506315/pen/mwWerX
give me your feedback
Eric Weiss
@eweiss17
Jun 23 2017 16:42
@bharath506315 No twitter button?
i'd also put the author on the line below, it looks like it is apart of the quote
bharathbheemireddy
@bharath506315
Jun 23 2017 16:43
@eweiss17 thank you. and i will update it.
CamperBot
@camperbot
Jun 23 2017 16:43
bharath506315 sends brownie points to @eweiss17 :sparkles: :thumbsup: :sparkles:
:cookie: 494 | @eweiss17 |http://www.freecodecamp.com/eweiss17
Eric Weiss
@eweiss17
Jun 23 2017 16:44
decent for so little lines of code
Roxroy
@roxroy
Jun 23 2017 16:44
@bharath506315 , looks good and works great. But it does not have the tweet button. The structure of the html, css and javascript looks good.
Eric Weiss
@eweiss17
Jun 23 2017 16:45
I'd also make your name on the bottom a link to a page of yours, such as linked in
Vineet Kumar
@vineetkumarr260
Jun 23 2017 16:45
@bharath506315 here is my quote app https://codepen.io/vineetkumarr260/pen/EXxbjK
Eric Weiss
@eweiss17
Jun 23 2017 16:46
@vineetkumarr260 you looking for feedback..?
shivam gupta
@shivamg11000
Jun 23 2017 16:47
Vineet Kumar
@vineetkumarr260
Jun 23 2017 16:47
@eweiss17 yes
@shivamg11000 yours is awesome
Eric Weiss
@eweiss17
Jun 23 2017 16:47
@vineetkumarr260 i'd reccomend JQuery animate, to make your box more fluid for when you have bigger/smaller quotes
Ravi Kishore Thella
@ravikishorethella
Jun 23 2017 16:47
@shivamg11000 :+1: good work :clap:
Vineet Kumar
@vineetkumarr260
Jun 23 2017 16:48
@eweiss17 okay done
shivam gupta
@shivamg11000
Jun 23 2017 16:48
@vineetkumarr260 ty, I was trying somethin new, your is nice ,decent design
CamperBot
@camperbot
Jun 23 2017 16:48
shivamg11000 sends brownie points to @vineetkumarr260 :sparkles: :thumbsup: :sparkles:
:cookie: 293 | @vineetkumarr260 |http://www.freecodecamp.com/vineetkumarr260
bharathbheemireddy
@bharath506315
Jun 23 2017 16:48
@vineetkumarr260 @shivamg11000 both of done very well
bharathbheemireddy
@bharath506315
Jun 23 2017 16:48
you*
shivam gupta
@shivamg11000
Jun 23 2017 16:48
@bharath506315 ty
CamperBot
@camperbot
Jun 23 2017 16:48
shivamg11000 sends brownie points to @bharath506315 :sparkles: :thumbsup: :sparkles:
:warning: @bharath506315's account is not linked with freeCodeCamp. Please visit the settings and link your GitHub account.
bharathbheemireddy
@bharath506315
Jun 23 2017 16:49
@camperbot thank you i will update it now.
CamperBot
@camperbot
Jun 23 2017 16:49
bharath506315 sends brownie points to @camperbot :sparkles: :thumbsup: :sparkles:
:star2: 3343 | @camperbot |http://www.freecodecamp.com/camperbot
bharathbheemireddy
@bharath506315
Jun 23 2017 16:50
@camperbot i don't know how to send it.
wchen71
@wchen71
Jun 23 2017 16:51
im trying to input the longitude coordinate into my temperature class. but it's not inputting the data and still returning the default 6 input. im not sure how to go about getting the api information
Eric Weiss
@eweiss17
Jun 23 2017 16:51
pretty much an ajax call within an ajax call
I'v seen people do that a lot
bharathbheemireddy
@bharath506315
Jun 23 2017 16:54
@eweiss17 hey for building local weather app it requires ajax or not?
Eric Weiss
@eweiss17
Jun 23 2017 16:55
yes
Amit Patel
@AmitP88
Jun 23 2017 16:56
hey guys, I'm trying to get the weather icon to show up on my weather app but it's not working. I'm parsing the current.condition.icon property because otherwise it just shows up as a string instead of the actual img that it's suppose to be
image.png
bharathbheemireddy
@bharath506315
Jun 23 2017 16:56
@eweiss17 hooo i don't know about ajax.
Eric Weiss
@eweiss17
Jun 23 2017 16:58
@AmitP88 does it show up if you copy what it gives you and you put it into an <img src="">
@bharath506315 gotta learn it for that project
bharathbheemireddy
@bharath506315
Jun 23 2017 16:59
@eweiss17 do you have any resources for ajax
Amit Patel
@AmitP88
Jun 23 2017 17:00
@eweiss17 hmmm, I haven't tried that. let me check real quick
Zach Upshaw
@zlupshaw
Jun 23 2017 17:02
Hey Everyone! I'm having an issue with my portfolio page. Pretty much, I'm trying to have the first div background set. However, when I shrink the page, the image shrinks but the divs within the main div go into the white space. Does anyone know a way to shrink the children divs so it stays within the parent? Also, when the page is full, I want it to show the whole photo and not just the top half. Any suggestions? :smile:
https://codepen.io/zlupshaw/pen/BZLvrZ
Amit Patel
@AmitP88
Jun 23 2017 17:04
@eweiss17 hmmm, I can't figure out how to put the JSON data into the image tag: https://codepen.io/AmitP88/pen/oWVjqL?editors=1010
Eric Weiss
@eweiss17
Jun 23 2017 17:07
I got the icon
worked.PNG
I just manually put it in there, to see if it would work
so it looks like you can do the <img src"">
if you are able to pull the .png
you can just add attribute to img with that url
Amit Patel
@AmitP88
Jun 23 2017 17:08
@eweiss17 but I mean, would the icon change if the weather changes?
ahh
I see
Eric Weiss
@eweiss17
Jun 23 2017 17:09
well i know in my screenshot it is hardcoded
that was me just seeing if it displayed correctly
bharathbheemireddy
@bharath506315
Jun 23 2017 17:09
@eweiss17 yes it works with <img src="">
https://codepen.io/bharath506315/pen/OgjMYG
Eric Weiss
@eweiss17
Jun 23 2017 17:10
$("img").attr("src", urlFromJsonSource);
would be a way to do it
Amit Patel
@AmitP88
Jun 23 2017 17:10
@eweiss17 ah I see
how would I do that in vanilla JS?
Eric Weiss
@eweiss17
Jun 23 2017 17:12
document.getElementByClass("weather-icon").setAttribute("src", urlFromJsonSource);
Jorge
@flawedLogic506
Jun 23 2017 17:15
hey guys