These are chat archives for FreeCodeCamp/HelpFrontEnd

29th
Jun 2017
J.Chechelski
@SupaSaiyan
Jun 29 2017 00:00
@cyberpunk1971 check paths
Alex
@cyberpunk1971
Jun 29 2017 00:00
i do have it up on codepen, but haven't figured out how to have mulitple html windows up on codepen yet
yeah, i'm sure it's a targeting issue
@SupaSaiyan can you tell me how many "windows" i can have open on a pen, at a time?
or how to import files haha
J.Chechelski
@SupaSaiyan
Jun 29 2017 00:02
:D
you want use 'a href' to other one page on codepen?
Try code on your own IDE and check how works <a href
Alex
@cyberpunk1971
Jun 29 2017 00:04
well, i'd like to be able to navigate the site that is displayed below the windows, as it stands it's just one page but i'd like to link a start page with a logo that takes the user to the contact page
and, the funny thing is, i had it that way before but deleted all that code i had written and now I can't get it to work again baaaahahhhhhhhhhhhhhhhhh
aichellie
@aichellie
Jun 29 2017 00:05
@gpiliponyte Right now I have the API request inside the geolocation function, is that necessary? Do I need to do everything related to the API request inside of it or can I do things outside after I've gained access to the object? For example changing the background
Alex
@cyberpunk1971
Jun 29 2017 00:05
@SupaSaiyan three windows up on my pen are html, css, and js.
J.Chechelski
@SupaSaiyan
Jun 29 2017 00:06
Ouch ok
Alex
@cyberpunk1971
Jun 29 2017 00:06
can i have more than three windows up? i tried changing the js window but it stays js
J.Chechelski
@SupaSaiyan
Jun 29 2017 00:06
correct :)
I rarely use codepen but I think you don’t need more windows to code :D
read about one page websites
and try to code simple page
pics aren't loaded
but gives the general look of page
Greta Piliponytė
@gpiliponyte
Jun 29 2017 00:10
@aichellie no, you can handle that wherever you like. I recommend assigning the json object to a global variable. That way you will be able to use it's fields wherever whenever you like
@gpiliponyte btw is it working now?
aichellie
@aichellie
Jun 29 2017 00:11
@gpiliponyte like var json={}; (as an empty object?)
Greta Piliponytė
@gpiliponyte
Jun 29 2017 00:12
var json1;

$.getJSON( link , function( json ) {

json1 = json; }

@aichellie
aichellie
@aichellie
Jun 29 2017 00:15
okay, so I don't have to set it to anything first :)
thanks @gpiliponyte
CamperBot
@camperbot
Jun 29 2017 00:15
aichellie sends brownie points to @gpiliponyte :sparkles: :thumbsup: :sparkles:
:cookie: 285 | @gpiliponyte |http://www.freecodecamp.com/gpiliponyte
Gulsvi
@gulsvi
Jun 29 2017 00:15
@gpiliponyte @aichellie It isn't possible to assign the value returned from an asynchronous method to a global variable.
You will have to pass the values you obtain inside your getJSON to another function instead
aichellie
@aichellie
Jun 29 2017 00:16
@SkyC0der do I need to do this like a callback function?
dorealex
@dorealex
Jun 29 2017 00:16
yup
Gulsvi
@gulsvi
Jun 29 2017 00:17
@aichellie The function(json) portion of your getJSON is a callback function. You just need to send the data you get back to another function if you want to use it elsewhere in your code.
Greta Piliponytė
@gpiliponyte
Jun 29 2017 00:17
@SkyC0der and yet I did an it's working pretty fine?
Gulsvi
@gulsvi
Jun 29 2017 00:17
like:
$.getJSON(link, function(json) {
  showTheWeather(json);
});

function showTheWeather(json) {
  console.log(json.currently);
}
@gpiliponyte May I see how you did it?
Greta Piliponytė
@gpiliponyte
Jun 29 2017 00:18
alright, beware, the pen is under construction
dorealex
@dorealex
Jun 29 2017 00:18
maybe you coaxed it into being synchronous
Gulsvi
@gulsvi
Jun 29 2017 00:18
I'm assuming you are recommending this, but it returns undefined
var json1;
$.getJSON(link, function(json) {
  json1 = json;
});

console.log(json1); // undefined
Greta Piliponytė
@gpiliponyte
Jun 29 2017 00:18
aichellie
@aichellie
Jun 29 2017 00:19
@SkyC0der so what is the first part doing? making a new function? variable?
$.getJSON(link, function(json) {
  showTheWeather(json);
});
Clarice
@NinjaPlease84
Jun 29 2017 00:19

I am trying to get my input border rounded on the right side to 25px top and bottom but it isn't showing when I put in the css.

header input {
width:100%;
height:50%;
float:left;
color:#fff;
background:rgba(255,255,255,0.2);
border-top-left-radius:5px;
border-bottom-left-radius:5px;
border-top-right-radius:25px;
border-bottom-right-radius:25px;
border:0px;
box-shadow:none;
outline:none;

Gulsvi
@gulsvi
Jun 29 2017 00:20
@gpiliponyte Now, in your code, try to log tempSI somewhere outside of your getJSON function.
You will see it returns undefined
Pagnito
@Pagnito
Jun 29 2017 00:20
@SkyC0der hey wutsup dude
Gulsvi
@gulsvi
Jun 29 2017 00:20
@aichellie Yes, that first part goes to the link, gets the data from the API and assigns that data to the json variable so it can be used inside that function(json) callback.
@Pagnito Hey!
Pagnito
@Pagnito
Jun 29 2017 00:21
@SkyC0der hows it goin
Gulsvi
@gulsvi
Jun 29 2017 00:21
Going okay, playing around with Alexa earlier today. Talking to a computer all day lol
Pagnito
@Pagnito
Jun 29 2017 00:21
@SkyC0der lol
whos elxa
alexa*
Gulsvi
@gulsvi
Jun 29 2017 00:21
Amazon Alexa
Pagnito
@Pagnito
Jun 29 2017 00:21
amazon alexa?
Greta Piliponytė
@gpiliponyte
Jun 29 2017 00:22
@SkyC0der but I am using tempSI in another function...
Gulsvi
@gulsvi
Jun 29 2017 00:22
A speech recognition device
Pagnito
@Pagnito
Jun 29 2017 00:22
ooh
@SkyC0der did u already finish the 13 exercises for learnyounode?
Gulsvi
@gulsvi
Jun 29 2017 00:24
@Pagnito I did those a while ago
Clarice
@NinjaPlease84
Jun 29 2017 00:25
I seriously cannot see where I went wrong. It just doesn't show up in my code pen when I save/run it. Any ideas as to why? Anybody?
dorealex
@dorealex
Jun 29 2017 00:25
alight, I think I am done playing with my twitch streamer pen...
https://codepen.io/dorealex/full/PjOVaX/
Pagnito
@Pagnito
Jun 29 2017 00:26
@SkyC0der do u remember the making module part?
Gulsvi
@gulsvi
Jun 29 2017 00:26

@gpiliponyte Try this:

    $.getJSON(link, function(json) {
      tempSI = Math.floor(json.currently.temperature) + "°C ";
    });
    console.log("the tempSI variable is: " + tempSI);

It will log: "the tempSI variable is: undefined"

@Pagnito Yep
Kind of confusing to be honest
Greta Piliponytė
@gpiliponyte
Jun 29 2017 00:28
@SkyC0der alright, so what do I do to make it correct
aichellie
@aichellie
Jun 29 2017 00:29
Can somebody check this? It's inside my geolocation function right now, which is why the position.coords.longitude is there - not sure if that's right either
$.getJSON("https://api.darksky.net/forecast/key/"+ position.coords.latitude+","+position.coords.longitude+"?exclude=[minutely,hourly,daily,alerts,flags]&units=[si]", function(json){
              });
  });
Gulsvi
@gulsvi
Jun 29 2017 00:30
@gpiliponyte Usually it's easiest to send the information as an argument to another function where it will be used
Greta Piliponytė
@gpiliponyte
Jun 29 2017 00:31
and if I assigned the json to a variable there, would it still be undefined?
Gulsvi
@gulsvi
Jun 29 2017 00:32
Like this:
function getTheWeather(link) {
  $.getJSON(link, function(json) {
    showTheWeather(json);
  });
}

function showTheWeather(json) {
  var tempSI = Math.floor(json.currently.temperature) + "°C ";
  // do something with the rest of the JSON
}
This way, you are sending the data to the function that needs it after it is received by getJSON
@aichellie I don't think you want the brackets there [] in your URL
aichellie
@aichellie
Jun 29 2017 00:33
hmmm
Gulsvi
@gulsvi
Jun 29 2017 00:33
and you'll need to add &callback=? to the end or you will get Cross Origin errors
aichellie
@aichellie
Jun 29 2017 00:34
also I'm not sure how to get the longitude and latitude out of there if I were to take it out of the geolocation function
Clarice
@NinjaPlease84
Jun 29 2017 00:34

I am trying to get my input border rounded on the right side to 25px top and bottom but it isn't showing when I click run/save. Any ideas why not?

