« first day (1384 days earlier)      last day (3569 days later) » 

5:00 PM
@AwalGarg that makes no sense
the function and the scope outside thye function are completely different
Explain to me how you think the function works. Something is missing
Protip: console.log is your friend
 
@KendallFrey the function takes two parameters, one is the key, the other the value associated to that key. it operates on the two as we command, and returns as we command.
 
So far so good
how is the function used though?
 
@KendallFrey as a callback for the function JSON.parse
 
Right
And how is it used inside the parse?
 
.
@KendallFrey it is iterated over the object passed to it for each key and associated value.
 
5:04 PM
yep
 
ok. so logging into the console, k is p.
then why does return k return ""?
 
Have you looked carefully at what's logged?
 
> p
(blank line)
<. undefined
 
yeah
there's some key information there
try logging some other stuff
 
lemme try to figure out. don't tell me, ok...
 
5:07 PM
!!> Number.isInteger()
 
@SterlingArcher "TypeError: Number.isNumeric is not a function"
 
@AwalGarg You know, the documentation explains all this. You really haven't read it closely
 
I hope I didn't get that many downvotes to my question because of quality right?
 
@SterlingArcher false
 
@BarackObama Is this a meta question?
 
5:08 PM
@KendallFrey ok. I will read it again even more closely if you think so.
 
!!> (Number.isFloat(30.) || Number.isInteger(30.))
 
@SterlingArcher "TypeError: Number.isFloat is not a function"
 
oh wait, the blankline is there cus k doesn't have a type, right? @KendallFrey
 
uh, no
 
@KendallFrey Yes. I was wondering the why, because I put a lot of effort of writing that question and to me seems thought out. It's still getting downvoted though..
 
5:09 PM
then?
 
You keep talking about k as though it's something. It's not, it's a parameter to the callback
@BarackObama On meta, voting goes by whether they agree or not
 
@KendallFrey Oh, ok got it!
 
@AwalGarg If you RTFM, you'll understand what k really is
Or if you add more logging
 
ok. remembering the scope stuff you spoke off, and joining it to this, I think I get it now. k in the function is that parameter, and we didn't pass anything to it, so return return's "". k in JSON.parse is p, so console.log(k) logs p, right?
 
no
Forget what you think you know about k's value, because you're wrong
 
5:12 PM
ok. I will go back to the documentation and re read it. please stay here for 10 minutes...
 
user1832583
I'm trying to use the .onclick(); function to click a div that does not have a defined id, but has a class name, through a chrome extension (basically a manifest file that runs js). My problem is I can't access the div. Here's what I have tried: document.getElementsByClassName("compose")[0].onclick();
 
@coding_corgi What behaviour are you getting, and what did you expect?
 
what you need is .click()
 
@Shamps Welcome to the JavaScript chat! Please review the room pseudo-rules. Please don't ask if you can ask or if anyone's around; just ask your question, and if anyone's free and interested they'll help.
 
not onclick();
 
user1832583
@KendallFrey Just errors, someone helped me in the HTML room (believe it or not) and also said that i should use .onclick
 
@Shamps what you need is to learn javascript not jQuery
 
user1832583
@Shamps that''s what I originally started using
 
@coding_corgi what were the errors ?
 
@AbhishekHingnikar I think he meant this
 
5:17 PM
@SterlingArcher I think that's the first time I've ever seen Thanks in a question title
 
Y U NO CONVERT MY CODE
 
user1832583
@AbhishekHingnikar Something about unidentified object, let me check
 
@SterlingArcher what flag does that even deserve?
 
user1832583
@SterlingArcher Yeah, that's what I meant, it only works if you get an element by id
 
I said it was too broad
 
5:17 PM
@Ondkloss All of them
 
I said too lame
 
not sure if that's the right one
 
@KendallFrey Agreed, but none of them specificly seem to be fitting.
 
I made up a reason
 
Yeah I did @AbhishekHingnikar you need to learn manners
 
