These are chat archives for FreeCodeCamp/HelpFrontEnd

28th
Aug 2017
Gaurav
@gauravmagan
Aug 28 2017 00:04
@tom error code 28p01
pssql cannot connect to the applciation
@davidjleys can we have any other alternative am logging i with sudo
Richard
@rylew0925
Aug 28 2017 01:30
is it recommended that I start my portfolio project early or should I just wait until I finish all the FCC lessons?
Ismail Hozain
@ismailhozain
Aug 28 2017 01:37
Yo guys I am having issues with my wikipedia viewer main one is that i am having issues with getting the output going and it is not working at all (main request working just fine) https://codepen.io/ismailhozain/pen/OjvzaZ?editors=1010
Tom
@moT01
Aug 28 2017 01:40
@rylew0925 i did mine towards the end of the front end projects
@ismailhozain whats up
Ismail Hozain
@ismailhozain
Aug 28 2017 01:45
yo
iso
@iso1048
Aug 28 2017 01:45
@ismailhozain try putting this line: var searchInput = $("#input").val; inside the click function.
Ismail Hozain
@ismailhozain
Aug 28 2017 01:45
did that
Tom
@moT01
Aug 28 2017 01:46
so your having problems getting the search term?
add .val();
and yea, it will probly need to be in the button click
Ismail Hozain
@ismailhozain
Aug 28 2017 01:48
did that
Tom
@moT01
Aug 28 2017 01:48
works for me
 $("#button").on("click", function () {
  var searched = $('#input').val();
   console.log(searched);
and then you're going to need to set the url in there too
Ismail Hozain
@ismailhozain
Aug 28 2017 01:49
the url variable?
Tom
@moT01
Aug 28 2017 01:50
yes
Ismail Hozain
@ismailhozain
Aug 28 2017 01:50
ok
Tom
@moT01
Aug 28 2017 01:50
first - button gets clicked
then - get the search term
then create the url
then make the call
you could probly combine the 2 middle steps
Ismail Hozain
@ismailhozain
Aug 28 2017 01:52
i am getting the error that the search part of my link is not set
Tom
@moT01
Aug 28 2017 01:53
cause you didn't follow my directions
Ismail Hozain
@ismailhozain
Aug 28 2017 01:53
?
oh
Tom
@moT01
Aug 28 2017 01:53
the way you have it - the url gets set when the document loads , and the #input is empty
you need to set it after the button click
Ismail Hozain
@ismailhozain
Aug 28 2017 01:54
ok
not working
Tom
@moT01
Aug 28 2017 01:58
dont forget to put () at the end of val
.val();
Ismail Hozain
@ismailhozain
Aug 28 2017 01:59
it worked
or at least in my console it did
ok i got it working fully
thanks guys
Ismail Hozain
@ismailhozain
Aug 28 2017 02:14
but how would i address the individual elements
Tom
@moT01
Aug 28 2017 02:15
what do you mean, the data you get back?
Ismail Hozain
@ismailhozain
Aug 28 2017 02:26
nvm
never mind
Pagnito
@Pagnito
Aug 28 2017 02:39
anyone use materialize css alot?
iso
@iso1048
Aug 28 2017 02:50
Is anyone available to help with the 'everything be true' challenge? I can pass all tests except the one below - it should return false but returns true:
function truthCheck(collection, pre) {
  var check = true;
  collection.forEach(function(item, index){
    if (!item.hasOwnProperty(pre) || [null, undefined, 0, "", NaN].indexOf(item[pre]) > -1){check = false;}
  });

  return check;
}

truthCheck([{"single": "double"}, {"single": NaN}], "single");
Gyeognphil Choi
@creativeworkers10
Aug 28 2017 02:55

I'm coding "Factorialize a Number" at the moment, and the console gives me the right answers, but the challenge doesn't want to be finished.

var a = [];
var b = 1;
function factorialize(num) {
  for(var i = 1; i <= num; i++){
    a.push(i);
  }
  for(var j = 0; j < a.length; j++){
      b *= a[j];
    }
  return b;
}

factorialize(5);

Did I do something wrong? Please help!

Johnny
@jtan3
Aug 28 2017 02:58
@creativeworkers10 try putting your var a and b inside your function
Gyeognphil Choi
@creativeworkers10
Aug 28 2017 03:00
@jtan3 Oh, It worked! Thank you so much! Is this about global, local scope?
CamperBot
@camperbot
Aug 28 2017 03:00
creativeworkers10 sends brownie points to @jtan3 :sparkles: :thumbsup: :sparkles:
:cookie: 456 | @jtan3 |http://www.freecodecamp.com/jtan3
Johnny
@jtan3
Aug 28 2017 03:00
@creativeworkers10 yup
Gyeognphil Choi
@creativeworkers10
Aug 28 2017 03:01
@jtan3 Guess I need to look it up again! Thanks again!
CamperBot
@camperbot
Aug 28 2017 03:01
creativeworkers10 sends brownie points to @jtan3 :sparkles: :thumbsup: :sparkles:
:warning: creativeworkers10 already gave jtan3 points
Johnny
@jtan3
Aug 28 2017 03:02
@creativeworkers10 https://forum.freecodecamp.org/t/factorialize-number-challenge/137745 someone explains in the link
iso
@iso1048
Aug 28 2017 03:04
@jtan3 do you know what the issue is with my code above?
Johnny
@jtan3
Aug 28 2017 03:06
@gothamknight im not good with the harder algos sorry
iso
@iso1048
Aug 28 2017 03:07
@jtan3 no worries
Tom
@moT01
Aug 28 2017 03:26
@gothamknight ([erp]meti!)fi
iso
@iso1048
Aug 28 2017 03:27
@moT01 i don't get it bro
oh its reversed of something I had...
@moT01 i changed item.hasOwnProperty(pre) to what you said (!item[pre]) and it worked.....why did it work?
just1witness
@just1witness
Aug 28 2017 03:30
@gothamknight Your using .forEach(), look into .every() instead.
Tom
@moT01
Aug 28 2017 03:30
cause the one test that was failing had that property
just1witness
@just1witness
Aug 28 2017 03:30
hint, it's excruciatingly simple. @gothamknight
Tom
@moT01
Aug 28 2017 03:30
the value was just NaN
so your test found the key there, and my test searched for the value
if that makes sense
and a NaN value isn't a value - like undefined or false
just1witness
@just1witness
Aug 28 2017 03:33
@gothamknight just for reference, here's how you use .every()
function truthCheck(collection, pre) {
  return collection.every(function(a){
   return a[pre];
  });
}
iso
@iso1048
Aug 28 2017 03:35
ok i get that NaN is not a value, since it makes no difference if I have it in that array i had. But I do not understand why !item[pre] was able to identify NaN... @moT01 @just1witness
@just1witness oh that is much better
Tom
@moT01
Aug 28 2017 03:36
so it searches for item['single'] and gets the value that it holds which is NaN which is false
just1witness
@just1witness
Aug 28 2017 03:38
:)
iso
@iso1048
Aug 28 2017 03:42
@moT01 sorry i am being a bit of a dimwit - why does that specific test still pass regardless of whether or not there is ! in front of item['single']?
Tom
@moT01
Aug 28 2017 03:44
cause in that specific test the other one is false
if(item[single]) == 'double' which is true
and sets your variable to false
if that makes sense
but the NaN one doesn't pass there
iso
@iso1048
Aug 28 2017 03:45
because item['single'] evalutes to NaN, and NaN is null...(and null is in the array)?
Tom
@moT01
Aug 28 2017 03:47
im not sure on that test of yours
i would have done maybe....
iso
@iso1048
Aug 28 2017 03:47
@moT01 because NaN does not need to be in the array for me to pass the challenge
Tom
@moT01
Aug 28 2017 03:48
if (!item.hasOwnProperty(pre) || item[pre] == (NaN || 0 || ...)){check = false;}
iso
@iso1048
Aug 28 2017 03:50
@moT01 so if (!item.hasOwnProperty(pre) || item[pre] == (NaN || 0 || null || undefined || "")){check = false;} - that does not work.
Tom
@moT01
Aug 28 2017 03:57
hmm, maybe you can't do a test like that - i thought you could
no, you can
i think there's something specific you have to do for a few of those
it's not recognizing it when you type NaN
you have to use isNaN()
and maybe the same for null or something
iso
@iso1048
Aug 28 2017 04:01

yeah I had a look at that. I think it is fine for null though. I still do not get why

function truthCheck(collection, pre) {
  var check = true;
  collection.forEach(function(item){
    if (!item[pre] || [null, undefined, 0, ""].indexOf(item[pre]) > -1){check = false;}  
  });
  return check;
}

truthCheck([{"single": "double"}, {"single": NaN}], "single");
function truthCheck(collection, pre) {
  var check = true;
  collection.forEach(function(item){
    if (item[pre] || [null, undefined, 0, ""].indexOf(item[pre]) > -1){check = false;}  
  });
  return check;
}

truthCheck([{"single": "double"}, {"single": NaN}], "single");

both pass this specific test though

Tom
@moT01
Aug 28 2017 04:05
all you need is !item[pre]
passes all
iso
@iso1048
Aug 28 2017 04:06
oh true!
ok, then why does that test pass with both !item['single'] and item['single']? wouldn't the latter evaluate to false in the second object of collection?
Tom
@moT01
Aug 28 2017 04:08
yes, but the first one wouldn't work
so the first one passes that test and sets it to false
iso
@iso1048
Aug 28 2017 04:09
of course. I really am being an idiot. Thanks for all the help @moT01 (and sorry for wasting your time)
CamperBot
@camperbot
Aug 28 2017 04:09
gothamknight sends brownie points to @mot01 :sparkles: :thumbsup: :sparkles:
:cookie: 819 | @mot01 |http://www.freecodecamp.com/mot01
Tom
@moT01
Aug 28 2017 04:10
im not doing much else
CamperBot
@camperbot
Aug 28 2017 04:12
:cookie: 819 | @mot01 |http://www.freecodecamp.com/mot01
Markus Kiili
@Masd925
Aug 28 2017 05:47
@gothamknight Method .every() would do the same as that flag variable and forEach. So it suits the problem well.
Mukesh Kumar Angrish
@MukeshAngrish
Aug 28 2017 06:20
Hey guys, I need some help as my Tic Tac Toe app is not working properly. I have fairly good reasons to believe that is issue is with the minmax() function as I have tried running the app without using the minmax()function and it worked. Also I have some issue with the html/css maybe as the divs move from their location when I click on them.
Markus Kiili
@Masd925
Aug 28 2017 06:27
@MukeshAngrish You have an error on the browser developer tools console.
Long Nguyen
@longnt80
Aug 28 2017 06:33

@MukeshAngrish

some issue with the html/css maybe as the divs move from their location when I click on them.

I think this has to do with the line-height
I wouldn't use display: inline-block in this case
Try remove that and use float

a display: block element is easier to control its height
Long Nguyen
@longnt80
Aug 28 2017 06:43
@MukeshAngrish ok here's the fix for your css issue:
add this to .col
vertical-align: middle;
but you should use float or flexbox for the layout
Marat
@Marat89bluolyu
Aug 28 2017 07:49

hi all, i need return values from array with interval. I used setTimeout but function return undefined for all values:

function arrayCounter(arr) {
    for (var i = 0; i<arr.length; i++) {
        setTimeout (function () {
            console.log(arr[i]);
        }, 1000);
    }
}

arrayCounter([1,2,3,4,5]);

Whats wrong?

Markus Kiili
@Masd925
Aug 28 2017 07:53
@Marat89bluolyu All those callback functions use the same variable i that has value arr.length at the time when those callbacks execute.
So arr[i] returns undefined.
Marat
@Marat89bluolyu
Aug 28 2017 07:56
@Masd925 need to use bind?
Long Nguyen
@longnt80
Aug 28 2017 07:57
@Marat89bluolyu try use let
Markus Kiili
@Masd925
Aug 28 2017 07:58
@Marat89bluolyu There are many ways. One popular way is to make another function that makes the Timeout call and you pass the value of the index as an argument. Or what @longnt80 said.
Just remember that let is ES6.
Marat
@Marat89bluolyu
Aug 28 2017 08:00
@Masd925 yep, but i need do it on ES5 =)
Markus Kiili
@Masd925
Aug 28 2017 08:01
@Marat89bluolyu Then making that function is an easy solution.
Marat
@Marat89bluolyu
Aug 28 2017 08:22
@longnt80 , @Masd925 thanks !!!
CamperBot
@camperbot
Aug 28 2017 08:22
marat89bluolyu sends brownie points to @longnt80 and @masd925 :sparkles: :thumbsup: :sparkles:
:cookie: 533 | @longnt80 |http://www.freecodecamp.com/longnt80
:star2: 4441 | @masd925 |http://www.freecodecamp.com/masd925
Marat
@Marat89bluolyu
Aug 28 2017 08:30
But in my code there is a problem. All values of my array are outputed at once.
I need that they a will be display with interval
 function arrayCounter(arr) {
    for (var i = 0; i<arr.length; i++) {
        (function (inner) {
            setTimeout( function() {
                console.log(inner);
            }, 1000)
        })(i);
    }
 }   

