These are chat archives for FreeCodeCamp/Help

13th
Oct 2018
Lance
@texas2010
Oct 13 2018 04:13
is it morning yet? lol
Anand Potukuchi
@anandpotukchi
Oct 13 2018 06:02
@texas2010 here it is
psyperl
@psyperl
Oct 13 2018 06:24
in JS.. assume i made a function, name it the target function. is there a tool that can tell me all other functions which called the target function? ( not during runtime )
pumpkinT
@pumpkinT
Oct 13 2018 06:28

@pumpkinT
Hi all,
is this this logic correct? - please help
var myaccount = 50;
var shoes = 300;
var coupons = 50;

if (shoes <= myaccount) {

myaccount = myaccount - shoes;
console.log("transaction approved");
console.log ("Your new balance is " + myaccount + " dollars left");
} else if

(shoes - coupons)

{
myaccountt = shoes - coupons;
console.log ("Transaction approved and you new Balance is " + myaccountt);

} else {

console.log("Not enough funds");
}

psyperl
@psyperl
Oct 13 2018 06:30
would be much easier to read if you format the code .. but something wrong with shoes-coupon
Aditya
@ezioda004
Oct 13 2018 06:51
@psyperl Functions get overriden and not overloaded, I guess a parser could do that but JS engine certainly not
psyperl
@psyperl
Oct 13 2018 06:56
@ezioda004 oo
psyperl
@psyperl
Oct 13 2018 07:07
might just use grep then
Niraj Nandish
@Nirajn2311
Oct 13 2018 08:09
@pumpkinT the second if condition should be "my account <= (shoes-coupons)"
Eunice Park
@eunicode
Oct 13 2018 09:01

@ezioda004 Sorry to bother, but just wanted to update you with what I learned.

I was still confused by how the Array.prototype.keys() method was giving indices to an empty array with holes, and I found the answer here:

http://exploringjs.com/es6/ch_arrays.html#_arrayprototype-methods

ECMAScript 6 adds new kinds of behaviors:
entries(), keys(), values() treat each hole as if it was the element undefined.

The Array.prototype.keys() treats holes like elements. That explains why this works: [...Array(5).keys()]; => [0, 1, 2, 3, 4]

Sorry if you already knew this, but this helped clarify how the keys() method returns an Array Iterator object that contains the keys for each index in the array, when the array has no indices, only holes. There's still a lot I don't get, like what an Array iterator object is, but I'm done for now.

Henry
@GitHub-Henry
Oct 13 2018 09:10
Aditya
@ezioda004
Oct 13 2018 09:16

@eunicode undefined and not defined are different things, I'd still say undefined is an incorrect term here to refer those holes. This is a great article on this topic. Whats even weird is that some methods behave differently to others when they come across that "hole". This sentence sums up well:

With regard to holes in Arrays, the only rule is now that there are no rules. Therefore, you should avoid holes if you can (they affect performance negatively, too). If you can’t then the table in the previous section may help.