5:18 PM
This question appears to be off-topic because it is a request to convert code to another language. — Kendall Frey 2 mins ago
you can do that you know
 
user1832583
@AbhishekHingnikar TypeError: undefined is not a function
 
@coding_corgi That means onclick was not defined
onclick is the click event handler
running it won't actually do the click
 
user1832583
@KendallFrey whaaat?
 
@coding_corgi basically if it was assigned with .onclick it will work otherwise it won't fire the event listeners
 
@coding_corgi yeah, it's just the event handler
 
5:21 PM
@BarackObama I upvoted some of your stuff that was downvoted but was of good quality.
 
user1832583
@AbhishekHingnikar Hmmm, ok...
 
user1832583
Let me check the code
 
Just because the event handler runs doesn't mean it was actually clicked
 
@KendallFrey he needs to use the .dispatchEvent doesn't he ?
 
the click method should trigger the click event
 
user1832583
5:22 PM
@KendallFrey So this document.getElementsByClassName("compose")[0].onclick(); would work, if there was an event handler assigned to "compose"
 
@coding_corgi It would fire that event handler, but it wouldn't actually do anything else from a click
 
document.body.onclick = console.log.bind(console, "hello");
document.body.onclick();
> hello
It will work if the function was assigned by .onclick, which is unlikely
 
> The reviver is ultimately called with the empty string
^is the key right? @KendallFrey
 
user1832583
@KendallFrey There is an event handler, all I want it to do is fire the event handler
 
user1832583
5:24 PM
@AbhishekHingnikar Ok
 
user1832583
@SterlingArcher What's the difference between .click(); and onclick();
 
user1832583
@AbhishekHingnikar It didn't work lol
 
@SterlingArcher i think this is better way
 
user1832583
@SterlingArcher I tried it with click and I think it's working
 
5:27 PM
@KendallFrey u there?
 
user1832583
YASSS!
 
user1832583
It worked!!!
 
@AwalGarg What do you mean "is the key right"?
 
@KendallFrey for return k returning ""
 
5:28 PM
I'm so confused right now
 
me2
 
Can you ask a clear question?
 
why does return k return ""?
 
because k is ""?
 
why does console.log(k) log p?
 
5:30 PM
because k is "p"
 
but you said k is ""
 
It is
You're still missing how the function works
 
how does the function work?
 
Read the first paragraph of the reviver section very carefully
 
ok reading again
 
5:34 PM
Dear everyone who writes. Stop adding double spaces. Thanks.
REALLY REALLY REALLY YES
 
I don't get it.
Aw, so removes double spaces.
 
!!s/so/html/
 
@KendallFrey Aw, html removes double spaces. (source)
 
And that's not what he means
It's when people do this that annoys me. It's a huge pet peeve of mine. I hate it.
 
> property name as string and the property value as arguments.
 
5:38 PM
Where is double space taught, since it appears so often?
 
I have no idea
 
Double spacing between lines, or after a period?
 
How do you call and deal with girls that are short but really bossy and try to control everybody's life around them through drama?
 
@zigi I use alcohol.
 
haha when I do it makes things worse
cause I start talking more and she gets super enraged
 
user1596138
5:40 PM
@Kylar spaces aren't line breaks. Use your inner developer
 
No, no, you leave and go to a bar with others in your case
 
@KendallFrey oh hey, return breaks out of the loop immediately, right?
 
@Jhawins LOL - I thought the tweet was referring to writing writing
not code writing
 
user1596138
@Kylar It was
 
@AwalGarg What? There is no loop.
 
user1596138
5:40 PM
Dude wut
 
user1596138
Nevermind
 
@Kylar what happens if the others that you can go to bar are behaving like grandpas and want to go to bed at 12
 
And a space before punctuation seems to be very common. I don't get it.
 
Sorry, I live in two worlds - English MLA world and Code world
 
@Ondkloss where?
 
5:41 PM
you should never space before punctuation
and only 1 space after
 
I really hate this syntax
if( something )
 