arrayCounter([1,2,3,4,5]);
Long Nguyen
@longnt80
Aug 28 2017 08:39
@Marat89bluolyu I think you can do that with recursive instead of loop
Jim Tryon
@jimtryon
Aug 28 2017 08:43
I think so too
Markus Kiili
@Masd925
Aug 28 2017 08:44
@Marat89bluolyu Or use inner*1000
Long Nguyen
@longnt80
Aug 28 2017 08:46
^
Mukesh Kumar Angrish
@MukeshAngrish
Aug 28 2017 10:11
@longnt80 Sorry, I’m replying late. Thanks your
vertical-align : middle
worked for my Tic Tac Toe app. And about the float you mentioned, can you show me how to use it. I’ve never used that before in my css.
CamperBot
@camperbot
Aug 28 2017 10:11
mukeshangrish sends brownie points to @longnt80 :sparkles: :thumbsup: :sparkles:
:cookie: 534 | @longnt80 |http://www.freecodecamp.com/longnt80
Long Nguyen
@longnt80
Aug 28 2017 10:12
@MukeshAngrish can you give me the pen again
Mukesh Kumar Angrish
@MukeshAngrish
Aug 28 2017 10:13
@longnt80 Here it is.
Long Nguyen
@longnt80
Aug 28 2017 10:17
@MukeshAngrish ok here's a simple example of using float:
https://codepen.io/longnt80/pen/NvObYw
Markus Kiili
@Masd925
Aug 28 2017 10:21
@MukeshAngrish Shortly put, a floated element is taken out of the normal flow of elements and put to the far right/left of the containing box. The element becomes a block-level element around which other elements can flow.
Mukesh Kumar Angrish
@MukeshAngrish
Aug 28 2017 10:21
@longnt80 Ok, thanks. I understand it now. I will probably use it when I re-do my app
CamperBot
@camperbot
Aug 28 2017 10:21
mukeshangrish sends brownie points to @longnt80 :sparkles: :thumbsup: :sparkles:
:warning: mukeshangrish already gave longnt80 points
Mukesh Kumar Angrish
@MukeshAngrish
Aug 28 2017 10:21
@Masd925 Yeah, got it now thanks
CamperBot
@camperbot
Aug 28 2017 10:21
mukeshangrish sends brownie points to @masd925 :sparkles: :thumbsup: :sparkles:
:star2: 4443 | @masd925 |http://www.freecodecamp.com/masd925
Sofus Heggemsens
@Sofeo
Aug 28 2017 10:43
can somone help me center the search resoults on my wikipedia viewer?
https://codepen.io/sofeo/pen/ayymja
heroiczero
@heroiczero
Aug 28 2017 10:49
Mukesh Kumar Angrish
@MukeshAngrish
Aug 28 2017 11:36
@Sofeo Try giving .results class a margin on the left
LiciniusRex
@hashtagyolo1
Aug 28 2017 11:37
argh! Diff two arrays is killing me. For some reason I'm gettting 16! true responses and I cannot work out why
function diffArray(arr1, arr2) {
  var newArr = arr1.filter(function(check) {
    for (var i = 0; i < arr1.length; i++) {
      for (var j = 0; j < arr2.length; j++) {
        if (arr1[i] == arr2[j]) {
          console.log(true);
        }
      }
    }
  });

  //console.log(newArr);
  return newArr;
}

