These are chat archives for FreeCodeCamp/HelpFrontEnd

3rd
Apr 2018
Greg Engler
@gmengler
Apr 03 2018 03:01
hey folks, currently working on the random quote generator and having a lot of trouble with the twitter API. I've been trying to decipher Twitter's documentation with no luck - any guidance anyone could provide?
JoEezy
@JoEeeezy_twitter
Apr 03 2018 03:30
@gmengler // Twitter Button $("#twitter").on("click", function() { $("#tweetit").attr("href", 'https://twitter.com/intent/tweet?text=' + "\"" + $("#quotetext").text() + "\" " + " -" + $("#author").text()); });
Greg Engler
@gmengler
Apr 03 2018 03:30
nevermind, figured i out
it*
hah, thanks Jo
JoEezy
@JoEeeezy_twitter
Apr 03 2018 03:30
@gmengler np :smile: i had the same problem... looking thru docs for an hour+ before realizing i can just do it with a link lol
Greg Engler
@gmengler
Apr 03 2018 03:31
actually figured it out through the docs surprisingly, and that never happens
JoEezy
@JoEeeezy_twitter
Apr 03 2018 03:32
haha nice ... i'm in the same boat right now with bootstrap doc
trying to figure out how to make the form and the "search wikipedia" button centered thru bootstrap
i know it can be done with css with margins but i'm trying to learn the bootstrap way for responsive content
Greg Engler
@gmengler
Apr 03 2018 03:34
hmmm I think I've dealt with something like that before, lemme check
does codepen automatically "run" your code when you make an edit or do you have to click something?
JoEezy
@JoEeeezy_twitter
Apr 03 2018 03:39
it usually autoruns but i believe theres an option in settings to turn that off (in case you're using apis and dont' want it calling everytime you edit)
abraham anak agung
@padunk
Apr 03 2018 03:42
you could turn it off in setting -> behavior -> auto updating preview
Greg Engler
@gmengler
Apr 03 2018 03:46
@JoEeeezy_twitter definitely struggling to get that centered
laowong
@shanxilaowang
Apr 03 2018 03:46
英文好难啊
JoEezy
@JoEeeezy_twitter
Apr 03 2018 03:46
@gmengler even though it seems so straightforward in the docs.. the bootstrap grid confuses me when i start using it
@gmengler i just ended up using css :eyes: :
Greg Engler
@gmengler
Apr 03 2018 03:48
did it work?
JoEezy
@JoEeeezy_twitter
Apr 03 2018 03:48
yeah i used this:
.center-block {
    margin-left: auto;
    margin-right: auto;
    display: block;
}
Greg Engler
@gmengler
Apr 03 2018 03:49
nice - you might be able to get it working with bootstrap by making the columns smaller, but not sure
it's been a while since I was really using bootstrap
JoEezy
@JoEeeezy_twitter
Apr 03 2018 03:52
same here ... i kind of rushed through the bootstrap tutorials to get to javascript :smile:
Ken Haduch
@khaduch
Apr 03 2018 04:24
@JoEeeezy_twitter - looks like you are using bootstrap 4 - it uses flexbox, and there is a class that does the center alignment - justify-content-center
Dhaval Vira
@dhavalveera
Apr 03 2018 04:25
@khaduch I've used display: block; margin-left: auto; margin-right: auto;
it works proper on my page
Ken Haduch
@khaduch
Apr 03 2018 04:42
@dhavalveera - yes, I think that @JoEeeezy_twitter was trying to use bootstrap, if you look at his comments from a while ago. So i just looked up the information and listed it. (For Bootstrap V4.)
Dhaval Vira
@dhavalveera
Apr 03 2018 04:43
then put just-content: center in tag
in HTML
then maybe it works
Ken Haduch
@khaduch
Apr 03 2018 04:45
@dhavalveera - yes, but bootstrap has a class that sets that property. If you're intent on using Bootstrap, at least in v4, that's what they provide. You can always add custom CSS if you want to. If not, then you can use the classes that they defined. Both should work.
Dhaval Vira
@dhavalveera
Apr 03 2018 04:45
but if we use Bootstrap 4 then we can't the style of that tag
either custom css or in Bootstrap
it is not changing quickly
coderNewby
@coderNewby
Apr 03 2018 05:11
thanks @DarrenfJ for all your help
CamperBot
@camperbot
Apr 03 2018 05:11
codernewby sends brownie points to @darrenfj :sparkles: :thumbsup: :sparkles:
:star2: 2448 | @darrenfj |http://www.freecodecamp.org/darrenfj
habibaatify
@habibatify_twitter
Apr 03 2018 05:30
challange.PNG
i think in that challenge the result will be same why the result is different ?
Ehidin
@eabg
Apr 03 2018 07:29
hey all
I need a little help
Sweet Coding :)
@SweetCodingInc
Apr 03 2018 07:29
@eabg ask away
Ehidin
@eabg
Apr 03 2018 07:29
not understanding what is the missing link in this code:
Screen Shot 2018-04-03 at 12.11.01 AM.png
Screen Shot 2018-04-03 at 12.11.18 AM.png
Sweet Coding :)
@SweetCodingInc
Apr 03 2018 07:30
@eabg it should be $('.btn').on('click'....
you're missing . before btn
Ehidin
@eabg
Apr 03 2018 07:31
oh man really? let me check it out
Sweet Coding :)
@SweetCodingInc
Apr 03 2018 07:31
and also, in your html, there is no element that has class="btn"
so it's not going to work either way
Do you want to attach event handlers to all your buttons?
From the html you've shared, you need to do
$('button').on('click'....
Ehidin
@eabg
Apr 03 2018 07:34
I orginally had button with no luck
so I tried that out and nothing
Sweet Coding :)
@SweetCodingInc
Apr 03 2018 07:35
what do you want to happen when you click the button?
The event handler doesn't look right to me
Ehidin
@eabg
Apr 03 2018 07:36
so im just trying to add some css changes to boxes..later do animate
Sweet Coding :)
@SweetCodingInc
Apr 03 2018 07:36
With your code, let's say you click on the button 1. Then the clickButtonId will be btn1
and your selector will be#box1btn1
and there is no element with id="box1btn1"
Ehidin
@eabg
Apr 03 2018 07:39
let me show you this. this was an earlier test and it was working before:
Screen Shot 2018-04-03 at 12.38.45 AM.png
I wanted to start over cause an element got lost and i couldnt get it working again
Sweet Coding :)
@SweetCodingInc
Apr 03 2018 07:41
@eabg you're better off using data attribute to target specific box
I'll show you an example
Ann Kaniga
@annkaniga
Apr 03 2018 07:42
@eabg did u try any debug?
Ehidin
@eabg
Apr 03 2018 07:43
in the console? or....
Ann Kaniga
@annkaniga
Apr 03 2018 07:43
yes, is there any red line in console?
i mean browser console
Sweet Coding :)
@SweetCodingInc
Apr 03 2018 07:45
@eabg Check this out
Ehidin
@eabg
Apr 03 2018 07:45
yeah.. so its just having a problem with the ending script tag
ill check it out and let you know
Ehidin
@eabg
Apr 03 2018 07:51
okay yeah I will start over using this method. it seems a lot easier to manage and read
Ehidin
@eabg
Apr 03 2018 07:57
@SweetCodingInc :+1:
Sweet Coding :)
@SweetCodingInc
Apr 03 2018 08:08
@eabg :+1:
John Hawke
@lolativiwe_twitter
Apr 03 2018 08:15
function diffArray(arr1, arr2) {
    var newArr = arr1.concat(arr2);
    newArr.filter(function(index) {
        if (!arr1.includes(index) || !arr2.includes(index)) {
            return newArr;
        }
    });
    console.log(newArr);
}

