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
Stephen James
@sjames1958gm
@Frosty427 There is only one form with that id
@asamad123 You would probably implement authentication on the backend not the front
rdollent
@rdollent
@asamad123 back-end. see passportjs authentication
John
@flyboy1565
I need some help.. i have an array [{'orderid':4, 'type':'sale'}, {'orderid':5, 'type':'refund'}]... I want to be able to get see if an order exists in the array that matches a type
rdollent
@rdollent
an order exists?
ah like an order order i thought it was JS terminology
okay so it is an array but each order is an object
John
@flyboy1565
sorry if an orderid exists in the array
rdollent
@rdollent
so you can either do a for loop
which goes through the array i.e. for(var i = 0; i <= yourArray.length;i ++)
and to be able to get the type, you just go
i.type = "something"
since that i pertains to the elements in the array i.e. {orderid:4, type:sale}
John
@flyboy1565
function remove_notification(remove_type){
    $('#alerts .alert').each(function(){
        var oid = parseInt($(this).data('order'));
        var type = $(this).data('type');
        if (($.inArray(oid, notifications) == -1) && (type == remove_type)){
            $('.alert[data-order="' + oid +'"][data-type="'+type+'"]' ).remove();
        }
    })
}
this is what i have so far
rdollent
@rdollent
or or or you can do a .filter
array.filter(function(obj) {
obj.type = "this type";
});
array.filter(function(obj) { obj.type = "this type"; });
array.filter(function(obj) {
  obj.type = "this type";
});
that will spit out an array
that you've to store in a variable
var array = [{'orderid':4, 'type':'sale'}, {'orderid':5, 'type':'refund'}];
var result = array.filter(function(obj) {
  return obj.type === "refund";
});
result;

:
{orderid: 5, type: "refund"}
John
@flyboy1565
what would happen an orderid doesn't exist in there?
what would the ouptut be?
rdollent
@rdollent
var array = [{'orderid':4, 'type':'sale'}, {'orderid':5, 'type':'refund'}];
var result = array.filter(function(obj) {
  return obj.type === "refund";
});
result[0];
{orderid: 5, type: "refund"}
you can put that in the google chrome console
it will say undefined
var array = [{'orderid':4, 'type':'sale'}, {'orderid':5, 'type':'refund'}];
var result = array.filter(function(obj) {
  return obj.type === "xxxx";
});
result[0];

undefined
John
@flyboy1565
perfect thanks for the help @rdollent
CamperBot
@camperbot
flyboy1565 sends brownie points to @rdollent :sparkles: :thumbsup: :sparkles:
:cookie: 337 | @rdollent |http://www.freecodecamp.org/rdollent
rdollent
@rdollent
actually it will output an empty array
i did the result[0] just to show you the first element in the result array
John
@flyboy1565
that'll still work i'll check if length == 0
rdollent
@rdollent
uhhuh for sure
John
@flyboy1565
thanks again
rdollent
@rdollent
also do length === 0 always use strict === not ==
AbrisM
@AbrisM
@AbrisM
Hi everyone
Is there a networking channel available on GITTER?
Ben Hart
@Benjmhart
hey folks, anyone in here have experience with d3 force charts?
Frank Bono
@frankbono
Quick question. Do I need to learn ES6 before learning React?
Tiago Correia
@tiagocorreiaalmeida
would help in quite a few stuff
Stephen James
@sjames1958gm
@frankbono Well, React uses es6 classes and arrow functions are useful
Frank Bono
@frankbono
@sjames1958gm Ok, I'm on it. Thanks man!
CamperBot
@camperbot
frankbono sends brownie points to @sjames1958gm :sparkles: :thumbsup: :sparkles:
:star2: 9058 | @sjames1958gm |http://www.freecodecamp.org/sjames1958gm
Stephen James
@sjames1958gm
@frankbono good luck!
Tom
@moT01
@Benjmhart whats the problem - youre best to just say what the problem is
neovks
@neovks
hey, I have an issue since last night can't figure this out... I'm on the portfolio project, and I've set up a clickable thumbnail to access a project but when I try to put it in a row the border suddenly get huge and I don't know why, if someone have an idea (it's the twitch thumbnail at the bottom)... thanks
Gulsvi
@gulsvi
@neovks It's in a row currently and the border doesn't look huge - maybe I'm misunderstanding