header input {
width:100%;
height:50%;
float:left;
color:#fff;
background:rgba(255,255,255,0.2);
border-top-left-radius:5px;
border-bottom-left-radius:5px;
border-top-right-radius:25px;
border-bottom-right-radius:25px;
border:0px;
box-shadow:none;
outline:none;

aichellie
@aichellie
Jun 29 2017 00:35
for darksky does the query go directly after the longitude? eg longitude?units=si
Gulsvi
@gulsvi
Jun 29 2017 00:35
Yes, latitude, longitude
aichellie
@aichellie
Jun 29 2017 00:36
I mean, can I set it to a global function or something?
how to access the results of geolocation outside the geolocation function
Gulsvi
@gulsvi
Jun 29 2017 00:38
@aichellie Like:
  navigator.geolocation.getCurrentPosition(function(position) {
    getTheWeather(position);
  });
Then you make a function getTheWeather(position) where you use position.coords.latitude in your URL for your getJSON
Clarice
@NinjaPlease84
Jun 29 2017 00:39
https://codepen.io/NinjaPlease84/project/editor/AKKoLm/ why does the input not round off to 25px top and bottom?
on the right side
aichellie
@aichellie
Jun 29 2017 00:39
D: I'm not sure how that works...
Gulsvi
@gulsvi
Jun 29 2017 00:40
if (navigator.geolocation) {
  navigator.geolocation.getCurrentPosition(function(position) {
    var location = position.coords.latitude + ',' + position.coords.longitude;
    getTheWeather(location);
  });
}

function getTheWeather(position) {
  $.getJSON(website + location + query + '&callback=?', function(json) {
    showTheWeather(json);
  });
}
^^ Like that, as an example, if it's clearer
Notice how we just pass data from one place to another?
aichellie
@aichellie
Jun 29 2017 00:41
mm, not used to it yet
Gulsvi
@gulsvi
Jun 29 2017 00:42
That link is a refresher on how to pass values to functions with arguments
aichellie
@aichellie
Jun 29 2017 00:43

the part where you're using

showTheWeather(json);

is what I'm not used to

and getTheWeather(location)
Gulsvi
@gulsvi
Jun 29 2017 00:44
@aichellie This is a simpler example:
sayHello('Hello!')

function sayHello(text) {
  console.log(text);  // Hello!
}
aichellie
@aichellie
Jun 29 2017 00:45
but why is sayHello('Hello!') there?
hmmmmmmmmm....
Gulsvi
@gulsvi
Jun 29 2017 00:46
Because it calls the sayHello() function - and tells it to say 'Hello!'
if you put sayHello('How are you?!') it would log "How are you?!"
aichellie
@aichellie
Jun 29 2017 00:46
so it's being called before it's defined?
Gulsvi
@gulsvi
Jun 29 2017 00:47
You can do it this way too:
function sayHello(text) {
  console.log(text);  // Hello!
}

sayHello('Hello!')
aichellie
@aichellie
Jun 29 2017 00:47
this makes so much more sense to me lol
Henry
@ThisDudeHenry
Jun 29 2017 00:47
How can I implement https://www.w3schools.com/howto/howto_css_modal_images.asp modal in boot strap 4?
is that something that I would just have to wait for?
Gulsvi
@gulsvi
Jun 29 2017 00:47
You only need to do it that way if you use var to define the function
var sayHello = function(text) {
  console.log(text);  // How are you?
};

sayHello('Hello!');
Clarice
@NinjaPlease84
Jun 29 2017 00:49
Hmmmm anybody?
Henry
@ThisDudeHenry
Jun 29 2017 00:49
the only thing that doesnt work in 4 but works in 3 is the little x on the side it doesnt show up
iso
@iso1048
Jun 29 2017 00:49
@NinjaPlease84 sorry i do not know how to solve your problem. But could you help me out please? I cannot seem to link my stylesheet to the html. (The link to the font awesome is working but the link below that is not).
image.png
Gulsvi
@gulsvi
Jun 29 2017 00:49
@MrHenriA They are documented here: https://v4-alpha.getbootstrap.com/components/modal/
aichellie
@aichellie
Jun 29 2017 00:50
okay, I will try
Henry
@ThisDudeHenry
Jun 29 2017 00:50
@SkyC0der guess i just have to swap the code around then?
@gothamknight you need the font in a folder
Gulsvi
@gulsvi
Jun 29 2017 00:50
@MrHenriA I forget how it is different, but they have the sample code you need to use
Henry
@ThisDudeHenry
Jun 29 2017 00:50
and call the font @gothamknight
Gulsvi
@gulsvi
Jun 29 2017 00:51
<div class="modal fade">
  <div class="modal-dialog" role="document">
    <div class="modal-content">
      <div class="modal-header">
        <h5 class="modal-title">Modal title</h5>
        <button type="button" class="close" data-dismiss="modal" aria-label="Close">
          <span aria-hidden="true">&times;</span>
        </button>
      </div>
      <div class="modal-body">
        <p>Modal body text goes here.</p>
      </div>
      <div class="modal-footer">
        <button type="button" class="btn btn-primary">Save changes</button>
        <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
      </div>
    </div>
  </div>
</div
A few new classes it seems
Henry
@ThisDudeHenry
Jun 29 2017 00:51
or cdn @gothamknight <link href=' http://fonts.googleapis.com/css?family=Droid+Sans' rel='stylesheet' type='text/css'>
oh I see what youre saying! thanks @SkyC0der
CamperBot
@camperbot
Jun 29 2017 00:52
mrhenria sends brownie points to @skyc0der :sparkles: :thumbsup: :sparkles:
:star2: 1869 | @skyc0der |http://www.freecodecamp.com/skyc0der
Amit Patel
@AmitP88
Jun 29 2017 00:52

hey guys, I'm trying to solve the Sum All Numbers in a Range algorithm and I'm not sure if I'm thinking about this right. Here's my attempted solution: function sumAll(arr) {

var total = arr.reduce(function(a, b) {

for (var i = Math.min(a,b); i <= Math.max(a,b); i++){

 return i;      

}

});

return total;
}

sumAll([1, 4]);

Henry
@ThisDudeHenry
Jun 29 2017 00:52
oh haha @gothamknight I didnt even see you were using codepen sorry
Clarice
@NinjaPlease84
Jun 29 2017 00:52
@gothamknight I am not sure. I am pretty sure when I started this project the files html, css, and js files were already linked for me.
iso
@iso1048
Jun 29 2017 00:52
@MrHenriA do I need to do that even though the font awesome is loading onto the html?
Gulsvi
@gulsvi
Jun 29 2017 00:52
@NinjaPlease84 It seems to be rounding off for me, but it is almost off the edge of the screen
Henry
@ThisDudeHenry
Jun 29 2017 00:52
sorry ! i didnt see your editor!
@NinjaPlease84 i agree they have a few built in stuff for you , just try using the font?
iso
@iso1048
Jun 29 2017 00:53
@MrHenriA haha no worries
Gulsvi
@gulsvi
Jun 29 2017 00:54
@NinjaPlease84 Make your input less than 100% wide and you will see they are rounded by 25px
iso
@iso1048
Jun 29 2017 00:56
@SkyC0der I cannot seem to link my stylesheet to the html. (The link to the font awesome is working but the link below that is not). any ideas?
Clarice
@NinjaPlease84
Jun 29 2017 00:56
That did it! @SkyC0der Much appreciated <3
Gulsvi
@gulsvi
Jun 29 2017 00:56
@AmitP88 Interesting approach :) when you return inside a for loo though, it exits the for loop on the first loop
iso
@iso1048
Jun 29 2017 00:56
image.png
Gulsvi
@gulsvi
Jun 29 2017 00:56
No problem @NinjaPlease84 ! :)
iso
@iso1048
Jun 29 2017 00:56
@SkyC0der the screenshot is above
Gulsvi
@gulsvi
Jun 29 2017 00:57
The link to font awesome cannot be working :)
You're telling it to look here for that .css file:
https://codepen.io/gothamknight/project/editor/AyBKEz/path/to/font-awesome/css/font-awesome.min.css
iso
@iso1048
Jun 29 2017 00:58
@SkyC0der i dont get it. t shows up though on the html.
image.png
Gulsvi
@gulsvi
Jun 29 2017 00:59
I haven't worked with projects, have you maybe added it somewhere else?
iso
@iso1048
Jun 29 2017 00:59
@SkyC0der oh i have it in the script
is it ok then to just remove the link?
Amit Patel
@AmitP88
Jun 29 2017 00:59
@SkyC0der thanks. Yeah, after writing the conditions of the for loop, I got kinda lost on what my return statement within that loop should be =P
CamperBot
@camperbot
Jun 29 2017 00:59
amitp88 sends brownie points to @skyc0der :sparkles: :thumbsup: :sparkles:
:star2: 1870 | @skyc0der |http://www.freecodecamp.com/skyc0der
Baibhav Gautam
@baibhavx
Jun 29 2017 00:59
@baibhavx
Hey guys I am almost done with TicTacToe AI logic. Please help me test it and let me know if you can beat it(you shouldn't be able to) as I am still testing. Any feedback/suggestions appreciated :)
https://codepen.io/baibhavx/full/wePJdp/
Gulsvi
@gulsvi
Jun 29 2017 01:00
@gothamknight Yes, you can remove that .css link. If you open your browser's debug console, you will see it is causing an error:
font-awesome.min.css Failed to load resource: the server responded with a status of 404 ()
@gothamknight For your home.css file, try ../css/home.css
<link rel="stylesheet" href="../css/home.css" type="text/css">
Greta Piliponytė
@gpiliponyte
Jun 29 2017 01:02
@SkyC0der it's me who asked you about the whole json thing... I was wondering how to pass the api arguments to the $(document).ready function so that I could display data on button click
Gulsvi
@gulsvi
Jun 29 2017 01:04
@gpiliponyte The click functions should go outside of the document.ready - in their own function
iso
@iso1048
Jun 29 2017 01:04
@SkyC0der yeah that worked? How? Also, do you know how to load bootstrap (version 4) onto projects? (i am still new to projects).
Ravi Kishore Thella
@ravikishorethella
Jun 29 2017 01:04
blob
@baibhavx I bet it
Gulsvi
@gulsvi
Jun 29 2017 01:04
Your document.ready will only need one thing in it - a call to get the location @gpiliponyte
Ravi Kishore Thella
@ravikishorethella
Jun 29 2017 01:04
This message was deleted
Baibhav Gautam
@baibhavx
Jun 29 2017 01:05
@ravikishorethella did you win?
Gulsvi
@gulsvi
Jun 29 2017 01:05
@gothamknight Look at your folder structure, you have your html files inside of a html folder and your css files in a css folder next to them.
So, your path has to go up and over one directory
I'm guessing you need to download bootstrap and put it in your CSS folder, or just link to it directly via CDN
Ravi Kishore Thella
@ravikishorethella
Jun 29 2017 01:05
@baibhavx man, there is a mistake, I won 4 games in a row
Baibhav Gautam
@baibhavx
Jun 29 2017 01:06
damn really
Ravi Kishore Thella
@ravikishorethella
Jun 29 2017 01:06
how can I show you?
1> select 0
2> keep your move in the box number 4
Baibhav Gautam
@baibhavx
Jun 29 2017 01:07
huh ?
ok
Ravi Kishore Thella
@ravikishorethella
Jun 29 2017 01:07
then 8
then 7
Baibhav Gautam
@baibhavx
Jun 29 2017 01:07
ok let me try that
Ravi Kishore Thella
@ravikishorethella
Jun 29 2017 01:07
then 1
Baibhav Gautam
@baibhavx
Jun 29 2017 01:09
@ravikishorethella Thanks I'll need to check whats going on
CamperBot
@camperbot
Jun 29 2017 01:09
baibhavx sends brownie points to @ravikishorethella :sparkles: :thumbsup: :sparkles:
:cookie: 881 | @ravikishorethella |http://www.freecodecamp.com/ravikishorethella
Baibhav Gautam
@baibhavx
Jun 29 2017 01:09
But i just won too lol
follwing your combination
Ravi Kishore Thella
@ravikishorethella
Jun 29 2017 01:09
@baibhavx :smile:
start in position 6 , 8, 9, 3
Baibhav Gautam
@baibhavx
Jun 29 2017 01:12
Thanks @ravikishorethella,
CamperBot
@camperbot
Jun 29 2017 01:12
:warning: baibhavx already gave ravikishorethella points
baibhavx sends brownie points to @ravikishorethella :sparkles: :thumbsup: :sparkles:
Ravi Kishore Thella
@ravikishorethella
Jun 29 2017 01:13
:+1:
iso
@iso1048
Jun 29 2017 01:17
@SkyC0der ok i managed to load bootstrap via cdn, but the html has features which i different compared to the pen i did. for example, some font colors are different, some columns are not aligned as desired and anchor elements still have underline when i hover over them. I remember you saying that I should chose between bootstrap and custom css (which i have not)....would that explain anything do you think?
@SkyC0der actually ignore that issue.
Gulsvi
@gulsvi
Jun 29 2017 01:22
@gothamknight There are two versions of bootstrap - make sure you link to the correct version. We learned version 3 in Free Code Camp.
iso
@iso1048
Jun 29 2017 01:23
@SkyC0der it was because I linked it after my stylesheet. Would you mind explaining why that makes a difference?
Gulsvi
@gulsvi
Jun 29 2017 01:25
@gothamknight If two stylesheets try to style the same element, the last one to load will typically win. There are some caveats - https://developer.mozilla.org/en-US/docs/Web/CSS/Specificity
In short: more specific rules override more general ones. Specificity is defined based on how many IDs, classes, and element names are involved, as well as whether the !important declaration was used. When multiple rules of the same "specificity level" exist, whichever one appears last wins.
@Pagnito Did you get the modules figured out?
iso
@iso1048
Jun 29 2017 01:27
@SkyC0der thanks for all the help.
CamperBot
@camperbot
Jun 29 2017 01:27
gothamknight sends brownie points to @skyc0der :sparkles: :thumbsup: :sparkles:
:star2: 1871 | @skyc0der |http://www.freecodecamp.com/skyc0der
Henry
@ThisDudeHenry
Jun 29 2017 01:39
still didnt work :worried:

was trying to implement the modal image pop out feature from boot strap 3 to 4 but no idea how to change it
https://www.w3schools.com/howto/howto_css_modal_images.asp
oh wait I think i have an idea

https://codepen.io/thisdudehenry/pen/BZmgvz

tried following https://v4-alpha.getbootstrap.com/components/modal/ and modifying stuff but didnt work

also tried messing with https://v4-alpha.getbootstrap.com/components/alerts/

So the CSS modal feature works in boot strap 3 , when put in boot strap 4 the (X) no longer shows
ive switched from span to button as explained in the boot strap 4 docs
KatSaldivar
@KatSaldivar
Jun 29 2017 01:44
My weather app used to work but now it doesn't. :(
Gulsvi
@gulsvi
Jun 29 2017 01:44
@MrHenriA The close button is hidden behind your navbar - remove position: absolute on your .close class and you'll be able to find and move it around better :). Also, on the <span> element do: data-dismiss="myModal" not data-dismiss="alert"
dorealex
@dorealex
Jun 29 2017 01:44
@KatSaldivar depending on your API and how many times you have accessed it, you may be at your daily limit
KatSaldivar
@KatSaldivar
Jun 29 2017 01:45
@dorealex I made it a month or so ago. It worked then, but now it isn't
dorealex
@dorealex
Jun 29 2017 01:45
@KatSaldivar maybe they modified the API, maybe what they used to send your page is structured in a different way now...
Gulsvi
@gulsvi
Jun 29 2017 01:46
Codepen requires HTTPS now @KatSaldivar, the APIs you use in your weather app don't support HTTPS. Unfortunately, you'll have to use different APIs to get it working again.
KatSaldivar
@KatSaldivar
Jun 29 2017 01:46
@SkyC0der ahh, makes sense. Thanks!
Gulsvi
@gulsvi
Jun 29 2017 01:47
Location: navigator.geolocation and https://ipinfo.io/json
Weather: Dark Sky, Apixu, and Weather Underground
Henry
@ThisDudeHenry
Jun 29 2017 01:47
@SkyC0der love you
@SkyC0der thank you
CamperBot
@camperbot
Jun 29 2017 01:47
mrhenria sends brownie points to @skyc0der :sparkles: :thumbsup: :sparkles:
:warning: mrhenria already gave skyc0der points
Gulsvi
@gulsvi
Jun 29 2017 01:47
:heart: :)
Henry
@ThisDudeHenry
Jun 29 2017 01:47
so position:absolute
eli5 difference between absolute and like relative
i understand absolute With absolute positioning, an element can be placed anywhere on a page
but why would it matter if you are giving it direction?
Gulsvi
@gulsvi
Jun 29 2017 01:50
with relative, it is positioned relative to where it would normally go. With absolute, it is positioned relative to it's first parent that's statically positioned.
Henry
@ThisDudeHenry
Jun 29 2017 01:50
Oh!
wish i could draw it out
Gulsvi
@gulsvi
Jun 29 2017 01:50
Normal = position: static
Henry
@ThisDudeHenry
Jun 29 2017 01:50
i think i can
Pagnito
@Pagnito
Jun 29 2017 01:51
@SkyC0der my bad, had to step away for a bit
nah i havent figured it out
its output is supposed to be some ext md files, but i never made any of those
Gulsvi
@gulsvi
Jun 29 2017 01:52
md files are markdown files - if you create a new repository in github, your readme will be a .md file
You write in those files pretty much the same as here in chat
Pagnito
@Pagnito
Jun 29 2017 01:53
hold on

this is my entry

var worker = require('./modular');

var callback = function(err, data){
  if(err){
    return console.log(err);
  }
  list.forEach(function(file){
      console.log(file)

  })
}
worker(process.argv[2], process.argv[3], callback);

and this is my module

var fs = require('fs');
var path = require('path');

module.exports = function(dirName, extName, callback)
 fs.readdir(dirName, function(err, list){
   if(err){
     return callback(err);
   }
  list.filter(function(file){
    return path.extname(file)==='.' + extName;
  })
 })
 }
Henry
@ThisDudeHenry
Jun 29 2017 01:54
ohhh so basically instead of having something up and left 100px it will be up and left 100px of the page isntead of the parent / div or w/e @SkyC0der ?
Gulsvi
@gulsvi
Jun 29 2017 01:54
Yeah @MrHenriA up and left from where it is without position: relative.
position: relative - relative to itself
position: absolute - relative to the container (if that container is position: static)
@Pagnito Looks like you're just missing the callback() function to send the results from list.filter() back
This is some of the weird callback syntax in node.js
Pagnito
@Pagnito
Jun 29 2017 01:59
hold on
Gulsvi
@gulsvi
Jun 29 2017 01:59

You basically just need:

  data = list.filter(function(file){
    return path.extname(file)==='.' + extName;
  })

  callback(err, data)

in your module

Pagnito
@Pagnito
Jun 29 2017 02:00
when i run in in the terminal
do i run node entry.js + arguments?
Gulsvi
@gulsvi
Jun 29 2017 02:01
you should just need to do javascripting verify program.js
Pagnito
@Pagnito
Jun 29 2017 02:02
it still fails
i know the filter exercies, filterd for certain extensions
Gulsvi
@gulsvi
Jun 29 2017 02:02
whoops, I meant learnyounode verify program.js
Pagnito
@Pagnito
Jun 29 2017 02:03
yea i did that
Gulsvi
@gulsvi
Jun 29 2017 02:03
hmmm, my code is pretty much the same, but different variable names
Pagnito
@Pagnito
Jun 29 2017 02:03
but this one i dont rly understand, it seems to do the same thing, except by importing a module function, am i right?
Gulsvi
@gulsvi
Jun 29 2017 02:03
Yeah, exactly
Pagnito
@Pagnito
Jun 29 2017 02:03
but it filters for md?
Gulsvi
@gulsvi
Jun 29 2017 02:03
correct
the exercise makes a bunch of files behind the scenes
Pagnito
@Pagnito
Jun 29 2017 02:04
but i never pass those arguments, how would it know to look for it
i passed directory and js in the filter exercise
Gulsvi
@gulsvi
Jun 29 2017 02:04
It would be hard to run this outside of the learnyounode workshop
Pagnito
@Pagnito
Jun 29 2017 02:05
did u have readme.md and changelog.md etc files in ur directory?
Gulsvi
@gulsvi
Jun 29 2017 02:05
Yeah, and licence.md
Pagnito
@Pagnito
Jun 29 2017 02:05
how?
i dont have it
Gulsvi
@gulsvi
Jun 29 2017 02:05
the workshop generates them in a temp directory
then sends those as arguments to your program.js file
Pagnito
@Pagnito
Jun 29 2017 02:06
do i type in process.argv to make them
Gulsvi
@gulsvi
Jun 29 2017 02:06
no, you only should make two files - a module.js and program.js
Pagnito
@Pagnito
Jun 29 2017 02:07
mines are called, modular.js and entry.js
but i dont think that should matter right?
Gulsvi
@gulsvi
Jun 29 2017 02:07
In your case, a modular.js and entry.js then
names don't matter, correct
Pagnito
@Pagnito
Jun 29 2017 02:07
but it never made those other files
Gulsvi
@gulsvi
Jun 29 2017 02:07
so, try learnyounode run entry.js
see what happens - run is for debugging
it should list out what it filters - give back your data - or an error
Pagnito
@Pagnito
Jun 29 2017 02:08

Submission results did not match expected!

Did not use an additional module file, you must require() a module to help
solve this exercise

FAIL Your solution to MAKE IT MODULAR didn't pass. Try again!

─────────────────────────────────────────────────────────────────────────────

» To print these instructions again, run: learnyounode print
» To execute your program in a test environment, run: learnyounode run
program.js
» To verify your program, run: learnyounode verify program.js
» For help run: learnyounode help