diffArray([1, 2, 3, 5], [1, 2, 3, 4, 5]);
oops, nm, fixed that :/
Markus Kiili
@Masd925
Aug 28 2017 11:45
@hashtagyolo1 You should note that filter already loops the array arr1. No need to loop it twice.
LiciniusRex
@hashtagyolo1
Aug 28 2017 11:48
I'm trying a s;ightly different approach at the moment. Keep forgetting that console.log does not do the same job as return when troubleshooting :/
Ghost
@ghost~57b1df1e40f3a6eec05f92a8
Aug 28 2017 12:40
@rajatkhare619 Sorry for the late Response, but I've got something for your picture highlighting now. The idea is, to wrap the image in a container with the same size, then add a pseudo-element to it (I used :before). This pseudo-element is centered and shaped as a circle. Then you can apply a box-shadow to it, which darkens the surrounding (or you can lighten the circle by adding a background-color).
Here's a pen demonstrating it: https://codepen.io/A_A/pen/WEapPG
FakhriAz
@FakhriAz
Aug 28 2017 12:42

Hi everyone, the background-image in codepen does not show up any idea. I have already hosted the image in the web and added the link:

body {
position: relative;
background: url('https://i.imgur.com/onZceGF.jpg') no-repeat center fixed;
background-size: cover;

Ghost
@ghost~57b1df1e40f3a6eec05f92a8
Aug 28 2017 12:43
@FakhriAz Can you give us the link to your pen?
And just in case, does the body has a width and height?
I did add only one image for now. Everything works fine on Visual Studio
@Otto-AA
alessiochiffi
@alessiochiffi
Aug 28 2017 12:45
play with z index
Sorin Ruse
@sorinr
Aug 28 2017 12:48
@FakhriAz think your problem is between codepen and imgur. try some other free img hosting and should work
Ghost
@ghost~57b1df1e40f3a6eec05f92a8
Aug 28 2017 12:51

@FakhriAz Yeah, Sorin seems right:

"Imgur blocks image requests from CodePen. We can't control that."

FakhriAz
@FakhriAz
Aug 28 2017 13:14
@alessiochiffi @Otto-AA @sorinr Thank you. I read this too https://www.reddit.com/r/FreeCodeCamp/comments/49dfm2/what_is_the_besteasiest_place_to_host_images_for/ (Imgur blocks CodePen)
...then I used https://cloudinary.com
It works now.
CamperBot
@camperbot
Aug 28 2017 13:14
fakhriaz sends brownie points to @alessiochiffi and @otto-aa and @sorinr :sparkles: :thumbsup: :sparkles:
:cookie: 82 | @alessiochiffi |http://www.freecodecamp.com/alessiochiffi
:cookie: 386 | @otto-aa |http://www.freecodecamp.com/otto-aa
:star2: 1331 | @sorinr |http://www.freecodecamp.com/sorinr
Sorin Ruse
@sorinr
Aug 28 2017 13:41
@FakhriAz :+1: anyway, do not upload any video files with cloudinary coz they will eat your free quota :)
FakhriAz
@FakhriAz
Aug 28 2017 13:44
@sorinr All right
Hi, any idea why when in a small viewport the images in the portfolio have white space on the left and right?
https://codepen.io/FakhriAz/pen/KvGaZL?editors=1100
Tom
@moT01
Aug 28 2017 13:56
@FakhriAz if you bring up the dev tools in your browser you can see what's taking up that space
looks to be the .thumbnail class
FakhriAz
@FakhriAz
Aug 28 2017 13:57
@moT01 I will check it
Tom
@moT01
Aug 28 2017 13:58
i know you're still working on it but i have to say something about that background, ...you can't read anything with it
FakhriAz
@FakhriAz
Aug 28 2017 13:59
@moT01 Thanks that it is true. I will deal with it.
Tom
@moT01
Aug 28 2017 13:59
could maybe put something behind your paragraphs, like a partially transparent background color
Sorin Ruse
@sorinr
Aug 28 2017 14:01
@FakhriAz add this to css to override some bootstrap default margins:
.thumbnail a>img, .thumbnail>img{
  margin: 0;
  width: 100%;
}
can anyone help me on how to validate and submit this form
my function doesnt seem to work
@planigan can you help me out
Toni Shortsleeve
@KoniKodes
Aug 28 2017 16:14
@bigyankarki Hi. Which function is not working? On codepen you need to make you settings a little different. The html page only needs what is inside the body, it supplies the head. You can add your meta tags by using the settings gear at the top and choosing html. Then add the meta at the bottom. You call the bootstrap from the css section, and the jquery from the javascript section. I think if you make these changes, it will help.
Jorge
@OrangeKulture
Aug 28 2017 16:14
found some bugs on my tic tac toe, finishing up .. thanks tho @moT01
CamperBot
@camperbot
Aug 28 2017 16:14
orangekulture sends brownie points to @mot01 :sparkles: :thumbsup: :sparkles:
:cookie: 820 | @mot01 |http://www.freecodecamp.com/mot01
Jorge
@OrangeKulture
Aug 28 2017 16:14
i know you are really dying to see my project :joy:
Bigyan Karki
@bigyankarki
Aug 28 2017 16:15
@KoniKodes i just directly copied the code from my text editor to codepen
thats why it seems messy in codepen
i am just stuck in validation part
Toni Shortsleeve
@KoniKodes
Aug 28 2017 16:16
@bigyankarki Yes, I do the same thing. But then I have to re-structure for codepen. See if making the changes will help. Because right now it is not seeing some of the tags.
Tom
@moT01
Aug 28 2017 16:16
@bigyankarki maybe start by adding a listener for submitting
Bigyan Karki
@bigyankarki
Aug 28 2017 16:17
@KoniKodes alright i will do it right now
Tom
@moT01
Aug 28 2017 16:17
submit.click () { validateForm }
Jorge
@OrangeKulture
Aug 28 2017 16:17
so .. whats new guys? anything remotely exciting around here?
Toni Shortsleeve
@KoniKodes
Aug 28 2017 16:18
@OrangeKulture Waiting to see your tic tac toe...
Tom
@moT01
Aug 28 2017 16:19
i made a chat room - come chat https://my-chat.glitch.me/
Jorge
@OrangeKulture
Aug 28 2017 16:19
wahah yeah .. its a little buggy :S
have u completed the challenge? @KoniKodes
you using web sockets tom?
Tom
@moT01
Aug 28 2017 16:20
yes
Toni Shortsleeve
@KoniKodes
Aug 28 2017 16:20
@OrangeKulture Almost... It's not seeing the winner immediately. And it doesn't want to be responsive. At least it's not cheating anymore..
Jorge
@OrangeKulture
Aug 28 2017 16:21
yeah my problem is taking into account when the player wants to lose on purpose
Toni Shortsleeve
@KoniKodes
Aug 28 2017 16:21
Thank you @moT01 It looks great!
CamperBot
@camperbot
Aug 28 2017 16:21
konikodes sends brownie points to @mot01 :sparkles: :thumbsup: :sparkles:
:cookie: 821 | @mot01 |http://www.freecodecamp.com/mot01
Jorge
@OrangeKulture
Aug 28 2017 16:22
my simon game is done tho ! at least i got that going for me , which is nice
cbot
CamperBot
@camperbot
Aug 28 2017 16:22
you called?
Jorge
@OrangeKulture
Aug 28 2017 16:22
send a which is nice meme
dammit
Toni Shortsleeve
@KoniKodes
Aug 28 2017 16:25
@OrangeKulture I've tried losing on purpose to test the tie and winner messages. When AI wins, it waits for the player's next move before declaring. But if it happens on move 8 and on move 9 the player is the winner, it shows them both and calls it a tie.
@OrangeKulture I haven't started Simon yet.
Jorge
@OrangeKulture
Aug 28 2017 16:25
yeah it happened to me too .. declaring a draw when someone wins on move 8 or 9 .. kinda sucks
Toni Shortsleeve
@KoniKodes
Aug 28 2017 16:26
I don't know how to fix it yet.
Jorge
@OrangeKulture
Aug 28 2017 16:26
im starting to think, i might need to re do the comp turns logic from zero :S
maybe we can pair program or something
anyhow .. here's my Simon in case u guys wanna check it out
Tom
@moT01
Aug 28 2017 16:27
yea i checked it out a couple days ago, turned out great
bookmarked the site you got those sounds from
i couldn't find much for mine
Jorge
@OrangeKulture
Aug 28 2017 16:28
ahh right! yeah u did see it, awesome, thanks man ..
Jorge
@OrangeKulture
Aug 28 2017 16:29
yeah i was working on the mean auth app .. finished that too. Im only missing the god forsaken tic tac toe to finally get the cert .. after all this time
Toni Shortsleeve
@KoniKodes
Aug 28 2017 16:29
@OrangeKulture Simon looks great!
Jorge
@OrangeKulture
Aug 28 2017 16:30
Tom's simon looks pretty awesome too, great job
@KoniKodes thanks!
CamperBot
@camperbot
Aug 28 2017 16:30
orangekulture sends brownie points to @konikodes :sparkles: :thumbsup: :sparkles:
:cookie: 395 | @konikodes |http://www.freecodecamp.com/konikodes
Tom
@moT01
Aug 28 2017 16:30
check the responsiveness, to the browser anyway
Toni Shortsleeve
@KoniKodes
Aug 28 2017 16:31
@moT01 Yours looks great too!
Tom
@moT01
Aug 28 2017 16:31
thanks @KoniKodes @OrangeKulture yea i liked how that one turned out
CamperBot
@camperbot
Aug 28 2017 16:31
mot01 sends brownie points to @konikodes and @orangekulture :sparkles: :thumbsup: :sparkles:
:cookie: 396 | @konikodes |http://www.freecodecamp.com/konikodes
:cookie: 445 | @orangekulture |http://www.freecodecamp.com/orangekulture
Toni Shortsleeve
@KoniKodes
Aug 28 2017 16:32
@OrangeKulture Here's my current tic-tac-toe https://codepen.io/KoniKodes/pen/KqyLML
Tom
@moT01
Aug 28 2017 16:34
ha
Bigyan Karki
@bigyankarki
Aug 28 2017 16:34
Jorge
@OrangeKulture
Aug 28 2017 16:34
@KoniKodes ohh wow! i love the twist you gave it with the icons .. instead of x and o's
Tom
@moT01
Aug 28 2017 16:34
nice music
Bigyan Karki
@bigyankarki
Aug 28 2017 16:34
i cleared things up
Jorge
@OrangeKulture
Aug 28 2017 16:34
yeah .. sound effects are prime!
Tom
@moT01
Aug 28 2017 16:35
looks good @KoniKodes needs a little work but its close
Toni Shortsleeve
@KoniKodes
Aug 28 2017 16:35
@moT01 Thank you. I just need to fix those last two issues...
CamperBot
@camperbot
Aug 28 2017 16:35
konikodes sends brownie points to @mot01 :sparkles: :thumbsup: :sparkles:
:warning: konikodes already gave mot01 points
Toni Shortsleeve
@KoniKodes
Aug 28 2017 16:36
@OrangeKulture Thank you. I'm sticking to tropical and beach themes.
CamperBot
@camperbot
Aug 28 2017 16:36
konikodes sends brownie points to @orangekulture :sparkles: :thumbsup: :sparkles:
:cookie: 446 | @orangekulture |http://www.freecodecamp.com/orangekulture
korzo
@korzo
Aug 28 2017 16:37
@KoniKodes Also with quick fingers you can always win.
Just click 3 fields before computer's turn
Toni Shortsleeve
@KoniKodes
Aug 28 2017 16:38
@bigyankarki It looks better for codepen. Where is the function that kicks in when the "submit" button is clicked?
Jorge
@OrangeKulture
Aug 28 2017 16:38
@KoniKodes yeah looks awesome, im from a pretty tropical place myself, so I can relate :sunglasses:
Toni Shortsleeve
@KoniKodes
Aug 28 2017 16:39
@korzo Ouch! LI set it so the computer gives a moment before placing because some of the others I've seen were so fast that I didn't know for sure if I played my own move.
@OrangeKulture Where's your home?
Tom
@moT01
Aug 28 2017 16:39
@KoniKodes its in the html
i dont see a #shippingType though
Toni Shortsleeve
@KoniKodes
Aug 28 2017 16:41
@moT01 That might be the issue. Sometimes calling from my html doesn't work. I have to call from javascript onclick function. I think it has something to do with when js loads.
Jorge
@OrangeKulture
Aug 28 2017 16:41
@KoniKodes im from Costa Rica :palm_tree:
Toni Shortsleeve
@KoniKodes
Aug 28 2017 16:42
@OrangeKulture Waikiki :-)
Currently in Carlsbad, CA
Tom
@moT01
Aug 28 2017 16:42
it does seem to work, i added an alert before the if test and it fired
Jorge
@OrangeKulture
Aug 28 2017 16:42
yeah i saw that .. havent been to Hawaii yet .. someday, hopefully
Toni Shortsleeve
@KoniKodes
Aug 28 2017 16:45
@OrangeKulture It's a great place. I haven't been to Costa Rica yet either.
Jorge
@OrangeKulture
Aug 28 2017 16:46
it is pretty nice down here, very relaxing
korzo
@korzo
Aug 28 2017 16:47
@KoniKodes Also there is some massive memory leak, because when I'm playing, memory goes up to 3GB and then tab crashes.
Toni Shortsleeve
@KoniKodes
Aug 28 2017 16:48
@moT01 Should it have "return function()" instead of only calling the function?
Tom
@moT01
Aug 28 2017 16:49
that's probly not how i would have done it
Toni Shortsleeve
@KoniKodes
Aug 28 2017 16:49
@korzo Really!? Thanks, I need to check that out.
CamperBot
@camperbot
Aug 28 2017 16:49
konikodes sends brownie points to @korzo :sparkles: :thumbsup: :sparkles:
:cookie: 419 | @korzo |http://www.freecodecamp.com/korzo
Toni Shortsleeve
@KoniKodes
Aug 28 2017 16:52
@moT01 Is Shipping type the shipping array for the 3 choices?
@korzo Did it crash on the first game, or on the reset?
Tom
@moT01
Aug 28 2017 16:56
i assume it's supposed to be
Toni Shortsleeve
@KoniKodes
Aug 28 2017 17:03
@moT01 I see what you mean. @bigyankarki You are validating on id='shippingType" but I can't find that id in the html.
Jorge
@OrangeKulture
Aug 28 2017 17:04
u guys talking about the shipping form?
ahh ok i see the pen
Toni Shortsleeve
@KoniKodes
Aug 28 2017 17:05
Yes
Jorge
@OrangeKulture
Aug 28 2017 17:06
angular forms are solid .. i would probs do that
Toni Shortsleeve
@KoniKodes
Aug 28 2017 17:08
It looks good. Just need to call the validation with id.
Can I see your tictactoe?
@OrangeKulture
korzo
@korzo
Aug 28 2017 17:12
@KoniKodes I was trying to click as many as possible fields before computer (max is 5) so I assume it was like 7th or 8th game
Toni Shortsleeve
@KoniKodes
Aug 28 2017 17:12
@korzo I feel better. I think it should only run 2 times to pass the user story.
Jorge
@OrangeKulture
Aug 28 2017 17:14
@KoniKodes sry lost internet, yeah for sure .. im working on it, so it's kinda broken, but u can at least see the UI
forgot to set compturn to false, so it might work kinda weird on the first turn
Toni Shortsleeve
@KoniKodes
Aug 28 2017 17:17
@OrangeKulture Yes, it places me in the middle before I begin. We seem to have similar logic. I like the different feedback you give to the user.
Marat
@Marat89bluolyu
Aug 28 2017 17:17
Hi all. I need output array from function with interval 1 second one by one. Now in my code values output at once.
function arrayCounter(arr) {
    for (var i = 0; i<arr.length; i++) {
        (function (inner) {
            setTimeout( function() {
                console.log(arr[inner]);
            }, 1000)
        })(i);
    }
 }   

