Mulkins: God I hate websites that attempt to **** with my scroll acceleration
Arvanitis: I was literally bout to tear my code apart
Medders: Which conditional do you folks prefer? https://gist.github.com/tejasmanohar/03f2afd0353d99210abe#file-js-L17
Schelle: Longer line or 3 lines
Nasalroad: Xckpd7, did you see my paste ?
Masi: Xckpd7: Maybe just log the actual values you want to see
Graichen: Otherwise, yeah, you can create a logging wrapper
Zanini: Not sure if console.dir would fix the problem
Kozyra: Can’t do return { phoneNumber, source } at the bottom of the function outside of the conditional chain because block-scope
Bevilacqua: Nasalroad: lol yeah but then I started reading STRML’s stuff, I see you put the answer there. oh man :
Decillis: STRML: I could but the object represents the state of my application and I just want to see the data at a poitn in time
Justo: Yeah. Then just make a log function
Kitagawa: Alright. I’ll try the .dir but I feel like it’s going to be the same
Kudrick: I used to use .dir all the time but stopped because console.log got good
Plessis: Yeah same thing. thanks though I’ll make the log
Trucchi: Tejasmanohar: sure you can, you can just declare them before the conditional, and use var instead of const. You aren’t gaining anything from using const there anyway, since you’re immediately ***igning the value to a returned object
Trucchi: That said I’d probably just use a ternary there
Trucchi: OR a function hash actually
Trucchi: Oh wait, nevermind the hash
Kennell: What ternary would you use? jae
Delrosso: This is what i derived, Trucchi https://gist.github.com/tejasmanohar/4f5a5e4bf07256987023
Trucchi: Return obj.phoneNumber ? { phoneNumber: formatCountryobj.phoneNumber, source: ‘website’ } : { phoneNumber: formatCountryobj.From, source: ‘cookie’ };
Arbetman: That’s a super long line, no?
Trucchi: But I find you can put the : on the second line and it looks clean
Trucchi: But others would disagree
Kratt: What are the pros /cons of using events on do***ent
Trucchi: As for the else-if, well, currently your else-if is going to return nothing if both of the conditionals aren’t true
Fuente: Like this? https://gist.github.com/tejasmanohar/4f5a5e4bf07256987023#file-js-L13 jaawerth
Brittman: Ternary would be if-else not if else-if
Trucchi: Tejasmanohar: ah, I thought your else-if was unnecessary there because you didn’t have a fallback option – so you want it to return nothing if neither condition p***es?
Pellicone: Trucchi: sure, since there’s an if !phoneNumber in the other function
Laiben: Maybe false would be better? not sure.
Mauriello: In the current context, what i’md oing works fine. not sure if it’s the _best practice_ though-
Trucchi: In that case I’d probably just write two if statements and leave it at that
Trucchi: Ultimately it just comes down to personal preference though
Goshay: Yeah i guess, easier to read with else if to me
Boera: Even when you don’t need i t i use it except wheni ‘m returning a “default” kinda value at the bottom of the function
Sidebottom: But yeah it’s whatever
Gowen: If I have ‘hello hi’ i wanna get the number of white spaces
Trucchi: Tejasmanohar: here’s a dirty thing you can do that relies on coercion and I’m definitely not recommending it but I think it’s cute:
Eilers: Alright : – i’m ready
Oberer: Can any one help me with this Promise question?
Pauldo: Https://gist.github.com/mergeweb/e20dd4133740025781fa
Cujas: BeforeSave and send both return promises
Trucchi: Var table = { false: function { return ‘newp’; }, true: function { return ‘yep’; } }; table!0