Pavels-MacBook-Pro:modular pavelyeganov$ learnyounode run entry.js
/Users/pavelyeganov/javascripting/modular/modular.js:5
fs.readdir(dirName, function(err, list){
^^
SyntaxError: Unexpected identifier
at createScript (vm.js:56:10)
at Object.runInThisContext (vm.js:97:10)
at Module._compile (module.js:542:28)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)
at Module.require (module.js:497:17)
at require (internal/module.js:20:19)
at Object.<anonymous> (/Users/pavelyeganov/javascripting/modular/entry.js:1:76)

Gulsvi
@gulsvi
Jun 29 2017 02:09
hmmmm, maybe do this for your entry.js:
var worker = require('./modular.js');
or rename it to module.js so it isn't the same name as a directory
Pagnito
@Pagnito
Jun 29 2017 02:09
just tried, still doesnt work
Gulsvi
@gulsvi
Jun 29 2017 02:10
I'm guessing it's confusing the modular directory the modular file
Pagnito
@Pagnito
Jun 29 2017 02:10
weird, the guy doing it on youtube has em in the same dir too
renamed it to module.js and still
i was missing a '{'
module.exports = function(dirName, extName, callback){
but now it says list is not defined
Gulsvi
@gulsvi
Jun 29 2017 02:13
Should be data instead of list?
Pagnito
@Pagnito
Jun 29 2017 02:13
its a variable tho?
hold on tho ill try
Gulsvi
@gulsvi
Jun 29 2017 02:14

This is my module:

var fs = require('fs'),
    path = require('path');

module.exports = function (folder, ext, callback) {
  fs.readdir(folder, function (err, data) {
    if (err) return callback(err);
    list = data.filter(function (file) {
      return path.extname(file) === '.' + ext;
    });

    callback(err, list);
  });
};

And my entry.js:

var mymodule = require('./module.js');

mymodule(process.argv[2], process.argv[3], function (err, files) {
  if (err) return err;
  files.forEach(function (file) {
    console.log(file);
  });
});

Basically the same as you, but different variables

And I like how you defined callback separately
Shouldn't affect it tho
Pagnito
@Pagnito
Jun 29 2017 02:19
where did u define files tho?
Gulsvi
@gulsvi
Jun 29 2017 02:19
They're passed in as arguments to entry.js by the learnyounode workshop
Pagnito
@Pagnito
Jun 29 2017 02:21
how come ur not using list.forEach
isnt that the filtered array
Gulsvi
@gulsvi
Jun 29 2017 02:21
I should probably change that - it is confusing
the module does callback(err, list)
Pagnito
@Pagnito
Jun 29 2017 02:23
k got it to work
i made a mistake with a the variables a bit
Gulsvi
@gulsvi
Jun 29 2017 02:23
:sweat_smile:
Pagnito
@Pagnito
Jun 29 2017 02:23
hehe
thanks, ur example def helpe
Gulsvi
@gulsvi
Jun 29 2017 02:24
You basically had it - just some of the names were different
I don't know it well enough to see a lightbulb go off yet
Pagnito
@Pagnito
Jun 29 2017 02:25
i feel u
Gulsvi
@gulsvi
Jun 29 2017 02:25
The next few were a pain lol
Benny
@BenYoshi
Jun 29 2017 02:25
how do you get your current city. I'm asking because right now I only have the longitude/latitude and darksky doesn't give the current location?
for the weather app btw
Gulsvi
@gulsvi
Jun 29 2017 02:25
I knew the concepts, but that extra 10% of difference between regular js and node.js made it hard
@BenYoshi A lot of people use the google maps API
https://maps.googleapis.com/maps/api/geocode/json?latlng=" + coords
Benny
@BenYoshi
Jun 29 2017 02:28
thanks @SkyC0der :)
CamperBot
@camperbot
Jun 29 2017 02:28
benyoshi sends brownie points to @skyc0der :sparkles: :thumbsup: :sparkles:
:star2: 1872 | @skyc0der |http://www.freecodecamp.com/skyc0der
Benny
@BenYoshi
Jun 29 2017 02:29
i figured there was something I was missing from geolocation
Pagnito
@Pagnito
Jun 29 2017 02:30
@SkyC0der shit haha, im glad tho these exerices were made, learning it without them would be even a bigger pain in the ass
Marie Salad
@marieensalada
Jun 29 2017 02:30
hello! decided to stay on my tribute page and play with some styling.. i need help though.. i cant seem to find what im looking for online.. is it possible to put two elements in one border? if so how.
http://cdpn.io/v/YQxPBv i want to put 'Hope Outdoor Gallery' & 'Austin, TX' in one border
Gulsvi
@gulsvi
Jun 29 2017 02:30
@Pagnito haha very true!

@marieensalada Put your two elements inside the same <div> and use the border on that div.

  <div class="double-border">
    <h1>Hope Outdoor Gallery</h1>
    <h2>Austin,Tx</h2>
  </div>

In your css, you would then do:

.double-border {
  border: double;
}

You can add margins to make it so the border doesn't touch the bottom/top/sides of the screen

Ccs99817
@ccs99817
Jun 29 2017 02:33
I am making a random quote machine
I don't know what's wrong when I click the button, nothing is shown.
https://codepen.io/ccs99817/pen/qjpMPe
Gulsvi
@gulsvi
Jun 29 2017 02:35
@ccs99817 You're hitting a cross origin error - it's really common with APIs and happens when you try to request data from another server.
With that API, you have to use format=jsonp and add jsonp=? if you use it in an anonymous callback function, like your function(data)
Ccs99817
@ccs99817
Jun 29 2017 02:36
So, how can i fix it? @SkyC0der
Gulsvi
@gulsvi
Jun 29 2017 02:36
so: https://api.forismatic.com/api/1.0/?method=getQuote&lang=en&format=jsonp&jsonp=?
Ccs99817
@ccs99817
Jun 29 2017 02:36
use jsonp instead of json?
Gulsvi
@gulsvi
Jun 29 2017 02:37
yes
Ccs99817
@ccs99817
Jun 29 2017 02:37
Then, do i need to modify the way i use the JSONP?
Gulsvi
@gulsvi
Jun 29 2017 02:37
JSONP is what we use to work around cross origin issues, it runs the code locally from your page, rather than on the remote server
You don't have the change the way you parse the data
CallMeOrange
@EgnaroDev
Jun 29 2017 02:38
:wave:
Ccs99817
@ccs99817
Jun 29 2017 02:39
@SkyC0der It really works. HAHA Thx a lot. I thought there were typo.
CamperBot
@camperbot
Jun 29 2017 02:39
ccs99817 sends brownie points to @skyc0der :sparkles: :thumbsup: :sparkles:
:star2: 1873 | @skyc0der |http://www.freecodecamp.com/skyc0der
Gulsvi
@gulsvi
Jun 29 2017 02:39
You'll get to learn more about it in the weather project too :)
Hello @MCTwoDigitZero
Did you get your factorials working?
CallMeOrange
@EgnaroDev
Jun 29 2017 02:39
Nope
Marie Salad
@marieensalada
Jun 29 2017 02:39
@SkyC0der thank you kindly!!!
CamperBot
@camperbot
Jun 29 2017 02:39
marieensalada sends brownie points to @skyc0der :sparkles: :thumbsup: :sparkles:
:star2: 1874 | @skyc0der |http://www.freecodecamp.com/skyc0der
CallMeOrange
@EgnaroDev
Jun 29 2017 02:39
I gave up then looked up for a solution
Gulsvi
@gulsvi
Jun 29 2017 02:40
@marieensalada Hope it helped! You're welcome
@MCTwoDigitZero I think you need to know algebra pretty well to get it working
CallMeOrange
@EgnaroDev
Jun 29 2017 02:40
@SkyC0der Im kidding lol
Gulsvi
@gulsvi
Jun 29 2017 02:40
answer = answer * i
Oh, lol....
CallMeOrange
@EgnaroDev
Jun 29 2017 02:40
I finished it and palidorime
lol Im actually good at algebra
function factorialize(num) {
  if (num === 0) {
return 1;
  }
  var answer = 1;
  for (var i = num; i > 1; i--) {

   answer *= i;
}
  return answer;
}

factorialize(5);
Gulsvi
@gulsvi
Jun 29 2017 02:41
Good job
CallMeOrange
@EgnaroDev
Jun 29 2017 02:42
I did it similar again and again..
like num instead of i
Gulsvi
@gulsvi
Jun 29 2017 02:42
It's the same way I did it
CallMeOrange
@EgnaroDev
Jun 29 2017 02:42
I see
Gulsvi
@gulsvi
Jun 29 2017 02:42
I also checked for negative numbers
CallMeOrange
@EgnaroDev
Jun 29 2017 02:42
how?
Gulsvi
@gulsvi
Jun 29 2017 02:43
less than or equal to 0 :)
CallMeOrange
@EgnaroDev
Jun 29 2017 02:43
oh
Ken Haduch
@khaduch
Jun 29 2017 02:43
@GingerJava :point_up: June 28, 2017 4:32 PM - did you get help with this? I was away for quite a while... it looks like you had some additional posts and help after that original post that you tagged me in.
Gulsvi
@gulsvi
Jun 29 2017 02:43
Good question for your math teacher - what's the factorial of a negative number?
A man, a plan, a cam, a yak, a yam, a canal – Panama
CallMeOrange
@EgnaroDev
Jun 29 2017 02:44
wtf?
Gulsvi
@gulsvi
Jun 29 2017 02:45
a big palindrome lol
Ccs99817
@ccs99817
Jun 29 2017 02:45
@SkyC0der There is some meaningless thing needed to be removed. I need some clues.
How can I removed the "The undefined" in my quoteBox?
https://codepen.io/ccs99817/pen/qjpMPe
Ken Haduch
@khaduch
Jun 29 2017 02:45
@GingerJava - one comment is that your "credits" are somewhat hard to read against certain backgrounds - I think that I got the clear and sunny background and the background is very bright in that area, on a wide screen...
CallMeOrange
@EgnaroDev
Jun 29 2017 02:45
@SkyC0der wow that is amazing palindrome
I dont know how n! work with negative number
Gulsvi
@gulsvi
Jun 29 2017 02:46
most people say it is 1 but some people disagree
CallMeOrange
@EgnaroDev
Jun 29 2017 02:46
all negative number is 1?
I heard about it too
Gulsvi
@gulsvi
Jun 29 2017 02:47
@ccs99817 It's because you do this first:
var msg;
^^ That means that msg is undefined

Then, when you get the quote, you do:

msg += ....

So it adds undefined to your quote

CallMeOrange
@EgnaroDev
Jun 29 2017 02:48
Because of no assignment?
Gulsvi
@gulsvi
Jun 29 2017 02:48
Correct
CallMeOrange
@EgnaroDev
Jun 29 2017 02:48
lol did you think that Im him?
You responded too fast
Gulsvi
@gulsvi
Jun 29 2017 02:48
var msg;
msg += "hello"
console.log(msg) //undefinedhello
Ccs99817
@ccs99817
Jun 29 2017 02:49
lol
Gulsvi
@gulsvi
Jun 29 2017 02:49
No, I thought you were curious why that was happening, so I responded to you :)
CallMeOrange
@EgnaroDev
Jun 29 2017 02:49
I see
Ccs99817
@ccs99817
Jun 29 2017 02:49
THX you
@SkyC0der THX again
CamperBot
@camperbot
Jun 29 2017 02:49
:warning: ccs99817 already gave skyc0der points
ccs99817 sends brownie points to @skyc0der :sparkles: :thumbsup: :sparkles:
Gulsvi
@gulsvi
Jun 29 2017 02:49
Fun bug to find in your code :)
Happy to help
CallMeOrange
@EgnaroDev
Jun 29 2017 02:49
@SkyC0der To be honest I didnt know loop works like that until I used pythontutor
Like cycling
Gulsvi
@gulsvi
Jun 29 2017 02:50
I thought you knew about pythontutor
CallMeOrange
@EgnaroDev
Jun 29 2017 02:50
i did
not loop
Henry
@ThisDudeHenry
Jun 29 2017 02:50
@SkyC0der its coming along thank you https://codepen.io/thisdudehenry/pen/BZmgvz researching Jquery stuff now to prevent scroll when modal is open
CamperBot
@camperbot
Jun 29 2017 02:50
mrhenria sends brownie points to @skyc0der :sparkles: :thumbsup: :sparkles:
:star2: 1875 | @skyc0der |http://www.freecodecamp.com/skyc0der
CallMeOrange
@EgnaroDev
Jun 29 2017 02:50
Well I probably knew but I might've forgot about loop works like that
Gulsvi
@gulsvi
Jun 29 2017 02:51
@MrHenriA Looks really cool! I like it
@MrHenriA While you study jQuery, try to make it so the back button on the browser closes the modal instead of taking you away from your portfolio :)
Amit Patel
@AmitP88
Jun 29 2017 02:52

@SkyC0der hey Sky, um, I tried thinking about the algorithm I'm stuck on (Sum all numbers in a range), but I'm stuck on what action to put within my for-loop: function sumAll(arr) {

var total = arr.reduce(function(a, b) {

for (var i = Math.min(a,b); i <= Math.max(a,b); i++){

  var add = a + b;

}

});

return total;

}

sumAll([1, 4]);