Supra01
@Supra01
Oct 13 2018 10:05
Has anyone here created a react component library?
ehutchllew
@ehutchllew
Oct 13 2018 11:28
@Supra01 yes
Anand Potukuchi
@anandpotukchi
Oct 13 2018 11:43
anyone online?
May Kittens Devour Your Soul
@diomed
Oct 13 2018 11:45
not the ones you need. lol :smile_cat:
Anand Potukuchi
@anandpotukchi
Oct 13 2018 11:49
haha
was looking for you
are you a CAT
@diomed
May Kittens Devour Your Soul
@diomed
Oct 13 2018 11:52
no, I'm a :cat:
Anand Potukuchi
@anandpotukchi
Oct 13 2018 11:52
:cat:
hmm
Do you have 9 lives
:cat:
May Kittens Devour Your Soul
@diomed
Oct 13 2018 11:53
not anymore
I have like 6 left, if I'm lucky
5 and a half actually
Anand Potukuchi
@anandpotukchi
Oct 13 2018 11:54
:cat: are always lucky
May Kittens Devour Your Soul
@diomed
Oct 13 2018 11:55
not this one. I'm epitome of unlucky
my :cat: name is mr. Jinx
Anand Potukuchi
@anandpotukchi
Oct 13 2018 11:55
ohh..
May Kittens Devour Your Soul
@diomed
Oct 13 2018 11:56
[I hate when they call me Jinxie]
Anand Potukuchi
@anandpotukchi
Oct 13 2018 11:56
so can you transfigure yourself into a :man:
May Kittens Devour Your Soul
@diomed
Oct 13 2018 11:56
only into a :boy:
Anand Potukuchi
@anandpotukchi
Oct 13 2018 11:57
why don't you got to Hogwarts
?
@diomed
May Kittens Devour Your Soul
@diomed
Oct 13 2018 12:00
coz I'm not into magic.
only magic I'm into is vue.js
Anand Potukuchi
@anandpotukchi
Oct 13 2018 12:02
hmm
what's your real name
May Kittens Devour Your Soul
@diomed
Oct 13 2018 12:02
mr. Jinx
but people call me diomed
they also call me May Kittens, for some strange reason
Anand Potukuchi
@anandpotukchi
Oct 13 2018 12:03
May Kittens Devour your soul
:hmm:
May Kittens Devour Your Soul
@diomed
Oct 13 2018 12:04
righ? that's what I think. but still, nevertheless
Anand Potukuchi
@anandpotukchi
Oct 13 2018 12:04
hmm
what 's your age
psyperl
@psyperl
Oct 13 2018 12:06
bank account and pin?
he is too old for a cat for sure :smile:
Anand Potukuchi
@anandpotukchi
Oct 13 2018 12:06
@psyperl 200216522203
1123
hmm'
tell me a joke
Aditya
@ezioda004
Oct 13 2018 12:07
PHP
Anand Potukuchi
@anandpotukchi
Oct 13 2018 12:07
not good enough
May Kittens Devour Your Soul
@diomed
Oct 13 2018 12:07
hue hue hue
Aditya
@ezioda004
Oct 13 2018 12:07
:cat: approval
May Kittens Devour Your Soul
@diomed
Oct 13 2018 12:07
$radius-rounded: 290486px
I actually use -290486px because that’s my date of birth, so it acts like a CSS signature
  • creator of Bulma
Anand Potukuchi
@anandpotukchi
Oct 13 2018 12:08
creator of Bulma
?
@diomed
May Kittens Devour Your Soul
@diomed
Oct 13 2018 12:09
yeah, that's what he said
when they asked him about that weird number
Anand Potukuchi
@anandpotukchi
Oct 13 2018 12:10
thanks
learnt something new
@psyperl
anything?
psyperl
@psyperl
Oct 13 2018 12:11
?
i am on a confused moment atm .. not sure i am learning anything atm
Anand Potukuchi
@anandpotukchi
Oct 13 2018 12:11
tell me a joke/fact
psyperl
@psyperl
Oct 13 2018 12:12
exactly
Anand Potukuchi
@anandpotukchi
Oct 13 2018 12:12
better one
May Kittens Devour Your Soul
@diomed
Oct 13 2018 12:12
fact is they don't take your kidney out, when they transplant them. they just stuff another ones in ya
Anand Potukuchi
@anandpotukchi
Oct 13 2018 12:13
not a joke and i lnew that already
I had a transplant
May Kittens Devour Your Soul
@diomed
Oct 13 2018 12:14
I've reddit.
Anand Potukuchi
@anandpotukchi
Oct 13 2018 12:31
see ya arund ppl
bye
May Kittens Devour Your Soul
@diomed
Oct 13 2018 12:41
who was that guy, anyway?
Anand Potukuchi
@anandpotukchi
Oct 13 2018 12:45
Which guy
Does Tinder work in India?
@ezioda004
Have you tried?
Aditya
@ezioda004
Oct 13 2018 12:47
Ehm
No, I've not tried.
Supra01
@Supra01
Oct 13 2018 13:06
@ehutchllew did you use create-react-app?
Idowu Wasiu
@Hoxtygen
Oct 13 2018 13:28
Anybody home?
Aditya
@ezioda004
Oct 13 2018 13:36
:wavy_dash:
ehutchllew
@ehutchllew
Oct 13 2018 15:48
@Supra01 No, I did not.
Eunice Park
@eunicode
Oct 13 2018 16:29