@KendallFrey it first takes the property of the object p and then the object itself, right?
 
for( something )
 
@zigi if you're drinking right, then you'll want to go to bed at midnight too.
 
who uses that
 
5:42 PM
@zigi well I've seen it on SO, but on Facebook it's a plague.
 
@AwalGarg yes indeed
 
@Kylar well I don't drink irresponsibly just to get drunk
that doesn't solve anything
I drink to have fun with friends
 
@KendallFrey so when I do return, it returns from the case of p, and then breaks. while console.log does that for p, then for the object as well, right?
 
@Ondkloss ah yes
 
@zigi Ahh, I see where the disconnect lies. You had a problem, and I was suggesting that you drink heavily to avoid or forget said problem (your SO, in this case).
My intent was not what you understood.
 
5:44 PM
@AwalGarg sorry, what?
 
@Kylar good advice but the problem is taht the girl I have to deal with is the girlfriend of a really good friend and colleague of mine
and he is scared of change that's why he stays with her
and I don't know how to tell him that she is just terrible
and she even makes my life black around him
 
@KendallFrey I do in that reviver this: return(typeof(v)); it returns "object". then I replace return with console.log and I get number (newline) object (newline) <. undefined
 
yep, that would be expected
 
@zigi Ahhh, that's a tough one. In this case, you basically have 2 choices: 1) have a real straight conversation with him, and understand that it may end your relationship, but it's the honest and right thing to do, or 2) Suck it up and see what happens.
 
@Kylar it's not something I am imagining it's a real thing and it is the first time it happens to me and I don't know how to manage
 
5:46 PM
@zigi The other alternative is 3) Stage something so that they break up.
 
@Kylar but I have to work with him
 
1) Is the hardest, especially for us non-confrontational geek types
True
 
0
Q: Political Avatars

Benjamin GruenbaumAre political profiles and/or avatars appropriate? Should they be allowed? Some context: Today I've had a chat with this user: I'd like to hear what the community thinks about this. Full disclosure: I am an Israeli from the "other side", our chat was pleasant and on a positive note, we discu...

 
he is not confrontational but he is kind of hard skull guy
I couldn't convince him that promises are better
 
@KendallFrey I have tried enough reading the docs, but can't figure out why return and console.log are behaving differently in this case, I request you to please tell me why is it so.
 
5:47 PM
than making a setInterval with 100ms delay to check whether all the ajax calls are finished
 
@BarackObama I asked a question about your avatar on meta, I said in the question I don't mind it at all and that we've had a polite constructive discussion in chat. In case you want to give your feedback (I fully get it if you don't) I'd like to invite you to participate meta.stackoverflow.com/q/267368/1348195
 
so I think I better suck it up or use my hackerzz skills
:D haha l3a7x0rR
 
@AwalGarg What do you mean, return always returns the value that you give it.
 
@Zigi - if she's a horrible person, you may consider option 3. Stage something and get them to break up.
 
@KendallFrey what does console.log do then? doesn't it print the value given to it in the console?
 
5:49 PM
yes it does
 
user1596138
Hey! That's so nifty!
 
@Kylar I can assure you she is in a private conversation cause it is long to explain, but I don't want to waste your time, thanks for the good advice
 
user1596138
!!> console.time("aTimer"); Math.random(); console.timeEnd("aTimer");
 
@Jhawins "TypeError: console.time is not a function"
 
@BenjaminGruenbaum out of respect -- I made a joke on your question. Would you like me to remove it?
 
5:50 PM
Nah, I'm better off not knowing
 
Are you assuming that what you return from reviver will be returned from parse? That's obviously not the case.
 
user1596138
 
@SterlingArcher Actually I thought your comment was spot on
 
@SterlingArcher of course not.
 
Politics are complicated.
 
5:50 PM
@Kylar right on bud, thank you once more
 
There's always somebody who will be offended
 
@KendallFrey ok, so what reviver returns is first parsed by the JSON function, then returned, right?
 
@BenjaminGruenbaum mmkay :)
 