@SkyC0der I feel like I'm close, but I just can't see what I'm missing
shivam gupta
@shivamg11000
Jun 29 2017 02:53
@AmitP88
```
Gulsvi
@gulsvi
Jun 29 2017 02:53
One of the issues is that .reduce() already loops for you
Amit Patel
@AmitP88
Jun 29 2017 02:53
@SkyC0der hmmm, so basically I have one extra loop?
Gulsvi
@gulsvi
Jun 29 2017 02:54
Try to use the for loop to create an array - and then use reduce to reduce that array, rather than trying to nest the loop inside the .reduce()
I think it ends up with exponential loops :)
I'm not 100% sure, but a good start for that exercise is to use your for() loop to create an array like [1,2,3,4]
once you can do that, you can then run reduce() on that array
Amit Patel
@AmitP88
Jun 29 2017 02:55
@SkyC0der so since we're already passing in the variable arr into the function, we can just define arr as our own array?
CallMeOrange
@EgnaroDev
Jun 29 2017 02:55
@SkyC0der so.. Im working on to find longest word in a string
Gulsvi
@gulsvi
Jun 29 2017 02:56
@AmitP88 try creating a new array first, before manipulating the one that they give you in the function
Amit Patel
@AmitP88
Jun 29 2017 02:57
@SkyC0der gotcha. I've noted your suggestion and gonna try it out right now
Gulsvi
@gulsvi
Jun 29 2017 02:58
Keep it simple - get the lowest value, get the highest value, then use those numbers for the start/stop in your loop. Math.max is going to need apply unless you use ES6
@MCTwoDigitZero That problem was really fun :)
longest word... I like the word and string problems
Amit Patel
@AmitP88
Jun 29 2017 02:59
@SkyC0der hmmm, would I create an empty array and then use a for loop to add items to the array?
Gulsvi
@gulsvi
Jun 29 2017 02:59
Yeah, that's a good way to start @AmitP88
Just my approach though - I optimize things later :p
Amit Patel
@AmitP88
Jun 29 2017 02:59
@SkyC0der ah I see :)
Gulsvi
@gulsvi
Jun 29 2017 02:59
see how to get it working, then see what corners I can cut
image.png
^^ not to that extent though... :)
iso
@iso1048
Jun 29 2017 03:01
@SkyC0der do i have to make the html page encoded in utf8 to solve the issue highlighted in the screenshot below?
image.png
Gulsvi
@gulsvi
Jun 29 2017 03:03
@gothamknight You may need to find the HTML Entity for that special character
Henry
@ThisDudeHenry
Jun 29 2017 03:04
@SkyC0der what do you do as a day job ? I know your night job is here lol
Gulsvi
@gulsvi
Jun 29 2017 03:05
I'm a student on summer break by day. play xbox and code :p
actually got to the gym today though...
@gothamknight I have no idea why that doesn't appear correctly - it may actually be an issue with your OS/language settings tbh
(crRNA)
^^ Does that look okay?
maybe if you copy it from a non-unicode file to your web page, the characters get corrupted
Ccs99817
@ccs99817
Jun 29 2017 03:10
How can I deal with the "unexpected identifier" in line 25?
https://codepen.io/ccs99817/pen/qjpMPe
It seems a minor mistake. But, I cannot solve it ==;
Gulsvi
@gulsvi
Jun 29 2017 03:11
Watson and Crick base pairing sounds awesome
@ccs99817 Keep track of your closing parentheses and brackets. } and )
I won't give the answer directly - you have less than 10 of them to look at. It's good practice for when your code gets longer :)
Ccs99817
@ccs99817
Jun 29 2017 03:14
@SkyC0der HAHA. I can DO it ><
Gulsvi
@gulsvi
Jun 29 2017 03:15
ᕙ(▀̿̿Ĺ̯̿̿▀̿ ̿) ᕗ
Amit Patel
@AmitP88
Jun 29 2017 03:15

@SkyC0der hey sky, um, I think I'm screwing up in my logic here: function sumAll(arr) {

var array = [];

var array_builder = (function () {

for (var i = Math.min(a,b); i <= Math.max(a,b); i++){

  var item = i.push(a,b);

  return item;

}

});

array_builder();

var total = arr.reduce(function(a, b) {

});

return total;

}

sumAll([1, 4]);

@SkyC0der I feel like my brain is slowly being cooked over this problem O_o
Gulsvi
@gulsvi
Jun 29 2017 03:17
@AmitP88 Math.min(a,b) is going to cause some problems
Amit Patel
@AmitP88
Jun 29 2017 03:18
@SkyC0der yeah, I noticed that. But, I don't know what to pass in there instead, since it needs two+ numbers to compare to find the min
Gulsvi
@gulsvi
Jun 29 2017 03:18
Or, you can use .apply()
There's also the spread operator and an example on MDN on how to use that with Math.max/min
Amit Patel
@AmitP88
Jun 29 2017 03:21
@SkyC0der ahhh I see now. hmmm, can't believe I missed that. I'll have to read the documentation thoroughly next time
Long Nguyen
@longnt80
Jun 29 2017 03:21
@SkyC0der that's not needed man. Too advanced for him right now
Gulsvi
@gulsvi
Jun 29 2017 03:21
Amit has done some freelancing
Just because it's ES6 doesn't mean it's advanced :)
But yeah, you could also just do "Is the first number in the array bigger than the last number? If so, it's the biggest, else smallest"
Long Nguyen
@longnt80
Jun 29 2017 03:25
@AmitP88 from the code you post above, you don't need an inner function
CallMeOrange
@EgnaroDev
Jun 29 2017 03:29
@SkyC0der Can you help me with finding longest word in string?
Gulsvi
@gulsvi
Jun 29 2017 03:29
Sure @MCTwoDigitZero
I have to log off in 20 minutes though
CallMeOrange
@EgnaroDev
Jun 29 2017 03:30
Alright

function findLongestWord(str) {
str = str.split(" ");
  return str.length;
}

findLongestWord("The quick brown fox jumped over the lazy dog");
Gulsvi
@gulsvi
Jun 29 2017 03:30
gf needs attention
CallMeOrange
@EgnaroDev
Jun 29 2017 03:30
lol You have a gf?
Gulsvi
@gulsvi
Jun 29 2017 03:30
yeah, she lives here with me
CallMeOrange
@EgnaroDev
Jun 29 2017 03:30
I see
Gulsvi
@gulsvi
Jun 29 2017 03:31
That code makes an array:
["The", "quick", "brown", "fox", "jumped", "over", "the", "lazy", "dog"]
CallMeOrange
@EgnaroDev
Jun 29 2017 03:31
Yeah
To split each word
Gulsvi
@gulsvi
Jun 29 2017 03:31
And then returns the length of the array
So, it tells you how many words are in the sentence
shivam gupta
@shivamg11000
Jun 29 2017 03:31
I am trying to learn promise
whats the error in this,
var url = endpoint+'freecodecamp'+cb;
$.getJSON(url)
.then(result => function(result){console.log(result);})
CallMeOrange
@EgnaroDev
Jun 29 2017 03:32
Oh I see
Perhaps I should use str.split(""): no space in it
Gulsvi
@gulsvi
Jun 29 2017 03:32
You're off to a good start
You just need to use a loop now and look at the length of each word
CallMeOrange
@EgnaroDev
Jun 29 2017 03:33
what about split method? str.split(" "); is ok?
Gulsvi
@gulsvi
Jun 29 2017 03:33
I think you just have to return the length not the word, right?
CallMeOrange
@EgnaroDev
Jun 29 2017 03:33
Yeah
To return the length of the word that is longest
KatSaldivar
@KatSaldivar
Jun 29 2017 03:34
Gulsvi
@gulsvi
Jun 29 2017 03:34
Yeah, so split up the sentence into words like you're doing, loop through and get the length of each word. Return the biggest number
CallMeOrange
@EgnaroDev
Jun 29 2017 03:34
ok, Im going to build a loop
thanks @SkyC0der
CamperBot
@camperbot
Jun 29 2017 03:34
mctwodigitzero sends brownie points to @skyc0der :sparkles: :thumbsup: :sparkles:
:star2: 1876 | @skyc0der |http://www.freecodecamp.com/skyc0der
CallMeOrange
@EgnaroDev
Jun 29 2017 03:34
Will work on that now
KatSaldivar
@KatSaldivar
Jun 29 2017 03:34
nvm, I figured it out.
@shivamg11000 thanks!
CamperBot
@camperbot
Jun 29 2017 03:35
:cookie: 329 | @shivamg11000 |http://www.freecodecamp.com/shivamg11000
katsaldivar sends brownie points to @shivamg11000 :sparkles: :thumbsup: :sparkles:
shivam gupta
@shivamg11000
Jun 29 2017 03:35
@SkyC0der
var url = endpoint+'freecodecamp'+cb;
$.getJSON(url)
.then(result => function(result){console.log(result);})
var url = endpoint+'freecodecamp'+cb;
$.getJSON(url)
.then(result => function(result){console.log(result);})
Gulsvi
@gulsvi
Jun 29 2017 03:36
The .then() won't run until the data comes back from the URL
shivam gupta
@shivamg11000
Jun 29 2017 03:36
when it will run then?
Gulsvi
@gulsvi
Jun 29 2017 03:37
It waits for the API to respond, then it runs. getJSON uses promise() under the hood
shivam gupta
@shivamg11000
Jun 29 2017 03:37
whats the correct way of writing it ?
Gulsvi
@gulsvi
Jun 29 2017 03:37
I'm guessing you want to get all the users at the same time?
CallMeOrange
@EgnaroDev
Jun 29 2017 03:38
I think im close, basically I just need to do something like this
shivam gupta
@shivamg11000
Jun 29 2017 03:38
nope just a single one this time
Gulsvi
@gulsvi
Jun 29 2017 03:38
Or, are you okay doing one at a time in a loop (not sure how advanced you want it to be)
CallMeOrange
@EgnaroDev
Jun 29 2017 03:38

function findLongestWord(str) {
str = str.split(" ");
for (var i = 0; i < str.length; i++) {
  console.log(str[i]);
  }
  return str[4].length;
}

findLongestWord("The quick brown fox jumped over the lazy dog");
shivam gupta
@shivamg11000
Jun 29 2017 03:38
only trying to learn promise
CallMeOrange
@EgnaroDev
Jun 29 2017 03:39
Coding on repl.it is great
Gulsvi
@gulsvi
Jun 29 2017 03:39
@shivamg11000 The easy way is to do this:
$.getJSON(url1, function(response1) {
  $.getJSON(url2, function(response2) {
    // here you can use response 1 and response 2 
  });
});
CallMeOrange
@EgnaroDev
Jun 29 2017 03:39
Easier to console.log loop
shivam gupta
@shivamg11000
Jun 29 2017 03:39
@SkyC0der I am only trying to learn promise
Gulsvi
@gulsvi
Jun 29 2017 03:41
@shivamg11000 Since getJSON does promise() under the hood, it isn't a great way to learn Promise(), but the pattern would look like:
function getUser(user) {
  var url = endpoint+ user +cb;
  return $.getJSON(url)
}

getUser('freecodecamp')
  .then(result => console.log(result))
CallMeOrange
@EgnaroDev
Jun 29 2017 03:41
If you want to learn promise, its too easy
Make a promise to someone then try not to break it
Right?
shivam gupta
@shivamg11000
Jun 29 2017 03:42
@MCTwoDigitZero Am trying ti learn since yesterday
Gulsvi
@gulsvi
Jun 29 2017 03:42

What you would do is push this:

getUser('freecodecamp').then(result => console.log(result))

Into an array - and have an array with all your users

then do promise.all(array)
CallMeOrange
@EgnaroDev
Jun 29 2017 03:43
@SkyC0der I made a loop to look each word but How do I find longest one?
Gulsvi
@gulsvi
Jun 29 2017 03:43
I learned promise() by doing the weather app again
function getLocation() {
  return new Promise((res, rej) => navigator.geolocation.getCurrentPosition(res, rej));
}
Then you can do something like:
getLocation()
  .catch(ipLocation)
  .then(parseCoords)
  .then(reverseGeocode)
  .then(getWeather)
  .then(showWeather)
  .then(showLocationData)
  .catch(console.error);
shivam gupta
@shivamg11000
Jun 29 2017 03:44
ok, great
Gulsvi
@gulsvi
Jun 29 2017 03:44
@MCTwoDigitZero Save the length of the word to a variable, but only overwrite the variable if the length is longer
CallMeOrange
@EgnaroDev
Jun 29 2017 03:45
Well I think I already save the length of the word to a variable
Gulsvi
@gulsvi
Jun 29 2017 03:47
Hmmm, maybe try to console.log?
CallMeOrange
@EgnaroDev
Jun 29 2017 03:48
hold on, I actually dont understand what you meant to save length of the word to a variable
function findLongestWord(str) {
str = str.split(" ");
for (var i = 0; i < str.length; i++) {
  var length = str[i];
  }
  return length;
}

findLongestWord("The quick brown fox jumped over the lazy dog");
Return just dog, because once loop end thats what it return
by length of the word, do you mean number of the word?
Gulsvi
@gulsvi
Jun 29 2017 03:49
add .length
yeah, like you use with str.length
CallMeOrange
@EgnaroDev
Jun 29 2017 03:49
Oh I see
Gulsvi
@gulsvi
Jun 29 2017 03:49
you need to do that for str[i].length to get the length of each word
CallMeOrange
@EgnaroDev
Jun 29 2017 03:49
Yeah done that
Forgot that Im working to return numbers not the word :/
Gulsvi
@gulsvi
Jun 29 2017 03:49
So, now it returns 3 (the length of dog)
CallMeOrange
@EgnaroDev
Jun 29 2017 03:49
Yeah
Gulsvi
@gulsvi
Jun 29 2017 03:50
The only logic you need now is to only update the length variable if str[i].length is bigger
CallMeOrange
@EgnaroDev
Jun 29 2017 03:50
If str[i].length is bigger than str.length?
Gulsvi
@gulsvi
Jun 29 2017 03:51
no, if it's bigger than what you already have saved to length
function findLongestWord(str) {
  str = str.split(" ");
  for (var i = 0; i < str.length; i++) {
    var length = str[i].length;
    console.log(length); // 3, 5, 5, 3, 6, 4, 3, 4, 3
  }
  return length;
}
CallMeOrange
@EgnaroDev
Jun 29 2017 03:51
oh I didnt know that..
Gulsvi
@gulsvi
Jun 29 2017 03:52
when you loop, it's going to look like that ^^
CallMeOrange
@EgnaroDev
Jun 29 2017 03:52
I see
Gulsvi
@gulsvi
Jun 29 2017 03:52
so, only update length if you get a bigger number
CallMeOrange
@EgnaroDev
Jun 29 2017 03:52
Create an if statement?
Gulsvi
@gulsvi
Jun 29 2017 03:52
Yes
The other way is to push all the lengths to an array and sort the array :)
other ways to do it too
CallMeOrange
@EgnaroDev
Jun 29 2017 03:53
oh right, sort method
I will use that way..
Gulsvi
@gulsvi
Jun 29 2017 03:54
remember though, .sort() doesn't work like you'd expect
CallMeOrange
@EgnaroDev
Jun 29 2017 03:54
Yeah.. that was unexpected
It doesn't work on an array?
Gulsvi
@gulsvi
Jun 29 2017 03:54
[1,2,3,20,4,50,6].sort() will give you 1,2,20,3,4,50,6
CallMeOrange
@EgnaroDev
Jun 29 2017 03:55
Yeah it sort by first digit only
So I can just return last number
remember though, .sort() doesn't work like you'd expect
Gulsvi
@gulsvi
Jun 29 2017 03:55
you need a compare function
CallMeOrange
@EgnaroDev
Jun 29 2017 03:55
Thought you meant something else..
compare function?
Gulsvi
@gulsvi
Jun 29 2017 03:56
Read the .sort() documents, it's one of the first things they talk about
CallMeOrange
@EgnaroDev
Jun 29 2017 03:56
Im reading it right now :p
Gulsvi
@gulsvi
Jun 29 2017 03:56

Syntax

arr.sort()
arr.sort(compareFunction)
:)
CallMeOrange
@EgnaroDev
Jun 29 2017 03:57
var numbers = [4, 2, 5, 1, 3];
numbers.sort(function(a, b) {
  return a - b;
});
console.log(numbers);

// [1, 2, 3, 4, 5]
Is that what you are talking about?
Gulsvi
@gulsvi
Jun 29 2017 03:57
Perfect :)
CallMeOrange
@EgnaroDev
Jun 29 2017 03:57
Compare function?
I see, will try that
I cant use it on a variable that contain i?
shivam gupta
@shivamg11000
Jun 29 2017 03:58
@SkyC0der hey ccheck this
function getLocation(){
  var lat ;
  var long;
  if(navigator.geolocation){
    navigator.geolocation.getCurrentPosition(function(pos){
      lat  = pos.coords.latitude;
      long = pos.coords.longitude;
      return [lat,long];
    });
  }
  else 
    console.log('Not supported');

}

getLocation()
.then(coords => print(coords))

function print(coord){
  console.log(coord);
}
CallMeOrange
@EgnaroDev
Jun 29 2017 03:59
length.sort(function(a,b) {
    return a - b;
  });
Gulsvi
@gulsvi
Jun 29 2017 03:59
Yeah, if length is an array
then you need to get the last element of the array
CallMeOrange
@EgnaroDev
Jun 29 2017 03:59
Yeah that doesn't work
length.sort is not a function
Gulsvi
@gulsvi
Jun 29 2017 03:59
did you .push() all the lengths to the length array?
CallMeOrange
@EgnaroDev
Jun 29 2017 03:59
I thought length is an array?
oh no, I didnt :/
Gulsvi
@gulsvi
Jun 29 2017 04:00
@shivamg11000 I don't think that will work - does it?
shivam gupta
@shivamg11000
Jun 29 2017 04:00
nope
CallMeOrange
@EgnaroDev
Jun 29 2017 04:01
function findLongestWord(str) {
str = str.split(" ");
for (var i = 0; i < str.length; i++) {
  var length = str[i].length;
  length = length.push(i);
  length.sort(function(a, b) {
    return a - b;
  });
  }

}

findLongestWord("The quick brown fox jumped over the lazy dog");
Gulsvi
@gulsvi
Jun 29 2017 04:01
You need a return value in the getLocation() function - and that should be new Promise() @shivamg11000
CallMeOrange
@EgnaroDev
Jun 29 2017 04:01
tried this
function findLongestWord(str) {
str = str.split(" ");
for (var i = 0; i < str.length; i++) {
  var length = [];
  length = length.push(i);
  }
  return length;

}

findLongestWord("The quick brown fox jumped over the lazy dog");
Gulsvi
@gulsvi
Jun 29 2017 04:01
@MCTwoDigitZero You'll need different variables for the array and the word lengths
and you don't push to an array like that
CallMeOrange
@EgnaroDev
Jun 29 2017 04:02
Right.. doesn't contain length
Gulsvi
@gulsvi
Jun 29 2017 04:02
If I have an array: arr = [1,2,3] and I want to add 4 to the end, I do arr.push(4)
CallMeOrange
@EgnaroDev
Jun 29 2017 04:03
Yeah
Gulsvi
@gulsvi
Jun 29 2017 04:03
not arr = arr.push(4)
CallMeOrange
@EgnaroDev
Jun 29 2017 04:03
oo
shivam gupta
@shivamg11000
Jun 29 2017 04:05
@SkyC0der how to make it work
CallMeOrange
@EgnaroDev
Jun 29 2017 04:05
function findLongestWord(str) {
str = str.split(" ");
for (var i = 0; i < str.length; i++) {
  var array = [];
  var length = str[i].length;
  array.push(length);
  }
  return length;

}

findLongestWord("The quick brown fox jumped over the lazy dog");
Gulsvi
@gulsvi
Jun 29 2017 04:07
@shivamg11000 like:
function getLocation() {
  return new Promise((res, rej) => {
    navigator.geolocation.getCurrentPosition(res, rej);
  });
}

getLocation().then(coords => print(coords)).catch(console.error);

function print(coord) {
  console.log(coord);
}
@MCTwoDigitZero Take var array = [] out of your for loop or you will make it empty on every loop
shivam gupta
@shivamg11000
Jun 29 2017 04:09
what res and rej in this @SkyC0der
Gulsvi
@gulsvi
Jun 29 2017 04:09
res = resolve (success)
rej = reject (error)
the .catch() method handles the errors
the .then() method handles the success
CallMeOrange
@EgnaroDev
Jun 29 2017 04:10
function findLongestWord(str) {
str = str.split(" ");
var array = [];
for (var i = 0; i <= str.length; i++) {
  var length = str[i];
  array.push(length);
  }
  return array.length;

}

findLongestWord("The quick brown fox jumped over the lazy dog");
Hard to push length of each word into an array..
Gulsvi
@gulsvi
Jun 29 2017 04:11
@MCTwoDigitZero Add a console.log to look at array before it is returned
CallMeOrange
@EgnaroDev
Jun 29 2017 04:11
ok
Gulsvi
@gulsvi
Jun 29 2017 04:11
you're missing a few things
CallMeOrange
@EgnaroDev
Jun 29 2017 04:11
oh at least I have an array
Are you talking about sort method?
Yeah I finally have an array of length of each word
Now Im going to use sort method then return last number of an array
Gulsvi
@gulsvi
Jun 29 2017 04:13
good progress
CallMeOrange
@EgnaroDev
Jun 29 2017 04:14
How do you return the number like the opposite of arr[0]
arr[-1]?
Dont tell me yet :/
Gulsvi
@gulsvi
Jun 29 2017 04:15
I won't :)
but I have to go.... :(
CallMeOrange
@EgnaroDev
Jun 29 2017 04:16
oh yeah slice method but Im not supposed to use it?
:/
@SkyC0der Alright thanks for getting me this far
CamperBot
@camperbot
Jun 29 2017 04:16
mctwodigitzero sends brownie points to @skyc0der :sparkles: :thumbsup: :sparkles:
:warning: mctwodigitzero already gave skyc0der points
KatSaldivar
@KatSaldivar
Jun 29 2017 04:17
anyone know of where I can find the list of possible weather descriptions for the weather underground api?
Gulsvi
@gulsvi
Jun 29 2017 04:17
No problem @MCTwoDigitZero Good luck
iso
@iso1048
Jun 29 2017 04:18
@SkyC0der "it may actually be an issue with your OS/language settings tbh." how do i change or even look at the language settings?
Ccs99817
@ccs99817
Jun 29 2017 04:23
@SkyC0der I have added a tweet button. I could added the button correctly. But, it doesn't direct to the twitter website. What's happened?
KatSaldivar
@KatSaldivar
Jun 29 2017 04:23
@aichellie It looks like that is for a different API. I'm using https://www.wunderground.com/weather/api/d/docs, not open weather map.
I just googled it
KatSaldivar
@KatSaldivar
Jun 29 2017 04:27
@aichellie Awesome! Thanks
CamperBot
@camperbot
Jun 29 2017 04:27
katsaldivar sends brownie points to @aichellie :sparkles: :thumbsup: :sparkles:
:cookie: 264 | @aichellie |http://www.freecodecamp.com/aichellie
ManOfUnknownNationality
@nhavar
Jun 29 2017 04:53
@ccs99817 It doesn't look like your tweet button is hooked to anything. If you use the anchor's href you need to have a valid url and a target attribute equal to "_blank" to get out of codepen and go to twitter. Otherwise you need an onclick that will similarly set the location.href to twitter.
Richard Sithole
@Sliqric7053
Jun 29 2017 05:19
Hi guys. I'm trying to find the most efficient way to convert a phone number in JS. The input is +2712345678 and output should be +27 12 234 5678. Any ideas?
Zhanibek
@zhann1982
Jun 29 2017 05:26
@Sliqric7053 I would try to convert it to string format then split and add spaces
shivam gupta
@shivamg11000
Jun 29 2017 05:27
@Sliqric7053 or you can use regex
var re = /.(\d\d)(\d\d)(\d\d\d)(\d\d\d\d)/;
var mo = re.exec(input);
Richard Sithole
@Sliqric7053
Jun 29 2017 05:33
I am leaning towards a regex solution..
shivam gupta
@shivamg11000
Jun 29 2017 05:34
@Sliqric7053
var input ='+2712345678';
var re = /.(\d{2})(\d{2})(\d{3})(\d{3})/;
var mo = re.exec(input);

console.log(mo
Richard Sithole
@Sliqric7053
Jun 29 2017 05:34
@shivamg11000 very succinct - I had this verbose solution in mind var x = '+2712345678'; x = '+' + x.replace(/[^\d]+/g, '') .replace(/(\d{2})(\d{2})(\d{3})/, '$1 $2 $3 ');
@shivamg11000 and @zhann1982 thank you for your responses - much appreciated!
CamperBot
@camperbot
Jun 29 2017 05:35
sliqric7053 sends brownie points to @shivamg11000 and @zhann1982 :sparkles: :thumbsup: :sparkles:
:cookie: 330 | @shivamg11000 |http://www.freecodecamp.com/shivamg11000
:cookie: 336 | @zhann1982 |http://www.freecodecamp.com/zhann1982
Baibhav Gautam
@baibhavx
Jun 29 2017 05:39
Hi guys I am testing my TicTacToe AI logic. Can you please help me by letting me know if you are able to win or the game breaks in the middle. Appreciate your help
https://codepen.io/baibhavx/full/wePJdp/
shivam gupta
@shivamg11000
Jun 29 2017 05:42
@baibhavx nope, working good
ManOfUnknownNationality
@nhavar
Jun 29 2017 05:43
I played several times through as O and it worked fine, a played once as X and then it started acting flaky, calling wins before they happened not playing the next O spot toward the end of a draw, etc.,.
Baibhav Gautam
@baibhavx
Jun 29 2017 05:43
Thanks @shivamg11000
CamperBot
@camperbot
Jun 29 2017 05:43
baibhavx sends brownie points to @shivamg11000 :sparkles: :thumbsup: :sparkles:
:cookie: 331 | @shivamg11000 |http://www.freecodecamp.com/shivamg11000
Baibhav Gautam
@baibhavx
Jun 29 2017 05:43
@nhavar , thanks for letting me know i'll see whats going on
CamperBot
@camperbot
Jun 29 2017 05:43
baibhavx sends brownie points to @nhavar :sparkles: :thumbsup: :sparkles:
:cookie: 41 | @nhavar |http://www.freecodecamp.com/nhavar
shivam gupta
@shivamg11000
Jun 29 2017 05:44
@baibhavx I go on ond on but I still lose
ManOfUnknownNationality
@nhavar
Jun 29 2017 05:44
@baibhavx Oops, just got it while play O's this time. Same behavior. Good luck.
Baibhav Gautam
@baibhavx
Jun 29 2017 05:45
damn ok I'll have to figure it out thanks so much
iso
@iso1048
Jun 29 2017 05:46
I keep getting this message: "This Project has no index.html. If you're the owner of this project, you'll need to add an index.html file at the root of the project, before seeing the project here" even though I do have an index.html file. does anyone have any ideas as to why i cannot go full page view? (i am using codepen).
kirbyedy
@kirbyedy
Jun 29 2017 05:47
I have no idea, but I have a question. Why are you creating a project and not just a pen ?
ManOfUnknownNationality
@nhavar
Jun 29 2017 05:47
@baibhavx you might look at the playerMove logic, since when it's the player's move or not is going to be determined by which option they chose X or O's then that variable might be different. But I didn't look to deeply
Sorry playerTurn
iso
@iso1048
Jun 29 2017 05:48
@kirbyedy trying to make a website. just to practice i guess.
kirbyedy
@kirbyedy
Jun 29 2017 05:49
ah ok
Baibhav Gautam
@baibhavx
Jun 29 2017 05:51
@nhavar i did playerTurn = true if player starts with O and playerTurn = false if player starts with X. and then I toggle in each move. I think it has something to do with available moves not being cleared after a move has been made
ManOfUnknownNationality
@nhavar
Jun 29 2017 05:59
@baibhavx unrelated tip - cache your jquery object the first time you call it i.e. function addTileListeners() { for(let i = 0; i < 9; i++) { let box = $(`#${i}`); box.click(function() { if(playerTurn && box.text() === '') { box.text(userMark).addClass('no-hover'); turn++; checkWin(); if(!isWon(getBoardArray())){ checkDraw(); } availableMoves.splice(availableMoves.indexOf(+i), 1); playerTurn = false; if(availableMoves.length > 0){ renderComputerMove(); } } }); } }
Baibhav Gautam
@baibhavx
Jun 29 2017 06:01
@nhavar never heard of anything like that. Can you please tell me why its useful?
or I'll just google it duh
ManOfUnknownNationality
@nhavar
Jun 29 2017 06:03
It speeds up your execution since you don't have to query the dom again. Dom queries can be slow sometimes.
I also put an example in there of chaining your jquery functions the box.text(userMark).addClass('no-hover') that way you don't have to keep repeating yourself once you already have a handle on the object you want to manipulate.
Baibhav Gautam
@baibhavx
Jun 29 2017 06:05
ohh i see what you're saying. No point in adding listeners after each game. Awesome advice! thanks
MarionUy
@MarionUy
Jun 29 2017 06:11
Hi guys, I'm currently using VS code as my editor for HTML and CSS, and after I run my files, the CSS seems to be not working. I think I properly linked my CSS to my HTML using the <link rel="stylesheet" type="txt/css" href="project.css">. I need your help.
ManOfUnknownNationality
@nhavar
Jun 29 2017 06:16
@MarionUy is the css in the same folder as your html?
MarionUy
@MarionUy
Jun 29 2017 06:16
yes @nhavar
ManOfUnknownNationality
@nhavar
Jun 29 2017 06:17
@MarionUy if so you might use href="./project.css", otherwise there might be some typo that could be keeping it from displaying properly (missing bracket or semi-colon)
MarionUy
@MarionUy
Jun 29 2017 06:21
@nhavar I tried adding ./ in my href value but the css still isn't working. And I checked if there are any typo errors, and there are none and thanks by the way
CamperBot
@camperbot
Jun 29 2017 06:21
marionuy sends brownie points to @nhavar :sparkles: :thumbsup: :sparkles:
:cookie: 42 | @nhavar |http://www.freecodecamp.com/nhavar
ManOfUnknownNationality
@nhavar
Jun 29 2017 06:23
@MarionUy np, so is none of your css applying at all? What browser are you using? and are you previewing directly off the filesystem or through a server like apache or express?
@MarionUy can you create a pen to show what your html and css look like? I might be able to help further that way.
MarionUy
@MarionUy
Jun 29 2017 06:27
@nhavar it worked on codepen https://codepen.io/MarionUy/pen/yXpGRR
but it didn't work on VS Code
Feedbacks welcome
Thanks.
shivam gupta
@shivamg11000
Jun 29 2017 06:29
@KshitijaaJaglan It a nice one
ManOfUnknownNationality
@nhavar
Jun 29 2017 06:29
@MarionUy I'm going to copy it to my VSCode and see what happens. Which version are you using?
Kshitijaa Jaglan
@KshitijaaJaglan
Jun 29 2017 06:29
thanks @shivamg11000
CamperBot
@camperbot
Jun 29 2017 06:29
kshitijaajaglan sends brownie points to @shivamg11000 :sparkles: :thumbsup: :sparkles:
:cookie: 332 | @shivamg11000 |http://www.freecodecamp.com/shivamg11000
MarionUy
@MarionUy
Jun 29 2017 06:34
@nhavar version 1.13.1 (May 2017 Update)
var myStr; // Change this line
//myStr = 'First\Here is a backslash:\.\n\r\Here is a new line with two tabs';
myStr = "Firstline\n\Secondline\\rThirdline";
i need help on this
ManOfUnknownNationality
@nhavar
Jun 29 2017 06:39
@MarionUy it's always the simplest thing that I miss. Change type="txt/css" to type="text/css"
kirbyedy
@kirbyedy
Jun 29 2017 06:39
@musasesay spelling is important... Firstline is not same as FirstLine
Ccs99817
@ccs99817
Jun 29 2017 06:40
@nhavar What I missed is the target="_blank"
THANK ><
CamperBot
@camperbot
Jun 29 2017 06:40
ccs99817 sends brownie points to @nhavar :sparkles: :thumbsup: :sparkles:
:cookie: 43 | @nhavar |http://www.freecodecamp.com/nhavar
MarionUy
@MarionUy
Jun 29 2017 06:40
@nhavar thank you very much. it works now
CamperBot
@camperbot
Jun 29 2017 06:40
marionuy sends brownie points to @nhavar :sparkles: :thumbsup: :sparkles:
:warning: marionuy already gave nhavar points
musa B sesay
@musasesay
Jun 29 2017 06:41
@nhavar ok thank let me try again
CamperBot
@camperbot
Jun 29 2017 06:41
:cookie: 44 | @nhavar |http://www.freecodecamp.com/nhavar
musasesay sends brownie points to @nhavar :sparkles: :thumbsup: :sparkles:
musa B sesay
@musasesay
Jun 29 2017 06:46
@kirbyedy you are right it's work now is spelling mistake
Will Waymel
@willwaymel
Jun 29 2017 06:56
my centering/spacing always seems a bit off-center, like a tiny bit below the middle... can anyone see why that would be ? my pen is here... https://codepen.io/willwaymel/pen/qjpmgP?editors=1100
I've got one .board div that's 400px by 400px and 4 .tic divs that are 180px each, in a flex box, ... it also looks like they are not exactly the same circle angles... Any idea what I'm doing wrong?
kirbyedy
@kirbyedy
Jun 29 2017 07:18
hmmm this is how it looks at chrome on my computer @willwaymel
Screen Shot 2017-06-29 at 10.17.55.png
Will Waymel
@willwaymel
Jun 29 2017 07:19
@kirbyedy wierd... i'm on chrome too... this is how it looks now
blob
maybe refresh? @kirbyedy
kirbyedy
@kirbyedy
Jun 29 2017 07:19
@willwaymel could you do me a favour and close your console
if its open...
Will Waymel
@willwaymel
Jun 29 2017 07:20
it's not
kirbyedy
@kirbyedy
Jun 29 2017 07:20
that is strange
anyway I think the problem is here:
top: 48%
Screen Shot 2017-06-29 at 10.20.47.png
switching it on and off changes the position of that circle in the middle for me
Will Waymel
@willwaymel
Jun 29 2017 07:22
yeah, i know... when i have it at 50% it doesn't look centered exactly, so i changed it to 48%, which gets it closer. but I couldn't figure out why it's always just a tiny bit off-center
kirbyedy
@kirbyedy
Jun 29 2017 07:22
try to vertically resize your window as much as possible and tell me what happens
Will Waymel
@willwaymel
Jun 29 2017 07:22
but in your computer it's really offcenter
kirbyedy
@kirbyedy
Jun 29 2017 07:23
I would suggest not to use that top:48%
Will Waymel
@willwaymel
Jun 29 2017 07:23
@kirbyedy yeah, it moves that white circle up and down because it's position absolute...
I tried to use position-relative, which I think would be better, because it would be positioned relative to that div it's in, but couldn't figure it out
@kirbyedy the other issue I was asking about is if you look at the buttons they are not exactly circular when you look at their edges with the container
AJ
@ajoshi2733
Jun 29 2017 07:24
guys i'm trying to add a nav bar to my portfolio but its not working
Will Waymel
@willwaymel
Jun 29 2017 07:24
like the alignments a bit off
kirbyedy
@kirbyedy
Jun 29 2017 07:25
@willwaymel maybe if you use the absolute position for all your board
not just for the center
Will Waymel
@willwaymel
Jun 29 2017 07:25
blob
@kirbyedy yeah... hmm
@ajoshi2733 add your codepen link? what problem aare you having?
@kirbyedy thanks for looking at it, let me try some of your suggestions
CamperBot
@camperbot
Jun 29 2017 07:26
willwaymel sends brownie points to @kirbyedy :sparkles: :thumbsup: :sparkles:
:star2: 2110 | @kirbyedy |http://www.freecodecamp.com/kirbyedy
kirbyedy
@kirbyedy
Jun 29 2017 07:27
@willwaymel that other thing might be the margin problem
AJ
@ajoshi2733
Jun 29 2017 07:27