@ezioda004 Yep, the link I gave, and the link you gave are by the same author.
In the link you gave, there's a table you gave that describes how Array.prototype methods handle holes. keys() treats holes as elements.
In the link you gave, it also says "The general rule for Array methods that are new in ES6 is: each hole is treated as if it were the element undefined."
Yes, holes are not undefined. Because holes are indices with no associated element (I was wrong earlier when I said holes had no indices).

var sparse = [ , , 'c' ];
0 in sparse // false

var dense  = [ undefined, undefined, 'c' ];
0 in dense // true

The difference between Object.keys() and Array.prototype.keys() is that Object.keys() ignores holes, while Array.prototype.keys() treats them like elements.

var arr = ['a', , 'c'];

var sparseKeys = Object.keys(arr);
console.log(sparseKeys); // ['0', '2']

var denseKeys = [...arr.keys()];
console.log(denseKeys);  // [0, 1, 2]

Another interesting thing is that if you read holes, you get undefined. And this was true pre-ES6 too.

var sparse = [ , , 'c' ];

for (var i=0; i<sparse.length; i++) console.log(sparse[i]);
// undefined
// undefined
// c
Anand Potukuchi
@anandpotukchi
Oct 13 2018 16:39
It just struck me
Should'nt random quote machine be in API and niot front-end libraries?
May Kittens Devour Your Soul
@diomed
Oct 13 2018 16:42
if it's done in JS , as they require, and you know how to make quotes shuffle, then they can be in variable, and just randomizing.
whatever floats your boat, in the end
Christopher McCormack
@cmccormack
Oct 13 2018 16:43
@anandpotukchi it would be if you were providing the quotes, but the front-end project is to use an external API, no backend required
Anand Potukuchi
@anandpotukchi
Oct 13 2018 16:44
@cmccormack True
@cmccormack but on the other hand, JSON handling is covered there, not here
Christopher McCormack
@cmccormack
Oct 13 2018 16:47
JSON handling is covered in both because they both require understanding of how to handle it
Anand Potukuchi
@anandpotukchi
Oct 13 2018 16:48
i mean the challenges
don't you think so
Christopher McCormack
@cmccormack
Oct 13 2018 16:50
When I did the JSON challenges it was in the old cirriculum, but it was prior to doing the frontend projects
ehutchllew
@ehutchllew
Oct 13 2018 16:50
@anandpotukchi The more you get used to making API calls and handling JSON data the better. That's basically 95% of a front-end dev's job.
Anand Potukuchi
@anandpotukchi
Oct 13 2018 16:51
I did those too.. just shot up in my head
@ehutchllew yup. used to that -__-
we are fine. what about those who're doing it now
They'll have to a ton of research
read a couple of articles or something
ehutchllew
@ehutchllew
Oct 13 2018 16:53
that's how they learn
Anand Potukuchi
@anandpotukchi
Oct 13 2018 16:54
@ehutchllew got that. but shouldn't there be some linnk or something
Christopher McCormack
@cmccormack
Oct 13 2018 16:54
not sure the current quote machine requires an api call now actually, may be why JSON handling is now in the dataviz section
Anand Potukuchi
@anandpotukchi
Oct 13 2018 16:55
yeah
@cmccormack i forgot what you're doing
learning vue?
Christopher McCormack
@cmccormack
Oct 13 2018 16:55
doing in general?
I haven't learned vue yet, may learn it later, right now working on the last backend project
Anand Potukuchi
@anandpotukchi
Oct 13 2018 16:56
@cmccormack both . general and in fcc
so you'll move on to the non-profit
?
Christopher McCormack
@cmccormack
Oct 13 2018 16:58
probably not
Anand Potukuchi
@anandpotukchi
Oct 13 2018 16:58
you're an infrastructure engineer
what do you do - i mean actual day-to-day job
Christopher McCormack
@cmccormack
Oct 13 2018 16:59
I already have a full time position in a different field, this is all to help keep me fresh in coding and to learn web dev to create some portals for work mainly
Network Engineer
My team basically designs and maintains our global WAN network
Kyle Holm
@thekholm80
Oct 13 2018 17:00
wan = women and newborns?
Anand Potukuchi
@anandpotukchi
Oct 13 2018 17:01
lol
Christopher McCormack
@cmccormack
Oct 13 2018 17:02
you got it!
I don't like to brag but I'm the favorite maintainer
haha Wide Area Network, all of our internet and MPLS infrastructure
@thekholm80 you solve the drum problem again?
I think the issue is the keypress is no longer being triggered properly by the tests in ours
Kyle Holm
@thekholm80
Oct 13 2018 17:05
i haven't even looked at it, tbh
Christopher McCormack
@cmccormack
Oct 13 2018 17:06
I put a log statement for the event in my addEventListener and noticed when I hit a key it shows up but the tests don't trigger it
Christopher McCormack
@cmccormack
Oct 13 2018 17:12
looks like now keydown is required vs keypress
Kyle Holm
@thekholm80
Oct 13 2018 17:15
oh interesting
Brandon Dodds
@EightBitMetal
Oct 13 2018 17:16
Can anyone tell me if its possible to restore a website from the wayback machine and retain access to the pages behind a login?
regain*
Aditya
@ezioda004
Oct 13 2018 18:18
@eunicode Yeah, the behavior is more consistent now, I think only sometime ago Firefox would sometimes show undefined instead of empty. Thanks for pointing out the difference b/w the methods. Honestly, this is something I dont think is important to remember, its more like trivial knowledge and I'm sure I'll forget the most of the discussion in few days :smile:
I fell asleep while writing CSS for the drum machine, best nap ever
troncarter
@troncarter
Oct 13 2018 18:21
can someone tell me how to run a project from github?
Aditya
@ezioda004
Oct 13 2018 18:22
@troncarter Are there instructions in the README.md file?
troncarter
@troncarter
Oct 13 2018 18:22
no
i think its ruby
Aditya
@ezioda004
Oct 13 2018 18:25
Sorry dont know ruby, but this file seems like have dependencies
troncarter
@troncarter
Oct 13 2018 18:27
what do you mean
Aditya
@ezioda004
Oct 13 2018 18:30
You know the packages you need to install inorder to run a project
troncarter
@troncarter
Oct 13 2018 18:36
no
oh i see
isnt there a way i can just do it on cli and it will get the dependencies for me?
Aditya
@ezioda004
Oct 13 2018 18:40
@troncarter Sure can, check this SO post
troncarter
@troncarter
Oct 13 2018 18:44
thanks!
i dont have ruby or gem, do i need to install them?
Kelechi Chinaka
@ke1echi
Oct 13 2018 18:48
sent you a message @ezioda004
Aditya
@ezioda004
Oct 13 2018 18:53
@troncarter Yes, you need to install ruby
troncarter
@troncarter
Oct 13 2018 19:00
once i install them, i go into the prjoect folder and run what command?
Karma Drukpa
@coderkarma
Oct 13 2018 22:06
How can I render a component in the DOM?
Aditya
@ezioda004
Oct 13 2018 22:29
@coderkarma ReactDOM.render(<Component />, rootElement);
Manish Giri
@Manish-Giri
Oct 13 2018 23:30
@ezioda004 you merged this freeCodeCamp/freeCodeCamp#18713, but the code had a problem with the .split()
take a sec to go through the code (if there's any) before merging
that same author had 2 more java PRs, 1 of which I closed, and for the other one the reviewer requested some changes
Aditya
@ezioda004
Oct 13 2018 23:38
@Manish-Giri Right, to be fair a " " can easily be missed, thanks for pointing out though, I'll look twice next time.
Kyle Holm
@thekholm80
Oct 13 2018 23:42
oooooh aditya's in trouble
Manish Giri
@Manish-Giri
Oct 13 2018 23:45
@ezioda004 yep..that can easily happen when you're reviewing several prs, so just letting you know here instead of the other room..
I've reviewed only maybe 3-4, and i was searching for some java PRs when I came across this one coincidentally..
Aditya
@ezioda004
Oct 13 2018 23:49
@Manish-Giri Well, we merged around 1000 PRs in the guide repo in span of 3-4 days, and I guess I was still in the mindset of "quantity" instead of "quality" as Qunicy instructed us.
I agree though, will be more careful.
@thekholm80 🤐