These are chat archives for FreeCodeCamp/Help

10th
Oct 2018
psyperl
@psyperl
Oct 10 2018 02:07
const flatten = x =>
  Object
    .keys(x)
    .sort()
    .reduce( (b,v) => 
      typeof x[v] === 'object' 
        ? Object.assign(b, {[v]: flatten(x[v]) }) 
        : Object.assign(b, {[v]: x[v]})
      ,{}
    )
const areEqual = (x,y) => 
  JSON.stringify(flatten(x)) === JSON.stringify(flatten(y))
newmoon
@newmoon
Oct 10 2018 02:39
@psyperl console.log(areEqual(1, 0)) // true
:trollface:
psyperl
@psyperl
Oct 10 2018 04:17
@newmoon lol really
lucky that passed the test then hahaha

https://www.codewars.com/kata/are-the-values-equal/javascript

The supplied arguments will be objects, arrays and strings.

precondition saved me i guess :smile:

Bjorn van de Peut
@bjorno43
Oct 10 2018 08:36
Meh. I got to this point:
function areEqual(value1, value2) {
  if(arguments.length > 2){ return false; }
  if(typeof(value1) === typeof(value2)){
    if(typeof(value1) === 'string'){
      if(value1 == value2){
        return true;
      } else {
        return false;
      }
    } else if(typeof(value1) === 'object'){
      if(Object.keys(value1).length === Object.keys(value2).length){
        for(let key in value1){
          if(value1.hasOwnProperty(key)){
            let result = Object.keys(value2).find(getkey => JSON.stringify(value2[getkey]) === JSON.stringify(value1[key]));

            if(result === undefined || result === null){
              return false;
            } else {
              continue;
            }
          }
        }
        return true;
      } else {
        return false;
      }
    }
  } else {
    return false;
  }
}
And then it started throwing me arrays with objects containing arrays and I was like.. nope
Also telling [true] === [true] should return false. Right..
May Kittens Devour Your Soul
@diomed
Oct 10 2018 08:48
@bjorno43 make me animation :yum:
:smirk_cat:
Bjorn van de Peut
@bjorno43
Oct 10 2018 08:58
@diomed I'm not a designer, lol
Yashwardhan Pauranik
@yashwp
Oct 10 2018 09:02
Anyone who can help me with this issue?
iamkun/dayjs#297
May Kittens Devour Your Soul
@diomed
Oct 10 2018 09:15
these new stickies on windows 10 ಠ_ಠ
Aditya
@ezioda004
Oct 10 2018 09:50
@coderkarma Yeah
May Kittens Devour Your Soul
@diomed
Oct 10 2018 09:57
guys, if you ever apply class and you can't see it,
just remember that one can't see white color on white background.
Claudio Restifo
@Marmiz
Oct 10 2018 09:58
stupid md
Aditya
@ezioda004
Oct 10 2018 09:58
lol
Claudio Restifo
@Marmiz
Oct 10 2018 09:58
#design
Bjorn van de Peut
@bjorno43
Oct 10 2018 10:29
Hence I always have different colors of border: 1px solid color; when designing :P Also helps a lot to see if it's actually aligning and doesn't just look like it does :P
May Kittens Devour Your Soul
@diomed
Oct 10 2018 11:51
-
psyperl
@psyperl
Oct 10 2018 14:48
should at least post that in a dark mode
Niraj Nandish
@Nirajn2311
Oct 10 2018 15:29
@psyperl don't be tempted by the dark side
images.jpeg
May Kittens Devour Your Soul
@diomed
Oct 10 2018 15:54
@psyperl
is a child of darkness
Eric Weiss
@eweiss17
Oct 10 2018 17:16
@diomed good stack overflow meme A+
Ariel
@ArielLeslie
Oct 10 2018 17:18
class Psyperl extends Darkness {
Kyle Holm
@thekholm80
Oct 10 2018 17:29
i always thought @psyperl was the darkness, not an extension of it
Aditya
@ezioda004
Oct 10 2018 17:31
Darkness.__proto___; //Psyperl
Aditya
@ezioda004
Oct 10 2018 17:55
Or maybe its like:
Darkness instanceof Psyperl //true
Psyperl insatnceof Darkness //true
Kyle Holm
@thekholm80
Oct 10 2018 18:19
one and the same
Niraj Nandish
@Nirajn2311
Oct 10 2018 18:48
Its empty just like you
psyperl
@psyperl
Oct 10 2018 18:50
emptiness is an illusion, you need to be in the darkness to see it
Niraj Nandish
@Nirajn2311
Oct 10 2018 18:52
@psyperl 👏👏👏
Bjorn van de Peut
@bjorno43
Oct 10 2018 20:43
As a PHP dev, you guys still have a way to go before you've reached true darkness :trollface:
Aditya
@ezioda004
Oct 10 2018 20:48
Daily to-do: Make fun of PHP :heavy_check_mark:
Bjorn van de Peut
@bjorno43
Oct 10 2018 20:48
Ghehe
Kyle Holm
@thekholm80
Oct 10 2018 20:53
did someone say it's time to make fun of php?
Bjorn van de Peut
@bjorno43
Oct 10 2018 20:53
:joy:
Aditya
@ezioda004
Oct 10 2018 20:56
It makes fun of itself
Bjorn van de Peut
@bjorno43
Oct 10 2018 20:58
@ezioda004 That's very true actually :joy:
Naming conventions and PHP just don't go well together, lol
Kaz Baig
@kbaig
Oct 10 2018 22:48
@thekholm80 it's always time!
Kyle Holm
@thekholm80
Oct 10 2018 22:48
@kbaig oh hey! how you been?
Kaz Baig
@kbaig
Oct 10 2018 22:48
@thekholm80 good! how are you? I am back
Kyle Holm
@thekholm80
Oct 10 2018 22:48
i'm still alive
are you married now? in some awesome country?
Bjorn van de Peut
@bjorno43
Oct 10 2018 22:56
He doesn't know
What happens in Vegas, stays in Vegas
Kaz Baig
@kbaig
Oct 10 2018 23:01

He doesn't know

YIKES haha
I'm married and in Chicago now :smile:

Kyle Holm
@thekholm80
Oct 10 2018 23:14
lol congrats :tada: that's awesome