Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
  • Aug 17 09:32
    User @bjorno43 unbanned @linkin-park
  • Jun 20 21:19
    @bjorno43 banned @shenerd140
  • Apr 25 17:13
    @mstellaluna banned @cmal
  • Jan 08 22:05
    @mstellaluna banned @dertiuss323
  • Nov 07 2018 04:42
    User @texas2010 unbanned @ows-ali
  • Nov 02 2018 16:25
    @texas2010 banned @ows-ali
  • Oct 12 2018 05:50
    @bjorno43 banned @NACH74
  • Oct 05 2018 23:02
    @mstellaluna banned @JomoPipi
  • Sep 16 2018 12:21
    @bjorno43 banned @yash-kedia
  • Sep 16 2018 12:16
    @bjorno43 banned @vnikifirov
  • Sep 05 2018 08:12
    User @bjorno43 unbanned @androuino
  • Sep 05 2018 07:38
    @bjorno43 banned @androuino
  • Aug 23 2018 16:57
    User @bjorno43 unbanned @rahuldkjain
  • Aug 23 2018 16:23
    @bjorno43 banned @rahuldkjain
  • Jul 29 2018 14:13
    User @bjorno43 unbanned @jkyereh
  • Jul 29 2018 01:00
    @bjorno43 banned @jkyereh
  • Jul 10 2018 22:09
    @bjorno43 banned @manafn
  • Jul 06 2018 15:20
    @texas2010 banned @imlegend19
  • Jul 03 2018 12:28
    @bjorno43 banned @vbvmatta
  • Jun 29 2018 13:54
    @bjorno43 banned @OGTechnoBoy
ehutchllew
@ehutchllew
@relentless-coder if you need further help with react, let me know, I work with it daily hehe.
Emil
@aguyinmontreal
Hi everyone! Does someone knows how jquery ajax exactly determines what is a "fail" in $.ajax.fail ? I can't find the documentation for it :/
Omar Tan
@wheelhot

Woo hoo! Finally completed Twitch.tv project!

https://codepen.io/wheelhot/full/XVxyEK/

Oddly there’s some weird scaling behaviour on codepen, I don’t get this issue on the various browsers I tested

ehutchllew
@ehutchllew
@aguyinmontreal been a while since i've used jQuery's ajax call, but isn't there an "error" parameter when you fill out the request object?
Kaz Baig
@kbaig

@aguyinmontreal From the jquery.ajax documentation:

jqXHR.fail(function( jqXHR, textStatus, errorThrown ) {});
An alternative construct to the error callback option, the .fail() method replaces the deprecated .error() method. Refer to deferred.fail() for implementation details.

The jqXHR objects returned by $.ajax()
Stephen James
@sjames1958gm
@wheelhot :+1:
Kaz Baig
@kbaig
@ehutchllew nice! Maybe consider subtle borders for the thumbnails to improve contrast with the background?
(and also potentially slightly rounded borders)
The text on thumbnail hover is overflowing for me in some cases when I keep the browser wide but make it a bit shorter
Emil
@aguyinmontreal

@ehutchllew @kbaig I'm talking about this example : var jqxhr = $.get( "example.php", function() { alert( "success" ); }) .done(function() { alert( "second success" ); }) .fail(function() { alert( "error" ); }) .always(function() { alert( "finished" ); }); see here: http://api.jquery.com/jQuery.get/

No matter what response is sent by my server, my front-end code uses the ".fail" and not the ".done" code. So, I wanted to know what are the specs for the ".fail" condition.