diffArray([1, 2, 3, 5], [1, 2, 3, 4, 5]);
can someone tell me whats wrong with this?
it always returns the concatenated array of the two
Aditya
@ezioda004
Apr 03 2018 08:20
@lolativiwe_twitter .filter() returns a new array and doesnt mutate the original one so you're returning the concatenated array from the 2nd line
John Hawke
@lolativiwe_twitter
Apr 03 2018 08:22

oh lol...

newArr = newArr.filter(....

this worked

thanks @ezioda004
CamperBot
@camperbot
Apr 03 2018 08:22
lolativiwe_twitter sends brownie points to @ezioda004 :sparkles: :thumbsup: :sparkles:
:cookie: 522 | @ezioda004 |http://www.freecodecamp.org/ezioda004
Stephen James
@sjames1958gm
Apr 03 2018 09:32
@lolativiwe_twitter Since the function should return the new array
return newArr.filter(... would probably be the "best" solution as it makes it clear that the filter is the function result.
steve84
@raynor84
Apr 03 2018 09:41
I'm trying to solve dna-pairing but i don't know how it works... why is GCG dna-pairing GC, CG, GC again
Stephen James
@sjames1958gm
Apr 03 2018 09:42
@raynor84 Each character in the string is paired with its designated value G with C, C with G and G with C again.
@raynor84 The pairing values are given in the instructions
steve84
@raynor84
Apr 03 2018 09:44
ok i get it thanks
@sjames1958gm thx
Aditya Dehal
@aditya2000
Apr 03 2018 09:44
hello
Stephen James
@sjames1958gm
Apr 03 2018 09:46
@sjames1958gm :+1:
Quantomistro3178
@Quantomistro3178
Apr 03 2018 10:06
how do I get the name of the location from the coordinates?
for the weather app
Stephen James
@sjames1958gm
Apr 03 2018 10:16
@Quantomistro3178 There is a name value in the JSON from the FCC URL
Quantomistro3178
@Quantomistro3178
Apr 03 2018 10:20
oh. Thanks @sjames1958gm
CamperBot
@camperbot
Apr 03 2018 10:20
quantomistro3178 sends brownie points to @sjames1958gm :sparkles: :thumbsup: :sparkles:
:star2: 9159 | @sjames1958gm |http://www.freecodecamp.org/sjames1958gm
Stephen James
@sjames1958gm
Apr 03 2018 10:21
@Quantomistro3178 :+1: it is near the end
Quantomistro3178
@Quantomistro3178
Apr 03 2018 10:40
yeah, I found it
is this ok?
Sweet Coding :)
@SweetCodingInc
Apr 03 2018 10:53
@Quantomistro3178 looks okay to me
Quantomistro3178
@Quantomistro3178
Apr 03 2018 10:56
but the the grey background is all messed up, idk what to do about that
Victor Popescu
@VicPopescu
Apr 03 2018 11:03
@Quantomistro3178 what do you mean about gray background?
@Quantomistro3178 maybe something like "background-color: rgba(0,0,0,0.6)" for the "container" div would look a little more appealing?
if that's your concern
I think it looks ok and it works ok
Johny Sins
@JohnySi73551906_twitter
Apr 03 2018 11:10

can someone tell me why

var arr = new Object();
    arr.first = "lorem";
    arr.last = "ipsum";
    console.log(arr.hasOwnProperty('first'));

returns true

but

var Arr = [{first: "lorem", last: "ipsum"}];
    console.log(Arr.hasOwnProperty('first'));

returns false

Victor Popescu
@VicPopescu
Apr 03 2018 11:11
@JohnySi73551906_twitter because arr is an object and Arr is an array
console.log(Arr[0].hasOwnProperty('first'));
you do a for to iterate each object inside the array
Johny Sins
@JohnySi73551906_twitter
Apr 03 2018 11:12
ok
Victor Popescu
@VicPopescu
Apr 03 2018 11:13
if you have only 1 object inside the array you can use the [index] to access it, but if the number of objects is random or unknown you need a for loop
Johny Sins
@JohnySi73551906_twitter
Apr 03 2018 11:14
thanks @VicPopescu
CamperBot
@camperbot
Apr 03 2018 11:14
johnysi73551906_twitter sends brownie points to @vicpopescu :sparkles: :thumbsup: :sparkles:
:cookie: 533 | @vicpopescu |http://www.freecodecamp.org/vicpopescu
Victor Popescu
@VicPopescu
Apr 03 2018 11:14
np, glad to help
joosonmao
@artprince
Apr 03 2018 11:15
Why I can't do like the sample?
I need help
Victor Popescu
@VicPopescu
Apr 03 2018 11:15
@artprince what sample?
Victor Popescu
@VicPopescu
Apr 03 2018 11:15
@artprince and where you stuck at?
joosonmao
@artprince
Apr 03 2018 11:18
is the Pen's setting wrong?
@VicPopescu Can you help me?
Fabien SHAN
@X140hu4
Apr 03 2018 11:25
@artprince Please describe your issue and what you have tried. The more detailed the explanation, the better.
joosonmao
@artprince
Apr 03 2018 11:26
I solved
because not set css in settings.
Johny Sins
@JohnySi73551906_twitter
Apr 03 2018 11:30
@VicPopescu hello! do you know how can i compare two values of different properties?
var arr = [{first: "lorem", last: "ipsum"}, {first: "dolor", last: "sit"}];
Aditya
@ezioda004
Apr 03 2018 11:34
@JohnySi73551906_twitter You want to compare first property of both objects in array?
Johny Sins
@JohnySi73551906_twitter
Apr 03 2018 11:34
something like that, yes
Victor Popescu
@VicPopescu
Apr 03 2018 11:35
@JohnySi73551906_twitter of different properties on the same object?
Johny Sins
@JohnySi73551906_twitter
Apr 03 2018 11:35
different
objects
Victor Popescu
@VicPopescu
Apr 03 2018 11:35
oh, then you need a double iteration
inside your array for loop, for each iterated object, you do another for to loop through all the rest of the objects
and there you compare
Johny Sins
@JohnySi73551906_twitter
Apr 03 2018 11:37
I'll try
Victor Popescu
@VicPopescu
Apr 03 2018 11:40
alright try it and let us know
Johny Sins
@JohnySi73551906_twitter
Apr 03 2018 12:12
@VicPopescu I can't get it to find objects with same properties
[ 'first', 'last' ]
[ 'last' ]
for(var i = 0; i < collection.length; i++) {
        if(Object.keys(collection[i]) === Object.keys(source)) {
            console.log('este ba!');
        } else {
            // console.log('nu este!');
            console.log(Object.keys(collection[i]));
        }
    }
dinesh
@1532j0004kg
Apr 03 2018 12:14
try to use let keyword may be
Markus Kiili
@Masd925
Apr 03 2018 14:37
@JohnySi73551906_twitter You need a nested loop (or iteration) over source's keys. Looped object's keys are of no interest here.
Ahmed Al-Gallad
@A-Gallad
Apr 03 2018 16:42
Hello guys
I just have a simple question regarding using for loops and bootstrap columns
Stephen James
@sjames1958gm
Apr 03 2018 16:43
@Gallad23 ask away
Ahmed Al-Gallad
@A-Gallad
Apr 03 2018 16:43
<div class="container">
    <div class="row">
        <div class="col-md-3 col-sm-6">        

<ul>

@for ($i = 0; $i < count($info->video); $i++)  

        <li>    

     <div class="card">
    <img class="card-img-top" src="{{$info->video[$i]->thumbnail}}" alt="Card image cap">
    <div class="card-body">
      <h5 class="card-title">{{$info->video[$i]->title}}</h5>
      <p class="card-text">This is a wider card with supporting text below as a natural lead-in to additional content. This content is a little bit longer.</p>
      <p class="card-text"><small class="text-muted">Last updated 3 mins ago</small></p>
    </div>
  </div>

         </li>

@endfor

</ul>

    </div> 
</div>
here my code snippet
so I am retrieving data from the back end and displaying it , I just want to display 4 cards / row instead of 1 card
and I am a little bit confused
where to place the bootstrap col-classes
inside or outside the for loop ? so it can display 4 cards / row
Thanks in advance :)
Stephen James
@sjames1958gm
Apr 03 2018 16:46
@Gallad23 Do you have to use ul / li ?
Not sure which templating language this is?
Ahmed Al-Gallad
@A-Gallad
Apr 03 2018 16:47
dont have to use ul / li ....the data I'm retrieving is simple youtube videos
so $info is an object
and $video is an array of videos
the language is php , laravel specifically
Stephen James
@sjames1958gm
Apr 03 2018 16:48
@Gallad23 blade templating?
Ahmed Al-Gallad
@A-Gallad
Apr 03 2018 16:49
yep
Stephen James
@sjames1958gm
Apr 03 2018 16:50
@for ($i = 0; $i < count($info->video); $i++)  
     @if(i % 4 ==== 0)
    <div class="row">
     @endif
        <div class="col-md-3 col-sm-6">