user1596138
console.time() functions are great.
 
Tom, zigi also likes speaking about himself in third person :D
 
5:51 PM
But to paraphrase the words of XKCD: "If you think I'm going to change who I am to please a bunch of politically correct mungewads, FSCK. THAT. CRAP."
 
Spicy thai food is spicy
 
I hate that there are so many interns in my office and they're all so hot.. and my boss said I'm not allowed in their cube-land D:
 
@zigi Tom finds it amusing, although Tom's family less so.
 
> the value computed by parsing is transformed before being returned. Specifically, the computed value, and all its properties (beginning with the most nested properties and proceeding to the original value itself), are individually run through the reviver
 
@SterlingArcher I haven't been allowed near the interns since 2009 when I convinced one that CS was not for him and he quit and changed his major to English Lit half way through his project here.
 
5:52 PM
@Kylar why does Tom's family doesn't find it amusing, zigi is a bit puzzled
 
@BenCraig Martijn , I would really appreciate it if you would not make this discussion about the user (and make them easy to find) but rather about the topic of political avatars. I fully understand that it's well within your right to choose not to honor my request. — Benjamin Gruenbaum 44 secs ago
 
lol I graduated high school in 2009...
 
@SterlingArcher you are my age then
 
\o/ 2004 club!
 
5:53 PM
24
I am born in march
 
2010 club, bitches.
 
Ah, I just turned 23 a week ago
 
/me is crazy old
 
ah
 
@KendallFrey hm.. ok, I get it now I think. thanks :) I would still experiment some more with the console.logging etc. btw, is there a way to see what the reviver function returns to the JSON parser?
 
5:53 PM
well we graduate high school on 19
:D
 
@BenjaminGruenbaum My apologies, just wanted to point that out to you
 
@Kylar how old is Tom
 
@AwalGarg It's exactly what you return, what's so hard?
 
Ah, we usually graduate at 18, but I was 17
 
is Tom ~40
 
5:54 PM
@BenjaminGruenbaum Thank you for the upvotes and also the meta post, it's really appreciated! I'll surely follow up and change my username and avatar if the community chooses it's more appropriate to :-)
 
Yeah
around there
 
Summer birthdays can be weird. I was 17 as well
 
within 5%
 
Tom shouldn't worry, 40 is not that old
 
@BenCraig no harm done, it's well within your rights. I just want to understand what the community feels about this.
 
5:55 PM
so either 39 or 41
 
@KendallFrey I think I should come back to this morning afresh. g'night (according to my time)
 
I gotta go now
see ya
 
@NickDugger it sucked being a minor my senior year of high school. Despite me driving to school etc etc, I still had to call my mom or dad to let me out if I was sick
 
See you!
 
See you zigi :-)
 
5:55 PM
@zigi you fool. you have to go when I have to go... why didn't you go earlier???
 
Bye zigi
I'll miss you
I love you
 
One time my mom bitched out the admins of my school because she was forced to leave work to pick me up, instead of them letting me drive half a mile home.
 
Yeah, but on the plus side, I have 15 years of java experience
so I got that going for me... which is nice
 
All because I wasn't 18
 
I didn't have any issues driving while in school.
 
5:56 PM
@Jhawins I am sorry, I participated in unmuting that zigi. I did a big mistake... you were so right in that action. he does really keep stirring the chat.
 
@Kylar I have like.. 15 weeks of Java experience lol
 
user1596138
@AwalGarg Idk what you mean mam
 
@AwalGarg You can choose to ignore certain users so that you don't see their messages.
 
@Jhawins weren't you the person who originally muted zigi?
 
What is wrong with zigi guys?
 
5:59 PM
Let me consult my psychology degree
 
New topic, how 'bout dat new foo fighters album, eh?
 
user1596138
@AwalGarg I'm not sure I want to participate in this discussion.
 
zzz. good night people
 

« first day (1384 days earlier)      last day (3569 days later) »