Kaz Baig
@kbaig
@aguyinmontreal what does the error say?
if there is one
Emil
@aguyinmontreal
What is a "failure" exactly?
Kaz Baig
@kbaig
If the call fails for whatever reason
As seen above, the params of jqXHR.fail are errors, so try logging those to see what's going on
Emil
@aguyinmontreal
@kbaig no error on console, I will try to log the error, thanks
CamperBot
@camperbot
aguyinmontreal sends brownie points to @kbaig :sparkles: :thumbsup: :sparkles:
:cookie: 531 | @kbaig |http://www.freecodecamp.org/kbaig
Ayush Bahuguna
@relentless-coder
@ehutchllew hey, yes, so I have started learning since last weekend, and so far I have managed to setup a dummy app, it has no css styles though, could you give my code a quick glance, and point out the bad practices? https://github.com/relentless-coder/expense-management I had built this project on Angular, but then to learn better, I replaced the client with React.
Ayush Bahuguna
@relentless-coder
@aguyinmontreal could you share your code? From my understanding, XMLHTTPRequest consider a request as a failure when the response code received from the server is 400 series and 500 series, now as far as promises are concerned, it's probable that code inside your .done() is throwing an error that .fail() is collecting.
ehutchllew
@ehutchllew
@relentless-coder cool, i'll take a look
Emil
@aguyinmontreal
@relentless-coder this is what I get when logging what's inside the .fail() : "readyState":4,"responseText":"OK","status":200,"statusText":"OK"
Ayush Bahuguna
@relentless-coder
@aguyinmontreal No, but the code, I can help you better if I know the context, how are you using the ajax call?
@ehutchllew thank you
CamperBot
@camperbot
relentless-coder sends brownie points to @ehutchllew :sparkles: :thumbsup: :sparkles:
:cookie: 366 | @ehutchllew |http://www.freecodecamp.org/ehutchllew
Amit Patel
@AmitP88

@Braillon7 nah, still stuck :worried: here's what I have so far:


function largestOfFour(arr) {
  // You can do this!



  // loop through all the sub-arrays
  for(var i = 0; i < arr.length; i++) {
    for(var j = 0; j < arr[i].length; j++) {
       var maxElement = Math.max.apply(null, arr[i]);      
    }
  }


  var maxArray = arr.map(function() {
    return maxElement;      
  });


  return maxArray;

}

largestOfFour([[4, 5, 1, 3], [13, 27, 18, 26], [32, 35, 37, 39], [1000, 1001, 857, 1]]);

I'm getting [1001,1001,1001,1001] for the output

ugh, I know it must either be something to do with my for-loop or my map method, but I have no idea how to solve this
Ayush Bahuguna
@relentless-coder
@AmitP88 so you have to return an array containing the max element for each array?
Amit Patel
@AmitP88
@relentless-coder yeah, it's the Return Largest Numbers in an Array algorithm problem
been stuck on this for about a day now
Eric Weiss
@eweiss17
aren't you just immediately overwriting maxElement before returning it
Ayush Bahuguna
@relentless-coder
@AmitP88 no worries, could you explain me your point of view? What do you think can solve this?
@AmitP88 How about you explain yourself the code that you have written on a piece of paper, going through each step
Amit Patel
@AmitP88
I'm able to get the highest number from one of the sub-arrays, and i'm able to use the map method to put that in a new array, but I need to be able to loop through all the sub arrays to get all the highest elements, then place all those in the new array via map method. My issue is, I can't figure out how my loop should be in order to do this. I've tried the simple loop and multidimensional loop, but I'm having a tough time seeing the logic solution
Ayush Bahuguna
@relentless-coder
@AmitP88 if it makes you feel better, you are only two correct steps away from solving this
Amit Patel
@AmitP88
@relentless-coder it does. Thanks man. I know I'm close, it's just, I can't see the logic yet to connect it together
CamperBot
@camperbot
amitp88 sends brownie points to @relentless-coder :sparkles: :thumbsup: :sparkles:
:cookie: 384 | @relentless-coder |http://www.freecodecamp.org/relentless-coder
Ayush Bahuguna
@relentless-coder
@AmitP88 1st: You don't need map in your code, 2nd: Take a strong hard look at your maxElement variable inside the second loop, do you think it's working as expected?
Amit Patel
@AmitP88
@eweiss17 I think so. But I also tried using the map method in the for loop to avoid this, but then I run into errors
Ayush Bahuguna
@relentless-coder
@AmitP88 also, you have used map incorrectly, in case you are still fixated at using map to solve your problem
Eric Weiss
@eweiss17
the result is a new array with the max values?
Amit Patel
@AmitP88

@relentless-coder in the loop, I don't think it is. But, if I just had the maxElement variable alone, and use this instead:

var maxElement = Math.max.apply(null, arr[0]);

then it returns the highest element in the first sub-array

Eric Weiss
@eweiss17
can you just push the highest values on an array if map is giving problems
Amit Patel
@AmitP88
@eweiss17 yup, that's the goal at least
I was just thinking of that actually. just creating a new variable set to an empty array, then use .push to place the elements in
Ayush Bahuguna
@relentless-coder
@AmitP88 pull the maxElement outside your second loop, then after the second loop push the maxElement into an array