You might need something like that where every 4th entry you put a new row
Depends on support in the templating language
Ahmed Al-Gallad
@A-Gallad
Apr 03 2018 16:51
that could actually work.... let me try it
thank you, I appreciate your help really
Stephen James
@sjames1958gm
Apr 03 2018 16:52
:) :+1:
Nate Mallison
@NJM8
Apr 03 2018 17:12
Hi all, just looking for some feedback on my Pomodoro Timer, Thanks! https://www.natethedev.com/FreeCodeCampFrontEndProjects/pomodoroTimer/
Nazar
@IsaakNazar
Apr 03 2018 17:23
@NJM8 so unusual, I like it! well done :+1:
Nate Mallison
@NJM8
Apr 03 2018 17:33
thanks, I think I was on something when I did the colors, I hated them for awhile but nothing else looked good. haha
Christopher McCormack
@cmccormack
Apr 03 2018 17:47
@NJM8 reset doesn't seem to work, starts break timer instead. Is there a pause?
rk
@rajkumart08_twitter
Apr 03 2018 17:47

hi,

  • I was developing a prototype when I click third time red square shows.
  • but now when I click third time checkbox should disappear and then I need to show an image, image is added in this class imageThird.
  • can you tell me what is the issue.
  • providing my code below.

working link https://stackblitz.com/edit/angular-t2xvra?file=app/app.component.html