arrayCounter([1,2,3,4,5]);
Jorge
@OrangeKulture
Aug 28 2017 17:18
nah the circle is the computer's turn .. it chose the middle one, then it 's supposed to be your turn
thanks a lot tho!, appreciate it .. still need to work on the check score and selection a little bit
i might settle for not making it unbeatable right now .. i mean, it's not a required user story and ive already spent a lot of time on this
@Marat89bluolyu setTimeout will only run once
Marat
@Marat89bluolyu
Aug 28 2017 17:20
@OrangeKulture, yep but if we have a loop?
Jorge
@OrangeKulture
Aug 28 2017 17:20
its best if u dont do functions inside loops
its a little bit of a leak
what u want is to output the content of the array, one by one, at 1 sec interval, yeah?
Marat
@Marat89bluolyu
Aug 28 2017 17:22
@OrangeKulture yes
korzo
@korzo
Aug 28 2017 17:23
image.png
@KoniKodes
Marat
@Marat89bluolyu
Aug 28 2017 17:23
@OrangeKulture i want to get output: 1, then in one sec. 2 ... etc
Jorge
@OrangeKulture
Aug 28 2017 17:23
if that is the case, then u wanna do:
let counter = 1;

let timer = setInterval(function(){
  console.log(arr[counter-1]);
  counter++;

if(counter>arr.length){
 clearInterval(timer);
}
},1000)
Toni Shortsleeve
@KoniKodes
Aug 28 2017 17:23
@korzo Wow. Thanks for catching that. Still have some work to do..
CamperBot
@camperbot
Aug 28 2017 17:23
konikodes sends brownie points to @korzo :sparkles: :thumbsup: :sparkles:
:warning: konikodes already gave korzo points
Jorge
@OrangeKulture
Aug 28 2017 17:24
@Marat89bluolyu something along those lines
Toni Shortsleeve
@KoniKodes
Aug 28 2017 17:25
@Marat89bluolyu Try setInterval instead
Marat
@Marat89bluolyu
Aug 28 2017 17:25
@OrangeKulture thanks, this example will be work in ES5?
CamperBot
@camperbot
Aug 28 2017 17:25
marat89bluolyu sends brownie points to @orangekulture :sparkles: :thumbsup: :sparkles:
:cookie: 447 | @orangekulture |http://www.freecodecamp.com/orangekulture
Marat
@Marat89bluolyu
Aug 28 2017 17:25
with var?
Jorge
@OrangeKulture
Aug 28 2017 17:25
@Marat89bluolyu yeah for sure .. you can use var
i would recommend using let and const tho, makes things a lot smoother, not to mention, scope
Marat
@Marat89bluolyu
Aug 28 2017 17:27
@OrangeKulture yeah, ES6 make coding fill better =)
Toni Shortsleeve
@KoniKodes
Aug 28 2017 17:27
@OrangeKulture I thought I was "O". It works when I'm "X". But it isn't calling the draw/tie.
Jorge
@OrangeKulture
Aug 28 2017 17:27
yeah completely .. specially arrow functions
Toni Shortsleeve
@KoniKodes
Aug 28 2017 17:28
I'm still trying to grasp ES6
Jorge
@OrangeKulture
Aug 28 2017 17:28
@KoniKodes yeah that's what i meant that it's broken .. im working on the checkScore
Toni Shortsleeve
@KoniKodes
Aug 28 2017 17:28
That's where mine is too.
Jorge
@OrangeKulture
Aug 28 2017 17:29
yeah i think im gonna handle depending on the number of moves .. if it gets called by computer when it has 3 moves, then do this .. if its called by comp when it has 4 moves, do this .. and so on
Jorge
@OrangeKulture
Aug 28 2017 17:42
.
.
sry, updating info
Liam Docherty
@ldocherty1
Aug 28 2017 18:29
Hi, does anyone know why my bg-dark within my footer isn't correctly working? It doesn't display. https://jsfiddle.net/91px2chw/
korzo
@korzo
Aug 28 2017 18:35
@ldocherty1 It works, but color is #fff
Liam Docherty
@ldocherty1
Aug 28 2017 18:37
@korzo I wanted the footer background to be bg-dark which doesn't display?
korzo
@korzo
Aug 28 2017 18:37
@ldocherty1 there is no css declaration for bg-dark
Liam Docherty
@ldocherty1
Aug 28 2017 18:42
@korzo My bad just realised my mistake
Adinarayana Raghu
@adinarayaanraghu95
Aug 28 2017 19:43
Hey.
I am looking for developers to collaborate for a social education project
Jorge
@OrangeKulture
Aug 28 2017 20:12
@adinarayaanraghu95 what's it about?
Adam Faraj
@adamfaraj
Aug 28 2017 21:00
hello everyone
was hoping someone here can help me
i'm trying to access the text within my <div class="wthr"></div>
Rafael Monroy
@rafaelmonroy
Aug 28 2017 21:04