@willwaymel <head>

<nav>
<div class="row">
<ul>
<li><a href="#Home">Home</li>
<li><a href="#About">About</li>
<li><a href="#Portfolio">Portfolio</li>
<li><a href="#Contact">Contact</li>
</ul>
</div>
</nav>
</head>

Will Waymel
@willwaymel
Jun 29 2017 07:32
@kirbyedy yeah I don't know, the margins are set to 0
@ajoshi2733 what's the problem you're having with the nav?
kirbyedy
@kirbyedy
Jun 29 2017 07:33
@willwaymel errr I see they are set to auto
Will Waymel
@willwaymel
Jun 29 2017 07:34
@kirbyedy ah yeah, for the buttons. I did that to get them to be all clinging to the ends of the container
AJ
@ajoshi2733
Jun 29 2017 07:34
@willwaymel it looks like shit right now. how do I add the grey background? https://codepen.io/ajoshi/pen/jwYrqq?editors=1100
Will Waymel
@willwaymel
Jun 29 2017 07:35
your background color is 128
it should be in the format of #ddd or #rgb (1, 1, 1) etc. it's just formatted wrong
type in "grey" instead of 128
AJ
@ajoshi2733
Jun 29 2017 07:35
@willwaymel awesome thanks bro
CamperBot
@camperbot
Jun 29 2017 07:35
ajoshi2733 sends brownie points to @willwaymel :sparkles: :thumbsup: :sparkles:
:cookie: 308 | @willwaymel |http://www.freecodecamp.com/willwaymel
Will Waymel
@willwaymel
Jun 29 2017 07:36
@ajoshi2733 no problem
@ajoshi2733 i like your problem "it looks like s###" ... that's always my problem ;)
EpicTriffid
@EpicTriffid
Jun 29 2017 07:37
Hi all. So im currently working on my Random Quote Generator, and I've encountered that for some APIs $getJSON works, and for others it looks like I might have to use ajax. Why would this be?
kirbyedy
@kirbyedy
Jun 29 2017 07:38
example
EpicTriffid
@EpicTriffid
Jun 29 2017 07:39
Well, https://quotesondesign.com/api-v4-0/ works fine with $getJSON, but https://forismatic.com/en/api/ it seems people have to use ajax for it?
kirbyedy
@kirbyedy
Jun 29 2017 07:43
might be because of that jsonp thingy...
ajax has more options to configure
EpicTriffid
@EpicTriffid
Jun 29 2017 08:16
@EpicTriffid
A question! I've finally (FINALLY) succeeded in pulling a quote through an API. However, I want to know why one worked one way, and the other worked a different way.
$(document).ready(function() {
$("#motiv").on("click", function () {
$("#quote").fadeOut(function() {
$.getJSON('https://api.forismatic.com/api/1.0/?method=getQuote&lang=en&format=jsonp&jsonp=?')
.done(function(quote) {
$("#quote").html(quote.quoteText);
})
}).fadeIn()
})
$("#funny").on("click", function () {
$("#quote").fadeOut(function() {
$.getJSON('https://quotesondesign.com/wp-json/posts?filter[orderby]=rand&filter[posts_per_page]=1&callback=', function(quote) {
$("#quote").html(quote[0].content);
});
}).fadeIn();
});
So why do i require the .done with the top api but not the bottom
and why do i require to reference the array element in the bottom one?
Baibhav Gautam
@baibhavx
Jun 29 2017 08:42
just finished fixing some bugs in my TicTacToe. Can I please get help testing the game. Please let me know if you're able to win or the game crashes. Appreciate any suggestions/advices.
https://codepen.io/baibhavx/full/wePJdp/
kirbyedy
@kirbyedy
Jun 29 2017 08:45
its good
Baibhav Gautam
@baibhavx
Jun 29 2017 08:51
Thanks @kirbyedy
CamperBot
@camperbot
Jun 29 2017 08:51
baibhavx sends brownie points to @kirbyedy :sparkles: :thumbsup: :sparkles:
:star2: 2111 | @kirbyedy |http://www.freecodecamp.com/kirbyedy
J.Chechelski
@SupaSaiyan
Jun 29 2017 09:19
@baibhavx sometimes when we pick X at start we have 2 move
@baibhavx for example now, when O starts in left down corner I have 2 moves at start
iso
@iso1048
Jun 29 2017 09:25
@SupaSaiyan who is your favorite dbz character?
J.Chechelski
@SupaSaiyan
Jun 29 2017 09:26
@baibhavx at finish when JS won we can quickly click and win too :)
@gothamknight Goku-san :D
@gothamknight and ofc Bulma :D
Baibhav Gautam
@baibhavx
Jun 29 2017 09:28
@SupaSaiyan lol thanks for helping me out. I am gonna sleep now will look at it tomorrow. :)
CamperBot
@camperbot
Jun 29 2017 09:28
baibhavx sends brownie points to @supasaiyan :sparkles: :thumbsup: :sparkles:
:cookie: 2 | @supasaiyan |http://www.freecodecamp.com/supasaiyan
iso
@iso1048
Jun 29 2017 09:28
@SupaSaiyan goku and vegeta
kirbyedy
@kirbyedy
Jun 29 2017 09:29
vegeta is a spice in europe
J.Chechelski
@SupaSaiyan
Jun 29 2017 09:34
@kirbyedy hahhha yes :D
I very often use vegeta to scrambled egg
Greta Piliponytė
@gpiliponyte
Jun 29 2017 10:53
HELPS PLS weather app buttons don't work due to asynchronic function use and I don't know how to fix it .....
Be1ar
@Be1ar
Jun 29 2017 10:54
How to make my form smaller on phones? https://codepen.io/Beiar/full/rwYZNq/
h1tag
@h1tag
Jun 29 2017 10:58
@gpiliponyte can you share the code if it's already on Codepen or host it somewhere if it's long?
Greta Piliponytė
@gpiliponyte
Jun 29 2017 10:59
h1tag
@h1tag
Jun 29 2017 11:01
@gpiliponyte where does the asynchronous problem occur?
Greta Piliponytė
@gpiliponyte
Jun 29 2017 11:04
where the commnet //buttons don't work is
@h1tag comment*
Greta Piliponytė
@gpiliponyte
Jun 29 2017 11:12
@h1tag did I lose you? :D
h1tag
@h1tag
Jun 29 2017 11:12
@gpiliponyte yes, in the code
h1tag
@h1tag
Jun 29 2017 11:20
@gpiliponyte I can't see where the problem is, maybe I'll check it again later
your getJSON callback function doesn't get executed at all
h1tag
@h1tag
Jun 29 2017 11:45
@gpiliponyte add &callback=? at the end of the darsky url instead of the crossorigin at the beginning
or remove the second https:// in the url
Nathan
@clarken1996
Jun 29 2017 11:47
sorry guys I have a stupid question that I should know but am completely blank can someone tell me how I am supposed to add the break?
$('h2').html("Type Anything Your Mind Can Come Up With!" +
br/"Click The X To Go Back To Original Page");
shivam gupta
@shivamg11000
Jun 29 2017 11:48
@clarken1996 use </br> instead br/
in the string
Nathan
@clarken1996
Jun 29 2017 11:48
thanks
how do i setup tweet button
Nathan
@clarken1996
Jun 29 2017 11:49
@shivamg11000 wait so how would the code look?
Ken Haduch
@khaduch
Jun 29 2017 11:49
@clarken1996 - use <br> or maybe <br/> in the string. I think that <br> is correct in HTML5.
Nathan
@clarken1996
Jun 29 2017 11:50
@khaduch thanks that worked
CamperBot
@camperbot
Jun 29 2017 11:50
clarken1996 sends brownie points to @khaduch :sparkles: :thumbsup: :sparkles:
:star2: 3054 | @khaduch |http://www.freecodecamp.com/khaduch
shivam gupta
@shivamg11000
Jun 29 2017 11:50
$('h2').html("Type Anything Your Mind Can Come Up With!" +
"</br>Click The X To Go Back To Original Page");
@clarken1996
Nathan
@clarken1996
Jun 29 2017 11:50
@shivamg11000 forgot to tag you so you get your points, thanks
CamperBot
@camperbot
Jun 29 2017 11:50
clarken1996 sends brownie points to @shivamg11000 :sparkles: :thumbsup: :sparkles:
:cookie: 333 | @shivamg11000 |http://www.freecodecamp.com/shivamg11000
Greta Piliponytė
@gpiliponyte
Jun 29 2017 11:51
@h1tag uhm
why and also it didn't fix the problme
Nathan
@clarken1996
Jun 29 2017 11:57
Hey does anyone else notice the little (-) in between my two icons when hovering and how do I get rid of it? https://codepen.io/ClarkeN/pen/pwWaoo
h1tag
@h1tag
Jun 29 2017 12:01
@gpiliponyte did you try &callback=? ?
Greta Piliponytė
@gpiliponyte
Jun 29 2017 12:06
@h1tag it does not work
h1tag
@h1tag
Jun 29 2017 12:06
@gpiliponyte it does
Thomas
@sjurs1
Jun 29 2017 12:07