not working link https://stackblitz.com/edit/angular-xvpf9q?file=app/app.component.css


.imageThird {
  background: url(http://via.placeholder.com/15x15) no-repeat -539px -240px;
    width: 20px;
    height: 20px;
}

.displayInlineBlock {
    display: inline-block;
}



.is-multiple-of-3 .imageThird{
  visibility: visible;
}
Christopher McCormack
@cmccormack
Apr 03 2018 17:48
@rajkumart08_twitter I believe your url should be in quotes
Nate Mallison
@NJM8
Apr 03 2018 17:49
@cmccormack No pause, what browser are you using?
Christopher McCormack
@cmccormack
Apr 03 2018 17:49
Chrome
Nate Mallison
@NJM8
Apr 03 2018 17:49
I'm getting some errors on chrome and safari I'm working on
Christopher McCormack
@cmccormack
Apr 03 2018 17:49
@NJM8 i'm guessing your reset is a toggle instead of a clearInterval maybe?
Nate Mallison
@NJM8
Apr 03 2018 17:53
No it should be clearing the interval, I bet it's making two intervals and I need to make a flag to check if there is one already running
currently I'm about to throw my headphones out the window as they keep disconnecting if I don't have music playing for 5 seconds
Nate Mallison
@NJM8
Apr 03 2018 18:02
yeah that is happening when I hit the start button twice, which you wouldn't want to do if my sounds were working
got it fixed, thanks
are you getting the animation on the tomato img?
Liam Docherty
@liamdocherty
Apr 03 2018 18:06

What background picture do you prefer for my homepage? 1,2 or 3? In order of the way the images are presented.
1)
https://ibb.co/jPmaRc