hey everyone, I am having a hard time with ajax, posting on twitter with ajax, can someone lend a hand? here is my code so far.


$(document).ready(function(){

  $("#btn").on("click", function(){
    $("#tweet").delay(1500).fadeIn();
    $.ajax({
      type: "GET",
      url: "https://talaikis.com/api/quotes/random/",
      success: function(quotes){
          $("#quote").html("Author: "+quotes.author+"<br> Quote: "+quotes.quote+"<br>")
      },
      error: function(){
        alert("error loading quotes");
      }
    }) 
  });

  $("#tweet").on("click", function(){
    var tweet = {
      tweetQuote: "test"
    };
    $.ajax({
      type:"POST",
      datatype:"jsonp",
      url: "https://api.twitter.com/1.1/statuses/update.json",
      data: tweet,
      success: function(){
        console.log("tweet sent");
      },
      error: function(){
        alert("error sending tweet");
      }
    })
  });

});

i keet getting my error message when i try to POST my quote

Mercy Manrique
@mers89
Aug 28 2017 21:08
I had a question on the Twitch API. should my link to the API url work when the channel is offline? It was working fine on Friday when it was showing it was online I had created a link to https://wind-bow.glitch.me/twitch-api/streams/freecodecamp
iso
@iso1048
Aug 28 2017 21:09
@rafaelmonroy dont know about POST but it is easier to use a tweet web intent: https://dev.twitter.com/web/tweet-button/web-intent, https://dev.twitter.com/web/tweet-button. if you do want to use a tweet web intent, those links will be helpful
Rafael Monroy
@rafaelmonroy
Aug 28 2017 21:10
@gothamknight thanks!
CamperBot
@camperbot
Aug 28 2017 21:10
rafaelmonroy sends brownie points to @gothamknight :sparkles: :thumbsup: :sparkles:
:cookie: 404 | @gothamknight |http://www.freecodecamp.com/gothamknight
Mercy Manrique
@mers89
Aug 28 2017 21:13
@gothamknight do you mind helping me on my code. It was the same as Fiday? I dont know why it stopped working
Johnny
@jtan3
Aug 28 2017 21:13
@rafaelmonroy sometimes channels will be offline. You can just provide their url when they're offline.
iso
@iso1048
Aug 28 2017 21:14
@mers89 when the user is online, you can access the data using https://wind-bow.glitch.me/twitch-api/streams/freecodecamp. when the user is offline, you can make a new ajax call using the channel route https://wind-bow.glitch.me/twitch-api/channels/freecodecamp
Mercy Manrique
@mers89
Aug 28 2017 21:15
@gothamknight so when the user is offline there is no access to the data using the same link
Ayush Bahuguna
@relentless-coder
Aug 28 2017 21:15
Need some help with css
https://codepen.io/ayushb/pen/EverBx
I am trying to have the tiny dots before the links in the sub menu the way it appears on the main menu item
iso
@iso1048
Aug 28 2017 21:16
@mers89 yeah
Jorge
@OrangeKulture
Aug 28 2017 21:19
@adamfaraj what seems to be the problem?
Adam Faraj
@adamfaraj
Aug 28 2017 21:20
@OrangeKulture i want to change the weather icon based on what the weather is, ie: clear, rain, clouds, etc
iso
@iso1048
Aug 28 2017 21:21
@mers89 so when you make the first ajax call using the streams route, you can check if json.stream == null. If so, then make a new ajax call using the channels route (if you want to get data). If json.stream !== null, then you can access the data in the json of the first ajax call. That is just one way to do it. Does that make sense?
Mercy Manrique
@mers89
Aug 28 2017 21:21
@jtan3 I was just tryng to see if my code was broken or if it was just an online/offline thing. Ir was working fine on friday
Adam Faraj
@adamfaraj
Aug 28 2017 21:21
so i wanted to do an if else statement @OrangeKulture . ```if (dom.wthr[0].innerHTML == "Clear") { then change picture, etc etc}
console.log(dom.wthr) gives me the object
won't let me access the text within that div
iso
@iso1048
Aug 28 2017 21:23
@adamfaraj can you not access the url for the image from the json?
Johnny
@jtan3
Aug 28 2017 21:24
@mers89 if you provide your codepen it would easier to see the problem.
Mercy Manrique
@mers89
Aug 28 2017 21:24
@gothamknight @jtan3 it's the section where it says "Free Code Camp is currently offline. Before I was able to click and it would take me to the URL of twitch TV for FCC
Ayush Bahuguna
@relentless-coder
Aug 28 2017 21:26
@mers89 I think a good way to test your project is get more data, you can have more data from twitch's api. But I had worked on that problem a long time ago, and maybe things have changed.
Johnny
@jtan3
Aug 28 2017 21:27
@mers89 you haven't linked the offline part to anything yet ?
Mercy Manrique
@mers89
Aug 28 2017 21:27
@ayush but isnt a URL a URL link or does the API override that. Im not sure whether the channel being offline breaks the link'
Ayush Bahuguna
@relentless-coder
Aug 28 2017 21:30
@mers89 @jtan3 twitch api works without client id??!!!
Johnny
@jtan3
Aug 28 2017 21:31
@relentless-coder yes with the new https://wind-bow.glitch.me/twitch-api/streams/ESL_SC2
iso
@iso1048
Aug 28 2017 21:31
@relentless-coder using a different endpoint, so yeah.
@mers89 Could you rephrase your question - I'm not sure what you are asking.
Adam Faraj
@adamfaraj
Aug 28 2017 21:33
@gothamknight i don't have a url for the images
Ayush Bahuguna
@relentless-coder
Aug 28 2017 21:35
@gothamknight but does this work if I want to fetch all the live streams?
iso
@iso1048
Aug 28 2017 21:35
@adamfaraj so you want to have like a background image or something which changes based on the weather?
Mercy Manrique
@mers89
Aug 28 2017 21:36
@gothamknight I was using var url= "https://wind-bow.glitch.me/twitch-api/streams/freecodecamp"; and it will create a link on my page that said "Free Code Camp is currently offline/online" and you can click on it and it would take you to the URL. Today that I looked at it that the channel was offline it just showed up at text on the page saying it was offline and it wasnt a link anymore
Jorge
@OrangeKulture
Aug 28 2017 21:36
@adamfaraj sry.. spaced out for a sec .. looking now
@adamfaraj i see you do have the Clouds displayed... isnt that from the json?
Johnny
@jtan3
Aug 28 2017 21:38
@mers89 you need use an a tag and provide the stream's url from the api's data.
Jorge
@OrangeKulture
Aug 28 2017 21:39
@mers89 u also have to take into account that when u do set it up correctly, the link might take you to the channel within the twitch website, but it wont work .. only way it works is on debug mode
iso
@iso1048
Aug 28 2017 21:40
@mers89 I am not sure what is happening there. You could try seeing what happens when you use a user who is online.
@relentless-coder I have only used that endpoint for what the fCC challenge required.
Adam Faraj
@adamfaraj
Aug 28 2017 21:41
@OrangeKulture yes, but i hate those pictures. i have new pictures i want to use based on the weather
Jorge
@OrangeKulture
Aug 28 2017 21:42
@adamfaraj right, i understand .. yeah i would handle the logic differently, u dont need to create all those dom nodes
u can just create one, and fill it with data depending on the weather
Mercy Manrique
@mers89
Aug 28 2017 21:42
@jtan3 @gothamknight @OrangeKulture thanks. Ill try putting a user that is online like gotham said. Thanks for your help. I wasnt sure if I was trying to fix something that wasnt broken
CamperBot
@camperbot
Aug 28 2017 21:42
mers89 sends brownie points to @jtan3 and @gothamknight and @orangekulture :sparkles: :thumbsup: :sparkles:
:cookie: 405 | @gothamknight |http://www.freecodecamp.com/gothamknight
:cookie: 448 | @orangekulture |http://www.freecodecamp.com/orangekulture
:cookie: 458 | @jtan3 |http://www.freecodecamp.com/jtan3
iso
@iso1048
Aug 28 2017 21:43
@mers89 no problem. good luck!
Jorge
@OrangeKulture
Aug 28 2017 21:43
@mers89 your call is actually good .. i just tested, u said you wanted it to be a link tho, right? it doesnt have an anchor tag or an event handler, thats why its not a link atm
Mercy Manrique
@mers89
Aug 28 2017 21:45
@OrangeKulture really? yes that is what I was trying to do
Adam Faraj
@adamfaraj
Aug 28 2017 21:45
@OrangeKulture right, but i want to fill it based on what the wthr is, and i can't even access what the weather is. haha. Clear, Clouds, etc
Jorge
@OrangeKulture
Aug 28 2017 21:46
@mers89 yeah , i mean there is nothing binding to a link .. the Free Code Camp title is an h2 tag ..
u would need to either, create an anchor tag and wrap that h2, like so: <a href="www.fcctwitch.com target="_blank"><h2>FCC</h2></a>
something like that
@adamfaraj yeah the thing with your code is that you are using a promise for the ajax call, i kinda hate promises hahah.. so i dont use em as much .. but what i would do is, find the key value pair that'll give you the weather
iso
@iso1048
Aug 28 2017 21:47
@adamfaraj you could check in the json itself for the description of the weather
Jorge
@OrangeKulture
Aug 28 2017 21:49
yeah it all depends on the response you are getting ... can u show the json object you get when making a call to that API?
endpoint ^
iso
@iso1048
Aug 28 2017 21:50
@adamfaraj a problem you might have is that you may not know all the possible weather descriptions that could be displayed, so you might have a situation where the description is displayed but it does not have an associated image.
Adam Faraj
@adamfaraj
Aug 28 2017 21:52
exactly, i was thinking that earlier
Moustapha
@moustaflo
Aug 28 2017 21:53

I am working on the Simon game and I still can't figure out why it starts to ring twice
my link is https://codepen.io/moustaflo/full/ayqYLX/

it could be my variable called len in the if function. That is the only suspicion I have. When I alter it, it definitely sounds different

Jorge
@OrangeKulture
Aug 28 2017 21:55
@adamfaraj u can have fallback images, in any case, what is the piece of info you want the icon to be based on? description or main?
iso
@iso1048
Aug 28 2017 21:58
@adamfaraj if you really want to do it, you could use the darksky api - they give a list of their 'main' weather descriptions, but then you would probably need to make another ajax call using a different service to get location data...
Colin
@finkbeca
Aug 28 2017 22:03
Hey I am trying to create a new element with the value from input does anyone know what might be wrong with my js <body>
<div>
<div>
<ol id = "output"></ol>
</div>
<form>
<input class = 'todolist'>
<button class = "add" onclick = "tDList()"> Add</button>
    </form>
</div>

<script>
    function tDList() {
        var item = document.getElementsByClassName("todolist");
        var itemString = document.createTextNode(item);
        var newItem = document.createElement("li");
        newItem.appendChild(itemString);
        document.getElementById("output").appendChild(newItem);
    }


</script>
</body>
<body>
<div>
<div>
<ol id = "output"></ol>
</div>
<form>
<input class = 'todolist'>
<button class = "add" onclick = "tDList()"> Add</button>
</form>
</div>

<script>
function tDList() {
var item = document.getElementsByClassName("todolist");
var itemString = document.createTextNode(item);
var newItem = document.createElement("li");
newItem.appendChild(itemString);
document.getElementById("output").appendChild(newItem);
}


</script>
</body>
Im sorry I dont know why it is not loading correctly
Jorge
@OrangeKulture
Aug 28 2017 22:05
your input needs to have a type
are u working on codepen?
Rafael Monroy
@rafaelmonroy
Aug 28 2017 22:07
can anyone tell me why my tweet button tries to tweet out an object? when i console log it, it shows as an empty object :/
https://codepen.io/rafaelmonroy/pen/prKMXZ?editors=1111
Colin
@finkbeca
Aug 28 2017 22:07
@OrangeKulture Nope, brackets. I added type = "text" and if is still not working Ill add it to codepen real fast.
korzo
@korzo
Aug 28 2017 22:10
@finkbeca Because it submit form and refresh page
You have to add event listener and preventDefault on form submit
Colin
@finkbeca
Aug 28 2017 22:11
Could you give an example? @korzo
I don't have much experience working with js
korzo
@korzo
Aug 28 2017 22:12
@korzo or add type="button" to your <button>
default type for button is submit
iso
@iso1048
Aug 28 2017 22:14
@rafaelmonroy var text = $('#quote-holder').html(); maybe
Colin
@finkbeca
Aug 28 2017 22:14
@korzo so now when I load it in codepen it shows [object HTML Collection] but when i try this in a local host nothing happens
Rafael Monroy
@rafaelmonroy
Aug 28 2017 22:16
@gothamknight that worked but it brings a long the <br> tags
korzo
@korzo
Aug 28 2017 22:17
@finkbeca bacause you append HTML Node, not text
Jorge
@OrangeKulture
Aug 28 2017 22:17
yeah i was gonna say that append looks a little bit off ..
why not use jquery?
iso
@iso1048
Aug 28 2017 22:18
@rafaelmonroy that is because you have the <br> tag in the html of that div
Rafael Monroy
@rafaelmonroy
Aug 28 2017 22:18
@gothamknight is it possible to filter them out?
Colin
@finkbeca
Aug 28 2017 22:18
@korzo Could you explain?
@OrangeKulture I didn't know jquery would be of use
and I dont know jquery lol
Jorge
@OrangeKulture
Aug 28 2017 22:20
yeah jquery would make it a lot easier
first off, what are you trying to do ?
korzo
@korzo
Aug 28 2017 22:20
@finkbeca item is array of objects, not text
Jorge
@OrangeKulture
Aug 28 2017 22:20
are you trying to type something, click add and have that added to a list? right
korzo
@korzo
Aug 28 2017 22:20
@finkbeca you need item[0].value
Colin
@finkbeca
Aug 28 2017 22:20
@OrangeKulture Yes
iso
@iso1048
Aug 28 2017 22:21
@rafaelmonroy try this:
var text=$('#quote-holder').html();
text = text.replace('<br>','\n');
Colin
@finkbeca
Aug 28 2017 22:21
@korzo Thank you korzo for trying to help but I think I need to take a step back
CamperBot
@camperbot
Aug 28 2017 22:21
finkbeca sends brownie points to @korzo :sparkles: :thumbsup: :sparkles:
:cookie: 423 | @korzo |http://www.freecodecamp.com/korzo
korzo
@korzo
Aug 28 2017 22:21
@finkbeca add console.dir(item); after
@finkbeca and you will understand
Colin
@finkbeca
Aug 28 2017 22:22
@korzo but I dont understand what you are saying currently
iso
@iso1048
Aug 28 2017 22:23
@rafaelmonroy
var text=$('#quote-holder').html().replace(/<br>/g,'\n');use that
Colin
@finkbeca
Aug 28 2017 22:23
@finkbeca I understand you are telling me to add things but if I dont understand the why , it is no help. Thanks for the attempt to help I appreciate it , it is just not helping lol.
CamperBot
@camperbot
Aug 28 2017 22:23
sorry finkbeca, you can't send brownie points to yourself! :sparkles: :sparkles:
korzo
@korzo
Aug 28 2017 22:24
@finkbeca document.getElementsByClassName returns array
of objects
input elements (<input> ) is object in javascript
You can get what is written in input from value property
Rafael Monroy
@rafaelmonroy
Aug 28 2017 22:26
@gothamknight thanks man! i replaced the br with “” instead of \n what is \n?
CamperBot
@camperbot
Aug 28 2017 22:26
rafaelmonroy sends brownie points to @gothamknight :sparkles: :thumbsup: :sparkles:
:cookie: 406 | @gothamknight |http://www.freecodecamp.com/gothamknight
piteto
@piteto
Aug 28 2017 22:27
@rafaelmonroy can you use .text() instead of .html()?
iso
@iso1048
Aug 28 2017 22:27
@rafaelmonroy no worries. /n is a line break, but it does not seem to work exactly as planned
korzo
@korzo
Aug 28 2017 22:27
@finkbeca So to make your script work you need to replace line 14 with var item = document.getElementsByClassName("todolist")[0].value;
iso
@iso1048
Aug 28 2017 22:28
@piteto did not even think of that.
piteto
@piteto
Aug 28 2017 22:29
in js, we would just use textContent instead of innerHTML if we don't want the html
Rafael Monroy
@rafaelmonroy
Aug 28 2017 22:29
@piteto yeah that works too, then there is no need for the replace. good one, thanks guys!
CamperBot
@camperbot
Aug 28 2017 22:29
rafaelmonroy sends brownie points to @piteto :sparkles: :thumbsup: :sparkles:
:warning: @piteto's account is not linked with freeCodeCamp. Please visit the settings and link your GitHub account.
piteto
@piteto
Aug 28 2017 22:29
assume it's similar in jquery
Jorge
@OrangeKulture
Aug 28 2017 22:29
@finkbeca try this: Example
@finkbeca if u open the console, you'll see whatever you enter in the text field
Colin
@finkbeca
Aug 28 2017 22:31
@OrangeKulture Thanks, any way to display it on screen?
CamperBot
@camperbot
Aug 28 2017 22:31
finkbeca sends brownie points to @orangekulture :sparkles: :thumbsup: :sparkles:
:cookie: 449 | @orangekulture |http://www.freecodecamp.com/orangekulture
Jorge
@OrangeKulture
Aug 28 2017 22:31
@finkbeca yeah i just console logged it so you can see it .. from there, you can definitely do what you would like .. let me show you
Colin
@finkbeca
Aug 28 2017 22:33
ok
Jorge
@OrangeKulture
Aug 28 2017 22:35
@finkbeca try again
something like that .. i mean depends on what you wanna do and all, probably best to do appendChild
or something along those lines
Colin
@finkbeca
Aug 28 2017 22:36
thanks
Rafael Monroy
@rafaelmonroy
Aug 28 2017 22:37
@gothamknight @piteto do you guys know if it is possible to filter out the data coming in my GET request to only those that have length of 150 character or less ?
I was thinking about using a if else statement
Jorge
@OrangeKulture
Aug 28 2017 22:41
@rafaelmonroy u cannot condition a response from the server .. not unless it accepts parameters in your call
Rafael Monroy
@rafaelmonroy
Aug 28 2017 22:44
@OrangeKulture what do you mean by “not unless it accepts parameters in your call"
Jorge
@OrangeKulture
Aug 28 2017 22:46
you can pass in certain parameters in your headers when making a call to an API ..
generally speaking tho, you cant just ask the server for some data and filter the incoming data. What you can do, is once you have the response, then mess with the data in whatever way u need
Rafael Monroy
@rafaelmonroy
Aug 28 2017 22:49
can i pass the data into a vairable from the call?
@OrangeKulture
in the success function?
Jorge
@OrangeKulture
Aug 28 2017 22:49
@rafaelmonroy yeap exactly .. thats a good way to manipulate the data
hifede
@hifede
Aug 28 2017 22:50
hi guys! currently trying to put together my portfolio profile and i'm stuck with a few things... right now i'm trying to get the images under "work" to all be square shaped and the same size. could anyone help me pls ? https://codepen.io/arolf_flora/pen/XajbJa
Rafael Monroy
@rafaelmonroy
Aug 28 2017 22:50
@OrangeKulture nice, alright thanks man, im going mess around with it a bit more.
CamperBot
@camperbot
Aug 28 2017 22:50
rafaelmonroy sends brownie points to @orangekulture :sparkles: :thumbsup: :sparkles:
:cookie: 450 | @orangekulture |http://www.freecodecamp.com/orangekulture
Jorge
@OrangeKulture
Aug 28 2017 22:51
@rafaelmonroy sure thing, if u still have some doubts, drop a msg in here .. always someone willing to help out
@hifede i would probably have the images inside a containing element, like a div .. then i would specify a width and hide for all images inside that div
@hifede also .. make sure you have the right thumbnail class .. i use bootstrap 3, so i know its img-thumbnail, im not sure if it changed for bootstrap 4