Hey guys. I just started on my JS Calculator, and was wondering if I for every button have to make a div element? Here's my pen:
https://codepen.io/sjurs1/pen/mwpNXE

Just while typing this, I remembered that I could just use a BS btn-group instead. Would that be better, or is there a more efficient way?

Greta Piliponytė
@gpiliponyte
Jun 29 2017 12:07
@h1tag have you tried it in my pen?
h1tag
@h1tag
Jun 29 2017 12:07
@gpiliponyte try it and hit save, so I can see what you are doing
yes, I tried it there
@gpiliponyte sorry, forgot that you also want the buttons to work
Greta Piliponytė
@gpiliponyte
Jun 29 2017 12:10
@h1tag ....... :D
@h1tag yeah, that's kinda the only problem I have
h1tag
@h1tag
Jun 29 2017 12:11
@gpiliponyte so you were getting a weather object back from the api?
Greta Piliponytė
@gpiliponyte
Jun 29 2017 12:12
@h1tag yea
h1tag
@h1tag
Jun 29 2017 12:12
@gpiliponyte because I wasn't getting one
Greta Piliponytė
@gpiliponyte
Jun 29 2017 12:13
well it displays the temperature and things pretty well
for me at least
so that wouldn't be possible without the api object :D
@h1tag
h1tag
@h1tag
Jun 29 2017 12:14
@gpiliponyte yes
true
h1tag
@h1tag
Jun 29 2017 12:23
@gpiliponyte the weird thing is if you try logging tempUS or tempSI inside the on("click" callback function, it logs it to the console, so it's not an async problem
if you find out what the problem is, please tell me
h1tag
@h1tag
Jun 29 2017 12:32
@gpiliponyte it was the bootstrap version that was causing this all that long :worried:
Eric Weiss
@eweiss17
Jun 29 2017 12:33
you forgot the golden rule of checking jquery and bootstrap first thing
h1tag
@h1tag
Jun 29 2017 12:35
@eweiss17 couldn't see how it would cause this behavior because I tried removing the bootstrap classes that she was using on the buttons before
@gpiliponyte so add bootstrap version 3 instead of 4
Eric Weiss
@eweiss17
Jun 29 2017 12:38
hope the new beta teaches bs v 4.0 then, so this problem goes away
Ashik Ameer
@ashki98
Jun 29 2017 12:46
Hi,I needed a help in creating my portfolio page.
Can anyone tell me how to include the social website part.. Like finding all around the web. Is there any bootstrap template for that??
Greta Piliponytė
@gpiliponyte
Jun 29 2017 12:48
@h1tag I have no idea why but it's working ...
h1tag
@h1tag
Jun 29 2017 12:48
@gpiliponyte me too :laughing:
I guess bootstrap 4 causes some conflict with ur current code
Greta Piliponytė
@gpiliponyte
Jun 29 2017 12:50
@h1tag you know the weird thing though? The buttons were working before but then suddenly they would not work. So weird
h1tag
@h1tag
Jun 29 2017 12:51
:confused:
Greta Piliponytė
@gpiliponyte
Jun 29 2017 12:53
and now it works even with bootstrap 4? Anyway, I'm really glad to be done with this project :D
@gpiliponyte
h1tag
@h1tag
Jun 29 2017 12:54
@gpiliponyte no way :laughing:
I think this is the first time I see something like this
Eric Weiss
@eweiss17
Jun 29 2017 12:57
@ashki98 basically just use some font awesome icons and then you can just use a link to your social media site
Thomas
@sjurs1
Jun 29 2017 13:05
Hi guys, need some help with my css. As you can see I'm having a hard time with the = button. How do I "force" it upwards?
https://codepen.io/sjurs1/pen/mwpNXE
Or feel free to suggest better options in terms of setting up the buttons
Eric Weiss
@eweiss17
Jun 29 2017 13:06
is that a gay pride calculator
Thomas
@sjurs1
Jun 29 2017 13:07
Hahaha, it sure is
I wanted to do something else than boring greytones, so I figured why not
Eric Weiss
@eweiss17
Jun 29 2017 13:13
put this into #equalbtn?
  position: relative;
  bottom: 3em
looks alright
Eric Weiss
@eweiss17
Jun 29 2017 13:18
i didn't change anythin else i just added that
Thomas
@sjurs1
Jun 29 2017 13:19
@eweiss17 Yeah I went off on a tangent, but backtracked to what it was before
Thanks! @eweiss17
CamperBot
@camperbot
Jun 29 2017 13:19
sjurs1 sends brownie points to @eweiss17 :sparkles: :thumbsup: :sparkles:
:cookie: 510 | @eweiss17 |http://www.freecodecamp.com/eweiss17
Eric Weiss
@eweiss17
Jun 29 2017 13:19
looks fine to me
Thomas
@sjurs1
Jun 29 2017 13:20
@eweiss17 Yeah, looks good here now too
Noel Quiles
@EnMod
Jun 29 2017 14:01

Hey everyone, completely unsure why the last user in the array for the Twitch API challenge is the only one affected by my list function.

I noticed that users[i] is the correct selection while outside of the first getJSON request. However, logging the value inside the request repeats the last item in the array 8 times instead of giving me all 8 users in the array.

This is what seems to be causing the last user to be the only one affected, but I'm not sure why or how to fix it. What's the deal?

https://codepen.io/EnMod/pen/jwLPQm

Katie Scruggs
@katiescruggs
Jun 29 2017 14:07
hello, can anyone help me with regex for my calculator project? right now I have /^\d+$/ to check that everything submitted was a digit, but i need to include decimal points as well.
Eric Weiss
@eweiss17
Jun 29 2017 14:12
I'd just recommend googling regex and copying/pasting.
Katie Scruggs
@katiescruggs
Jun 29 2017 14:12
@eweiss17 thanks, I've been googling, but seems like my search skills aren't up to par. I'll keep looking!
CamperBot
@camperbot
Jun 29 2017 14:12
katiescruggs sends brownie points to @eweiss17 :sparkles: :thumbsup: :sparkles:
:cookie: 511 | @eweiss17 |http://www.freecodecamp.com/eweiss17
Eric Weiss
@eweiss17
Jun 29 2017 14:13
i mean, you don't need regex per say...
This is what i did
 $(".key").on("click", function(event) {
    var input = event.target.id;
    //console.log(input);

      if ($.isNumeric(input)) {
make sense ?
Katie Scruggs
@katiescruggs
Jun 29 2017 14:15
@eweiss17 wow, isNumeric looks way simpler.
Eric Weiss
@eweiss17
Jun 29 2017 14:16
for sure, avoiding regex when possible is preferable
AlBMyName
@IshmaRey-Hool
Jun 29 2017 14:17

Hi, I was working on ...
https://www.freecodecamp.com/challenges/show-the-local-weather

The code always runs the else part of the command

var theTime = parseInt(Date.now(), 10);

var timeFifteenMin = parseInt(localStorage.getItem("theTime"), 10) + 900000;

if(theTime >= timeFifteenMin){
localStorage.getItem("theTime");
window.alert(theTime+" >= "+timeFifteenMin);
window.alert("Not over 15 minutes yet!");
} else {
//Call the Weather Api
localStorage.setItem("theTime", theTime);
window.alert("Over 15 minutes!");
}
Katie Scruggs
@katiescruggs
Jun 29 2017 14:19
@eweiss17 thanks a lot! this will really help me.
CamperBot
@camperbot
Jun 29 2017 14:19
katiescruggs sends brownie points to @eweiss17 :sparkles: :thumbsup: :sparkles:
:warning: katiescruggs already gave eweiss17 points
Eric Weiss
@eweiss17
Jun 29 2017 14:20
gl on your calc
@IshmaRey-Hool do some console.logs before you hit the if statement
AlBMyName
@IshmaRey-Hool
Jun 29 2017 14:22
OK
Eric Weiss
@eweiss17
Jun 29 2017 14:25
console.log(theTime);
console.log(timeFifteenMin);
will show you what values you are getting
Ken Haduch
@khaduch
Jun 29 2017 14:31
@EnMod - I think that what you'll find is that you have called the $.getJSON winin a for loop, and it has a problem with "closure" in that the very last time through the loop (this is probably what it is) - the value of name is set to the last user in the list, so that is what you are using when the callback functions are triggered. At least this is typically the type of problem that you run into when using asynchronous transactions within a for loop.
@EnMod - also, you are doing something strange with your reg variable - you are using it in an expression to test the returning data, but it looks like you haven't declared it until inside that conditional block. That's probably not going to do what you want?
Noel Quiles
@EnMod
Jun 29 2017 14:40

@khaduch About the $.getJSON, good catch on that. My understanding was that the request and its callback would execute per iteration of the loops, for 8 separate requests. However it sounds like this isn't the case?

About reg, I don't declare it until the conditional because the data I need to draw from doesn't exist unless the request contains a stream property with non-null content. Therefore, if I define it before that and the request ends up returning stream: null I won't have data to pull from and that will cause errors (it did before I made this structuring).

I feel like there's better ways to do all of this but I'm learning :smile:

Jorge
@OrangeKulture
Jun 29 2017 14:41
hey guys
Ken Haduch
@khaduch
Jun 29 2017 14:42
@EnMod - you will see a difference if you change your declaraction of name to this: let name = users[i]; because let (an ES6 feature) has a different behavior where it retains the value in the closure for each loop. It will make the list show the different names, but it will still not fix the problem entirely, probably because of the problem with reg.
My take on this is that it is better to extract the username from the incoming data rather than rely on other means because when the data comes back you have the actual user information embedded within it, so there is no question about it being the correct value to use.
@EnMod - well, you cannot use reg to test for something if it isn't set with a value, so I would recommend getting the username from within the returned data of the stream is not null.
Jorge
@OrangeKulture
Jun 29 2017 14:44
did they remove the chat link from homepage?
h1tag
@h1tag
Jun 29 2017 14:46
@OrangeKulture they moved it to the settings
Jorge
@OrangeKulture
Jun 29 2017 14:46
@h1tag ohh right, didnt know .. thanks
CamperBot
@camperbot
Jun 29 2017 14:46
orangekulture sends brownie points to @h1tag :sparkles: :thumbsup: :sparkles:
:cookie: 875 | @h1tag |http://www.freecodecamp.com/h1tag
Ken Haduch
@khaduch
Jun 29 2017 14:47
@EnMod - I just re-read your comment. There are indeed 8 different requests for data, and 8 different returns. You can see that in the devtools in the Network activity.
Noel Quiles
@EnMod
Jun 29 2017 14:53
@khaduch Hmm...thanks for your insight. I feel like my approach is off from the get-go, going to look at the app again and rework it.
Ken Haduch
@khaduch
Jun 29 2017 14:55
@EnMod - I was studying the data in the network panel, and maybe all of the users are offline now? Nothing is being shown with returned data from your second request, or possibly your second request is not being properly made? I haven't done this project yet - I'll have to go and read the docs to see the info on the request format.
Noel Quiles
@EnMod
Jun 29 2017 14:59
Just tested with MedryBW who is online, they appear as offline when fetching from the Twitch workaround API...
Will test with glitch.me (the new server for the workaround)
oops I mean glitch is giving the issue lol
so is gomix...
Guess I just have to go make an API key myself and request directly from Twitch?
JohnGalt
@osirisseye
Jun 29 2017 15:10
guys is there an alternative website to cloud9.io where I can finish FCC back-end certification ??
Liam Docherty
@ldocherty1
Jun 29 2017 15:13
Hi, I'm trying to make a one page website. Here is my codepen. How can I make each section of the web page equal and for the text "part" to be in the centre? https://codepen.io/liamdocherty1/pen/WOMQLx
h1tag
@h1tag
Jun 29 2017 15:22
@osirisseye https://glitch.com/
Nathan
@clarken1996
Jun 29 2017 15:38
hey does anyone know why I nothing logs on the console? https://codepen.io/ClarkeN/pen/pwWaoo
Ken Haduch
@khaduch
Jun 29 2017 15:44
@clarken1996 - it doesn't appear to be triggering a request for a search from the input box?
Nathan
@clarken1996
Jun 29 2017 15:45
@khaduch mind explaining a bit more?
Ken Haduch
@khaduch
Jun 29 2017 15:45
@clarken1996 - you have the keypress handler on #searchWiki and it looks like maybe you want it on #searchInput? Then after that, keycode is undefined?
Nathan
@clarken1996
Jun 29 2017 15:48
okay thanks now I am getting the error function https://codepen.io/ClarkeN/pen/pwWaoo?editors=1011
@khaduch
Eric Weiss
@eweiss17
Jun 29 2017 15:52
lol maybe put a tooltip or something that the box means random
thought u were about to give me a gift....
Nathan
@clarken1996
Jun 29 2017 15:52
@eweiss17 the gift of knowledge ahahah
@eweiss17 can you figure out why its not working?
Pagnito
@Pagnito
Jun 29 2017 15:53
@SkyC0der hey u on?
Ken Haduch
@khaduch
Jun 29 2017 15:55
@clarken1996 - I think that you need to change your check for the character to this: if(e.charCode == 13){
@clarken1996 - and you have your property dataType misspelled as datsType.
Nathan
@clarken1996
Jun 29 2017 15:59
@khaduch yeah still nothing is being logged
@khaduch it works thankyouuuu
all because I changed id names and miss spelled data..
@khaduch sorry forgot your points, thankyou
CamperBot
@camperbot
Jun 29 2017 16:02
clarken1996 sends brownie points to @khaduch :sparkles: :thumbsup: :sparkles:
:star2: 3055 | @khaduch |http://www.freecodecamp.com/khaduch
Ken Haduch
@khaduch
Jun 29 2017 16:02
@clarken1996 - you're welcome...
Nathan
@clarken1996
Jun 29 2017 16:05
@khaduch is my jQuery okay for my level?
or any pointers
Kevin
@kevinwr
Jun 29 2017 16:08

can anyone explain what the hell this means:

The Geolocation interface represents an object able to programmatically obtain the position of the device. It gives Web content access to the location of the device. This allows a Web site or app to offer customized results based on the user's location.

An object with this interface is obtained using the NavigatorGeolocation.geolocation property implemented by the Navigator object.

What do they mean by "interface"?
Ken Haduch
@khaduch
Jun 29 2017 16:10
@kevinwr - basically, the way you interact with the computer to get the location information. Kind of a "go between" between your program and the actual functions that acquire and present the data to you.
Kevin
@kevinwr
Jun 29 2017 16:11
hmmmm. oooooook.
Ken Haduch
@khaduch
Jun 29 2017 16:14
@kevinwr - like when they talk about "user interface" - it is a way that the computer use interacts with whatever functionality your website is providing - buttons to click, forms to fill out and submit, etc. It is an abstract view to something that your site provides. The geolocation interface basically allows you to make a request, it returns location information that you can access through "latitude" and "longitude" properties.
Kevin
@kevinwr
Jun 29 2017 16:15
ok so you use this "interface" using a method (function?) called getCurrentPosition to retrieve the location of the user.....then it becomes hazy after that.
so I see you get an argument from the method (function?) *position
or I guess position is an object
I dunno' I'm freakin' lost hahah
or wait, so that method called success uses the object called position
Ken Haduch
@khaduch
Jun 29 2017 16:18

@kevinwr - I don't know if the additional information that they post at this link: https://developer.mozilla.org/en-US/docs/Web/API/Geolocation/Using_geolocation (further down on that page) helps you.

You are right - there is a callback function that you pass - success is the name that they give the parameter in the call to the function, that if it successfully retrieves the position information has the parameter position that contains the location data.

Jay Vora
@jayvora92
Jun 29 2017 16:25
what doies form element and # stands in the following code ?
var selectList = {{Form Element}}.querySelector('#selectListId');
Kevin
@kevinwr
Jun 29 2017 16:25
So is the position interface a property or method OF getCurrentPosition?
shivam gupta
@shivamg11000
Jun 29 2017 16:26
@jayvora92 #selectListId is CSS selector
you would know it if you have used CSS to make webpages
Jay Vora
@jayvora92
Jun 29 2017 16:28
@shivamg11000 I am trying to trace a list from selecterlistid. wanted to know what # has importance of?
shivam gupta
@shivamg11000
Jun 29 2017 16:29
@jayvora92 you ever amde webpage with HTML + CSS
made*
Jay Vora
@jayvora92
Jun 29 2017 16:30
no, I have a debugged. It would be helpful if you can just tell me what # for ? like to get unique id or is a part of syntax
shivam gupta
@shivamg11000
Jun 29 2017 16:30
#abc
means a element with class named abc
.abc
means a element with id named abc
@jayvora92 Its a CSS selector
Jay Vora
@jayvora92
Jun 29 2017 16:31
also is the form element something i will get the value from backend code when i inspect or it is just to trace?
ok
shivam gupta
@shivamg11000
Jun 29 2017 16:32
the code maybe selecting a list of element with CSS selector
#selectListId
from the Form element
@jayvora92
Jay Vora
@jayvora92
Jun 29 2017 16:32
ok cool thanks
Kevin
@kevinwr
Jun 29 2017 16:33
Anyone know of any other resources besides MDN for detailed, accurate information about JavaScript, but with easier-to-understand descriptions?
Ken Haduch
@khaduch
Jun 29 2017 16:34
@kevinwr - I would say that getCurrentPosition is a method of the geolocation API - so it's the direct interface with the position information.
@kevinwr - there are lots of resources out there. I'm sure that people can suggest many of them that they like. I have used w3schools.com for their different lessons - they walk through a lot of examples and have a sandbox environment that you can play with (although I've seen people have negative comments about that.) You can also try some of the other online sites like CodeSchool (I think that's the free one?) No, maybe it's codeacademy.com that's free. You can also find youtube videos for learning, if that method appeals to you or works better for you? https://www.codecademy.com - but take a look at w3schools.com for their javascript lessons and see if that gets you off on a good footing?
Lens101
@Lens101
Jun 29 2017 16:39
@kevinwr Javascript & Jquery by Jon Duckett is pretty good, lots of pictures and easy to understand examples if you're looking for a hard copy reference to have
w3schools is also amazin
g
Nathan
@clarken1996
Jun 29 2017 16:40
anyone know why I ca log my data but can't display it? https://codepen.io/ClarkeN/pen/pwWaoo?editors=1011
Ronique Ricketts
@RoniqueRicketts
Jun 29 2017 16:47
Hi @all
Pagnito
@Pagnito
Jun 29 2017 16:50
who knows about learnyounode?
CallMeOrange
@EgnaroDev
Jun 29 2017 16:53
@Pagnito :wave:
Pagnito
@Pagnito
Jun 29 2017 16:53
:wave:
CallMeOrange
@EgnaroDev
Jun 29 2017 17:05
@Pagnito
Did you use replace method for Title Case a Sentence?
Pagnito
@Pagnito
Jun 29 2017 17:06
which challenge
Noel Quiles
@EnMod
Jun 29 2017 17:07
Thanks for your help everyone, especially @khaduch :smile: After some working around I got it to more or less work as expected!
CamperBot
@camperbot
Jun 29 2017 17:07
enmod sends brownie points to @khaduch :sparkles: :thumbsup: :sparkles:
:star2: 3056 | @khaduch |http://www.freecodecamp.com/khaduch
CallMeOrange
@EgnaroDev
Jun 29 2017 17:07
@Pagnito I said it :p
Title Case a Sentence but I tried using it but that only work on string
Pagnito
@Pagnito
Jun 29 2017 17:08
oh... can you postvthe code...my mouthpad stopped workin on my mac
so im on my phone
CallMeOrange
@EgnaroDev
Jun 29 2017 17:08
I have pushed every word into an array
Sure
function titleCase(str) {
  str = str.split(" ");
  var array = [];
  for (var i = 0; i < str.length; i++) {
    array.push(str[i]);
  }
  return array;
}

titleCase("I'm a little tea pot");
Hello911
@Hello911
Jun 29 2017 17:08
$('#facebook').on('click',function(event){
    event.preventDefault();
    window.open('https://www.facebook.com/sharer/sharer.php?u=' + encodeURIComponent('Hello'));
});
});
My facebook share link setup isnt working. The window will pop out and disappear. Someone told me it is because the event is returning false. What does that mean? https://codepen.io/Hello911/pen/OgxxxY?editors=0010
Pagnito
@Pagnito
Jun 29 2017 17:09
what does the chalenge saybu have to do
CallMeOrange
@EgnaroDev
Jun 29 2017 17:10
Return the provided string with the first letter of each word capitalized.
But other than first letter of word has to be lowercase
I cant use replace, toLowercase since it is an array..
Oh perhaps I forgot to return arr[0];
Pagnito
@Pagnito
Jun 29 2017 17:14
i remember this challenge...i think i did a nested loop
i looped thru te split array. then looped thru each word and word[0] touppercase
and the nested loop can be i<1
i think
that way u use less processing power
CallMeOrange
@EgnaroDev
Jun 29 2017 17:15
eh..
Won't my way work?
Pagnito
@Pagnito
Jun 29 2017 17:16
with replace?
CallMeOrange
@EgnaroDev
Jun 29 2017 17:16
Not really
I can now access each word but Im trying to use toUpperCase, maybe replace
Ravi Kishore Thella
@ravikishorethella
Jun 29 2017 17:17
@MCTwoDigitZero use the charAt()
@MCTwoDigitZero you can make the first character uppercase by using the charAt()
charAt(0).toUpperCase() + slice the remaining string
CallMeOrange
@EgnaroDev
Jun 29 2017 17:18
@ravikishorethella I think Im not supposed to use it yet
Pagnito
@Pagnito
Jun 29 2017 17:18
oh i think u can jus use charAt
and use replace with it
CallMeOrange
@EgnaroDev
Jun 29 2017 17:18
I thought of charAt() but cant use it
Ravi Kishore Thella
@ravikishorethella
Jun 29 2017 17:18
@MCTwoDigitZero why?
Pagnito
@Pagnito
Jun 29 2017 17:19
how come
CallMeOrange
@EgnaroDev
Jun 29 2017 17:19
@Pagnito what would fCC think how I used charAt which I haven't learn?
Pagnito
@Pagnito
Jun 29 2017 17:19
that shit dont matter lol
Ravi Kishore Thella
@ravikishorethella
Jun 29 2017 17:20
@MCTwoDigitZero really? :smile:
Pagnito
@Pagnito
Jun 29 2017 17:20
learn now or later...just leaen it
CallMeOrange
@EgnaroDev
Jun 29 2017 17:20
...
Ok Then I dont want to use it :p
Pagnito
@Pagnito
Jun 29 2017 17:20
but i know what u mean...u wanna use the tools theybgave u right?
CallMeOrange
@EgnaroDev
Jun 29 2017 17:20
Yeah
Pagnito
@Pagnito
Jun 29 2017 17:20
thats what i did too
lol
they gave u replace then right?
CallMeOrange
@EgnaroDev
Jun 29 2017 17:21
Nope just split
I dont know why
But they probably want us to think what methods we should use
So most likely replace..
Pagnito
@Pagnito
Jun 29 2017 17:22
hmm...interesting
hold on
ya u dont need to use replace
just loop thru the split array
CallMeOrange
@EgnaroDev
Jun 29 2017 17:24
Did that already
Then I used push method to push every word into an array
Pagnito
@Pagnito
Jun 29 2017 17:24
why?
CallMeOrange
@EgnaroDev
Jun 29 2017 17:24
I dont know... I thought I could make uppercase every first letter some how?
Shouldn't I use push?
Pagnito
@Pagnito
Jun 29 2017 17:25
i dont see a need
CallMeOrange
@EgnaroDev
Jun 29 2017 17:26
oh... looks like I didnt need push lol
Since I used split method
...
Pagnito
@Pagnito
Jun 29 2017 17:26
i think the easiest way is to use a nested loop...if u dont wanna use any methods
ya lol
Ravi Kishore Thella
@ravikishorethella
Jun 29 2017 17:26
@MCTwoDigitZero You are here to learn, so I personally feel there is nothing wrong in solving the challenge in a different way :smile:
Pagnito
@Pagnito
Jun 29 2017 17:26
ya the more practice foreign tools the more you learn about them
cuz there is always more to them tha u think
CallMeOrange
@EgnaroDev
Jun 29 2017 17:27
Yeah..
Pagnito
@Pagnito
Jun 29 2017 17:28
i rly dont see how u would use replace unless u target with charAt
CallMeOrange
@EgnaroDev
Jun 29 2017 17:30
I'll try nested loop
Honestly, I dont use it often so this might take time
Pagnito
@Pagnito
Jun 29 2017 17:30
and i think "a" has to stay small right?
CallMeOrange
@EgnaroDev
Jun 29 2017 17:30
Nope, I think every first letter
Pagnito
@Pagnito
Jun 29 2017 17:30
oooh dude than U HAVE to use it
CallMeOrange
@EgnaroDev
Jun 29 2017 17:31
really lol
replace method?
Pagnito
@Pagnito
Jun 29 2017 17:31
nested loops need to be like a pistol at ur side always ready
CallMeOrange
@EgnaroDev
Jun 29 2017 17:31
oh nested loop..
Pagnito
@Pagnito
Jun 29 2017 17:31
ya
keep me posted with ur updates
i cant code...so i can only code in my mind
lol
CallMeOrange
@EgnaroDev
Jun 29 2017 17:32
lol
for (var i = 0; i < str.length; i++) {
  for (var j = str.length; j > 1; j--) {

  }
}
oops
Pagnito
@Pagnito
Jun 29 2017 17:33
thank god ...my trackpad is drying up...my mac trackpad sloghtly tore a few months back...so now if i spill anything on it, it gets inside the laptop and fcks shit up...for a minute there i thought it was capoot
CallMeOrange
@EgnaroDev
Jun 29 2017 17:33
lol
capoot?
Pagnito
@Pagnito
Jun 29 2017 17:33
second loop has to target str[i]
Gulsvi
@gulsvi
Jun 29 2017 17:34
kaput :)
Pagnito
@Pagnito
Jun 29 2017 17:34
its like german for demise
skyy!!!
CallMeOrange
@EgnaroDev
Jun 29 2017 17:34
@SkyC0der hey
Gulsvi
@gulsvi
Jun 29 2017 17:34
Hello
Pagnito
@Pagnito
Jun 29 2017 17:35
hey man...i wanted to ask u a question
CallMeOrange
@EgnaroDev
Jun 29 2017 17:35
@SkyC0der

function findLongestWord(str) {
str = str.split(" ");
var array = [];
for (var i = 0; i < str.length; i++) {
  var lengthn = str[i].length;
  array.push(lengthn);
  array.sort(function(a, b){
    return a - b;
  });
  }
  var lastn = array.pop();
  return lastn;

}

findLongestWord("The quick brown fox jumped over the lazy dog");
Just returned a variable that is storing last number
Gulsvi
@gulsvi
Jun 29 2017 17:36
Good job @MCTwoDigitZero
You only need to sort it once though - you're sorting the array every single loop
CallMeOrange
@EgnaroDev
Jun 29 2017 17:37
Other guy said it too.. I dont understand
Gulsvi
@gulsvi
Jun 29 2017 17:37
function findLongestWord(str) {
  str = str.split(" ");
  var array = [];
  for (var i = 0; i < str.length; i++) {
    array.push(str[i].length);
  }
  array.sort(function(a, b) {
    return a - b;
  });

  var lastn = array.pop();
  return lastn;
}
add everything to the array in your for loop, one at a time, then sort when the loop is done
CallMeOrange
@EgnaroDev
Jun 29 2017 17:38
I see
Gulsvi
@gulsvi
Jun 29 2017 17:38

Also, this:

  var lastn = array.pop();
  return lastn;

Is the same as:

  return  array.pop();
CallMeOrange
@EgnaroDev
Jun 29 2017 17:38
Moved sort method outside of loop
Gulsvi
@gulsvi
Jun 29 2017 17:39
makes it easier to read and uses less memory
CallMeOrange
@EgnaroDev
Jun 29 2017 17:39
@SkyC0der it take your memory away?
Gulsvi
@gulsvi
Jun 29 2017 17:39
Every time you declare a variable, it uses memory
CallMeOrange
@EgnaroDev
Jun 29 2017 17:39
I see
@SkyC0der So can you help me with Title Case a Sentence?
Gulsvi
@gulsvi
Jun 29 2017 17:42
The other way to do it is without an array:
function findLongestWord(str) {
  str = str.split(" ");
  var longestWordLength = str[0].length;

  for (var i = 1; i < str.length; i++) {

    var wordLength = str[i].length;
    if (wordLength > longestWordLength) longestWordLength = wordLength;

  }

  return longestWordLength;
}
check the word length of each word as you go through the loop. If it's bigger, then update the variable.
Yeah, I can help, but not with a nested for loop :p
CallMeOrange
@EgnaroDev
Jun 29 2017 17:43
... Im suck with nested loop
Gulsvi
@gulsvi
Jun 29 2017 17:43
going to make you use .substr()
CallMeOrange
@EgnaroDev
Jun 29 2017 17:43
Pagnito told me to use
@SkyC0der I have to use substr if I want to use nested loop?
Gulsvi
@gulsvi
Jun 29 2017 17:44
You can use a nested loop, but I think it's confusing
CallMeOrange
@EgnaroDev
Jun 29 2017 17:44
Yeah it is
Gulsvi
@gulsvi
Jun 29 2017 17:44
.substr() doesn't need a nested loop
CallMeOrange
@EgnaroDev
Jun 29 2017 17:44
:/
I dont know substr yet
I dont want to use any methods that is not given to me
Pagnito
@Pagnito
Jun 29 2017 17:45
wouldnt substr extract the first letter?
CallMeOrange
@EgnaroDev
Jun 29 2017 17:46
@SkyC0der Can I do this with replace method and toLowerCase?
Gulsvi
@gulsvi
Jun 29 2017 17:46
var word = 'tea';
var upperCaseWord = word[0].toUpperCase() + word.substr(1);
console.log(upperCaseWord); // Tea
^^ Like that
CallMeOrange
@EgnaroDev
Jun 29 2017 17:46
Some answer..
Gulsvi
@gulsvi
Jun 29 2017 17:47
They used to recommend .substr() for that one I think....looks like they changed it
Pagnito
@Pagnito
Jun 29 2017 17:47
oh i like that
CallMeOrange
@EgnaroDev
Jun 29 2017 17:47
@SkyC0der really? didnt know that
Only split method was there :/
@SkyC0der so substr take first letter?
Gulsvi
@gulsvi
Jun 29 2017 17:48
If you want to only use .split(), then you'll need to use nested loops
CallMeOrange
@EgnaroDev
Jun 29 2017 17:48
@SkyC0der but you cant help me with nested loop right?
Gulsvi
@gulsvi
Jun 29 2017 17:48
var word = 'reallylongword'
console.log(word.substr(5)) // ylongword
substr gives you everything starting at the index
:)
CallMeOrange
@EgnaroDev
Jun 29 2017 17:49
after the index?
Pagnito
@Pagnito
Jun 29 2017 17:49
you pretty much had it right whe u showed me ur nested loop....u just needed to target the arr elements in the second loop and not the arr again
CallMeOrange
@EgnaroDev
Jun 29 2017 17:49
function titleCase(str) {
  str = str.split(" ");
for (var i = 0; i < str.length; i++) {
  for (var j = str[i]; j > 1; j--) {

  }
}
}

titleCase("I'm a little tea pot");
Baibhav Gautam
@baibhavx
Jun 29 2017 17:49
Hi guys please help me test my TicTacToe. It should never lose and the game shoudn't freeze. After each game, it also prints out the board in the console. Appreciate any feedback and suggestions..
https://codepen.io/baibhavx/full/wePJdp/
CallMeOrange
@EgnaroDev
Jun 29 2017 17:50
@baibhavx I got a draw
Pagnito
@Pagnito
Jun 29 2017 17:50
j<str[i]
CallMeOrange
@EgnaroDev
Jun 29 2017 17:50
@Pagnito oh
so then var j = str.length;?
Pagnito
@Pagnito
Jun 29 2017 17:50
j=0
CallMeOrange
@EgnaroDev
Jun 29 2017 17:50
:/
Baibhav Gautam
@baibhavx
Jun 29 2017 17:50
@MCTwoDigitZero yeah you can draw
Pagnito
@Pagnito
Jun 29 2017 17:51
actually u u could do j<1
cuz u only nees the first letter of each word
and
CallMeOrange
@EgnaroDev
Jun 29 2017 17:51
@Pagnito < is right sign?
Pagnito
@Pagnito
Jun 29 2017 17:51
that uses less processin
CallMeOrange
@EgnaroDev
Jun 29 2017 17:51
less than 1?
Pagnito
@Pagnito
Jun 29 2017 17:51
ya it basicLly sayz
CallMeOrange
@EgnaroDev
Jun 29 2017 17:52
So j++?
for (var j = 0; j < 1; j++) {

  }
Pagnito
@Pagnito
Jun 29 2017 17:53
as long as i is less than 1 { do this }
ya thats right
j i mean
as long as is less than 1
as long as j
CallMeOrange
@EgnaroDev
Jun 29 2017 17:53
lol
oh I see so I can take first letter
Pagnito
@Pagnito
Jun 29 2017 17:54
still on my ohone
CallMeOrange
@EgnaroDev
Jun 29 2017 17:54
Since j is less than 1
0 less than 1?
Pagnito
@Pagnito
Jun 29 2017 17:54
phone
CallMeOrange
@EgnaroDev
Jun 29 2017 17:54
Dont worry, if you type wrong I can understand
Pagnito
@Pagnito
Jun 29 2017 17:54
so what ur doing is looping thru the array
on every i
u start the second loop
CallMeOrange
@EgnaroDev
Jun 29 2017 17:55
str[i][j]
Pagnito
@Pagnito
Jun 29 2017 17:55
so the second loop gets executed on every iteration of arr
CallMeOrange
@EgnaroDev
Jun 29 2017 17:56
lol, so str[i][j] take every first letter
Pagnito
@Pagnito
Jun 29 2017 17:56
so it starts at "Iam"
so the action u give for that iteration
is to loop thru the "iam"
CallMeOrange
@EgnaroDev
Jun 29 2017 17:56
I
a
l
t
p
console.log(str[i][j]);
Pagnito
@Pagnito
Jun 29 2017 17:57
second loop starts with I
u upperCase it
CallMeOrange
@EgnaroDev
Jun 29 2017 17:57
Yeah Im going to
:p
Pagnito
@Pagnito
Jun 29 2017 17:57
and once thats done j gets a plus one
since its 1 now
the condition j<1
CallMeOrange
@EgnaroDev
Jun 29 2017 17:58
yeah I understand nested loop
Pagnito
@Pagnito
Jun 29 2017 17:58
is no longer true
so u move on to the next word of the sentence
in the arr
CallMeOrange
@EgnaroDev
Jun 29 2017 17:58
So I just uppercase it
Pagnito
@Pagnito
Jun 29 2017 17:59
and on hat word j loop gets applied to
that word*
CallMeOrange
@EgnaroDev
Jun 29 2017 18:02
@Pagnito So nested loop help me to get access to every first letter
Pagnito
@Pagnito
Jun 29 2017 18:02
exactly
or any letter u want
CallMeOrange
@EgnaroDev
Jun 29 2017 18:03
Since str[i] give every word but with [j] it give you every first letter
So like str[i][0]
Pagnito
@Pagnito
Jun 29 2017 18:03
with j it gives u any letter of the str[i]
but u choose the first one
because u say j=0 j<1 j++
CallMeOrange
@EgnaroDev
Jun 29 2017 18:04
Why do I need nested loop when I can do just this? str[i][0]
Pagnito
@Pagnito
Jun 29 2017 18:04
u know what
oh nvm
i was about to say
u right but u cant do that
cuz the array elements are strings
Eric Weiss
@eweiss17
Jun 29 2017 18:04
doing algorithms?
CallMeOrange
@EgnaroDev
Jun 29 2017 18:04
@eweiss17 Yea
Pagnito
@Pagnito
Jun 29 2017 18:05
thats why u would need charAt() if u wan index of string
CallMeOrange
@EgnaroDev
Jun 29 2017 18:05
@Pagnito So I can do that?
Pagnito
@Pagnito
Jun 29 2017 18:05
nah
CallMeOrange
@EgnaroDev
Jun 29 2017 18:05
str[i][0]
Why?
Pagnito
@Pagnito
Jun 29 2017 18:05
u cant access index of string with []
CallMeOrange
@EgnaroDev
Jun 29 2017 18:05
No not charAt()
Pagnito
@Pagnito
Jun 29 2017 18:05
its for arrays and objects
Eric Weiss
@eweiss17
Jun 29 2017 18:05
sometimes going through the loops manually helps
Pagnito
@Pagnito
Jun 29 2017 18:05
u can use charAt for index of strings
but u cant use [] for strings
CallMeOrange
@EgnaroDev
Jun 29 2017 18:05
but doesn't str[i][j] works same way as str[i][0]?
Since j is always 0
Im not talking about charAt :/
Pagnito