2)
https://ibb.co/crk26c

3)
https://ibb.co/cUPUmc

Nate Mallison
@NJM8
Apr 03 2018 18:10
3
I liked one the first time I saw it looking at your site a few days ago but 3 is very striking
definitely not 2, first thought that comes to mind is lazy with feet up, haha
Christopher McCormack
@cmccormack
Apr 03 2018 18:18
@NJM8 Heya haven't had a chance to go back. One thing I recommend though is ALWAYS clear your previous interval as part of starting a new one, else you lose that interval id forever. Even if the user may never have started one in the first place, it doesn't hurt to clear an empty interval
Nate Mallison
@NJM8
Apr 03 2018 18:19
it was just the case of the start button being pressed twice and making another interval, I just exit the function early if it is already running
how can I prevent an audio src url from trying to resolve to my host url
<audio id="gong" src="https://cdn.rawgit.com/NJM8/sounds/master/gong.mp3"></audio>
Christopher McCormack
@cmccormack
Apr 03 2018 18:20
@NJM8 clearing your interval when the button is clicked may be a better solution, outside of your interval callback
Nate Mallison
@NJM8
Apr 03 2018 18:21
Screen Shot 2018-04-03 at 2.18.05 PM.png
Yeah but if it's running you shouldn't be starting it again right?
that's the way I'm thinking about it
Christopher McCormack
@cmccormack
Apr 03 2018 18:22
@NJM8 I guess it's how you determine it should be implemented, personally I had it restart when they clicked start on mine, but I also had a pause and a stop
But you're right, you don't necessarily need to clear it in your case if you're checking that
Nate Mallison
@NJM8
Apr 03 2018 18:22
yeah, I'm going for simple inputs, what's the point of a focused work timer if you can just pause it and walk away.
any thoughts about the url issue I'm having on the sounds?
Christopher McCormack
@cmccormack
Apr 03 2018 18:23
@NJM8 the error appears to be from a different line in your code
not even the same path
your element you posted here has sounds/master/gong.mp3 but not the error
Nate Mallison
@NJM8
Apr 03 2018 18:25
right, I think it's because cloudflare or github is redirecting the request
I never used my natethedev.com url for that resource
Christopher McCormack
@cmccormack
Apr 03 2018 18:25
Why would it change the path though?
Nate Mallison
@NJM8
Apr 03 2018 18:26
not sure
I thought it was because the files were on a github pages branch but I moved them to a completely different repo
Christopher McCormack
@cmccormack
Apr 03 2018 18:28
@NJM8 /shrug can't see your code :)
well not easily
not in a way I want to dig into haha
@NJM8 I'm sure you'll find it :D I'll be back in a few gotta make lunch
Liam Docherty
@liamdocherty
Apr 03 2018 18:45
@NJM8 Ok thanks for the feedback much appreciated
CamperBot
@camperbot
Apr 03 2018 18:45
liamdocherty sends brownie points to @njm8 :sparkles: :thumbsup: :sparkles:
:cookie: 375 | @njm8 |http://www.freecodecamp.org/njm8
Nate Mallison
@NJM8
Apr 03 2018 18:53
@cmccormack fixed itself, maybe rawgit just hadn't loaded the content yet
I mean uh, yeah I just had to hack the mainframe and force the file path to stay constant by adjusting the regex variables. ahem
Christopher McCormack
@cmccormack
Apr 03 2018 19:07
@NJM8 haha
Nate Mallison
@NJM8
Apr 03 2018 19:21
TIL not to use 'click' for event listeners
Christopher McCormack
@cmccormack
Apr 03 2018 19:21
Uh why would you say that?
Nate Mallison
@NJM8
Apr 03 2018 19:22
I'm not 100% sure if this is what was going on, but the add / remove buttons were not working because the click event was coming through the window not the button
at least, I saw someone else having trouble because the window has it's own click event, so I switched to mousedown and the errors went away
Christopher McCormack
@cmccormack
Apr 03 2018 19:23
Events will bubble up
Nate Mallison
@NJM8
Apr 03 2018 19:24
does click bubble up and mousedown does not?
at least to the window?
Christopher McCormack
@cmccormack
Apr 03 2018 19:24
Events are also delegated to child components
Best way to determine that is create a new file and test it!
Did you have a click event on window?
or were you logging the event and saw the target was window?
Nate Mallison
@NJM8
Apr 03 2018 21:31
@cmccormack It was an error, event.target.id of undefined when calling click event on the buttons
Ahmed Al-Gallad
@A-Gallad
Apr 03 2018 21:44
Hi guys I have another question
image.png
<div class="card text-white bg-dark" id="playlistCard">
  <div class="card-header">
      <p class="text-center">{{$info->video[$i]->views}} <b>Views</b></p>
  </div>
  <div class="card-body">
    <h5 class="card-title text-center text-justify" id="playlistCard-title">
    <img class="img-responsive" id="playlistCard-img" src="{{$info->video[$i]->thumbnail}}" alt="Card image cap">      
        {{$info->video[$i]->title}}
    </h5>
    <p class="card-text text-center">
         <ul class="list-inline text-center">
    test
                          </ul>

    </p>
  </div>
</div>
just need to tweak the display to be set equally between the image and text
I tried a lot of bootstrap text styling classes, but it doesn't seem to be working
Liam Docherty
@liamdocherty
Apr 03 2018 22:17

@Gallad23 I believe from how I interpreted what you're looking for is media queries. You can set the image and text to be a specific size depending on the users display.

https://getbootstrap.com/docs/4.0/layout/overview/

Guys sorry to be a pain, I forgot something simple. How can I adjust the width between the different thumbnail images? You see where I dabbled green is where I want the gaps to be. Using CSS is my answer to do with padding?

Where I want the image width distance between each other increased.
https://ibb.co/mqqixH

How it currently looks
https://ibb.co/izJE4x

zootechdrum
@zootechdrum
Apr 03 2018 22:29
hello yet again campers
i have a question
why is my loop skipping over the third array?

function largestOfFour(arr) {

  var checkNumber = 0;
  var biggestNum = [];

  for(var i = 0; i < arr.length;i++) {
  for(var j = 0; j < arr.length;j++) {
    if(j === 0){
      checkNumber = 0;
    }else if(arr[i][j] > checkNumber){
      checkNumber = arr[i][j];
    }else if(j === 3){
      biggestNum.push(checkNumber);
    }
    }
   }
  return biggestNum;
}
i forgot this
([[13, 27, 18, 26], [4, 5, 1, 3], [32, 35, 37, 39], [1000, 1001, 857, 1]]);
Aditya
@ezioda004
Apr 03 2018 22:37

@zootechdrum Because of

else if(arr[i][j] > checkNumber){
      checkNumber = arr[i][j];
    }

Since this condition will be true for all elements in 3rd array, it wont execute the next condition you have

So nothing gets pushed to the biggestNum array
Swapping the condition works
zootechdrum
@zootechdrum
Apr 03 2018 22:39
I just realised it wont work on a one condition.
Have to start from the top
@ezioda004 Hey, thanks man
CamperBot
@camperbot
Apr 03 2018 22:39
zootechdrum sends brownie points to @ezioda004 :sparkles: :thumbsup: :sparkles:
:cookie: 524 | @ezioda004 |http://www.freecodecamp.org/ezioda004
German Gamboa Gonzalez
@germangamboa95
Apr 03 2018 23:06
Hey guys! I finished another project and as always all feedback is appreciated. I do implement everything I get from here. https://germangamboa95.github.io/TrivaGame.io/
Stephen James
@sjames1958gm
Apr 03 2018 23:10
@germangamboa95 Nice design.
  • There should be feedback from selecting an answer. When you click nothing seems to happen, until you move your mouse away.
  • Maybe a restart button at the end?
  • Cool ending visual
German Gamboa Gonzalez
@germangamboa95
Apr 03 2018 23:12
@sjames1958gm Thanks for the feedback!
CamperBot
@camperbot
Apr 03 2018 23:12
germangamboa95 sends brownie points to @sjames1958gm :sparkles: :thumbsup: :sparkles:
:star2: 9161 | @sjames1958gm |http://www.freecodecamp.org/sjames1958gm
Stephen James
@sjames1958gm
Apr 03 2018 23:16
@germangamboa95 :+1: