Click here to Skip to main content
15,905,874 members

Welcome to the Lounge

   

For discussing anything related to a software developer's life but is not for programming questions. Got a programming question?

The Lounge is rated Safe For Work. If you're about to post something inappropriate for a shared office environment, then don't post it. No ads, no abuse, and no programming questions. Trolling, (political, climate, religious or whatever) will result in your account being removed.

 
GeneralRe: Explaining JavaScript and this to people. Pin
jsc423-Dec-17 21:29
professionaljsc423-Dec-17 21:29 
GeneralRe: Explaining JavaScript and this to people. Pin
Nathan Minier4-Dec-17 1:32
professionalNathan Minier4-Dec-17 1:32 
GeneralRe: Explaining JavaScript and this to people. Pin
grolarbear4-Dec-17 2:11
grolarbear4-Dec-17 2:11 
GeneralRe: Explaining JavaScript and this to people. Pin
Marc Clifton4-Dec-17 5:26
mvaMarc Clifton4-Dec-17 5:26 
GeneralRe: Explaining JavaScript and this to people. Pin
PIEBALDconsult3-Dec-17 14:17
mvePIEBALDconsult3-Dec-17 14:17 
GeneralRe: Explaining JavaScript and this to people. Pin
Jeremy Falcon3-Dec-17 14:30
professionalJeremy Falcon3-Dec-17 14:30 
GeneralRe: Explaining JavaScript and this to people. Pin
Chris Maunder3-Dec-17 15:41
cofounderChris Maunder3-Dec-17 15:41 
GeneralRe: Explaining JavaScript and this to people. Pin
Jeremy Falcon3-Dec-17 16:00
professionalJeremy Falcon3-Dec-17 16:00 
Chris Maunder wrote:
Now explain closures and you'll have everyone halfway there.
You'll hear 40 million different definitions online about that. And most of them try to sound smart, but put simply it's a function within a function. People will try to tack on crap with scoping etc. to that definition when "explaining" it, but that's irrelevant to the core concept of it IMO.
Chris Maunder wrote:
And of course the obligatory WAT video whenever Javascript weirdness is raised.
Ok, that dude is hilarious.

I have no idea why the object stuff in JavaScript turned out the way it did, but I can at least explain the 'wat' + 1 thing. The plus sign is used for string concatenation and arithmetic. The minus sign isn't. So in the former example, the interpreter assumes you're trying to concatenate using the most compatible types between the two operands, which is usually a string. The minus sign only only used for arithmetic and so it's NaN.
Jeremy Falcon

GeneralRe: Explaining JavaScript and this to people. Pin
Jörgen Andersson3-Dec-17 19:39
professionalJörgen Andersson3-Dec-17 19:39 
GeneralRe: Explaining JavaScript and this to people. Pin
Jeremy Falcon3-Dec-17 20:40
professionalJeremy Falcon3-Dec-17 20:40 
GeneralRe: Explaining JavaScript and this to people. Pin
Rob Grainger4-Dec-17 1:57
Rob Grainger4-Dec-17 1:57 
GeneralRe: Explaining JavaScript and this to people. Pin
Jeremy Falcon4-Dec-17 4:27
professionalJeremy Falcon4-Dec-17 4:27 
GeneralRe: Explaining JavaScript and this to people. Pin
KarstenK3-Dec-17 20:22
mveKarstenK3-Dec-17 20:22 
GeneralRe: Explaining JavaScript and this to people. Pin
Jeremy Falcon3-Dec-17 20:39
professionalJeremy Falcon3-Dec-17 20:39 
GeneralRe: Explaining JavaScript and this to people. Pin
Marc Clifton4-Dec-17 5:28
mvaMarc Clifton4-Dec-17 5:28 
GeneralRe: Explaining JavaScript and this to people. Pin
GuyThiebaut3-Dec-17 21:37
professionalGuyThiebaut3-Dec-17 21:37 
GeneralRe: Explaining JavaScript and this to people. Pin
Jeremy Falcon4-Dec-17 4:18
professionalJeremy Falcon4-Dec-17 4:18 
GeneralRe: Explaining JavaScript and this to people. Pin
grolarbear4-Dec-17 15:19
grolarbear4-Dec-17 15:19 
GeneralRe: Explaining JavaScript and this to people. Pin
Member 120616003-Dec-17 23:00
Member 120616003-Dec-17 23:00 
GeneralRe: Explaining JavaScript and this to people. Pin
Jeremy Falcon4-Dec-17 4:21
professionalJeremy Falcon4-Dec-17 4:21 
GeneralRe: Explaining JavaScript and this to people. Pin
Member 120616004-Dec-17 4:29
Member 120616004-Dec-17 4:29 
GeneralRe: Explaining JavaScript and this to people. Pin
Jeremy Falcon4-Dec-17 4:34
professionalJeremy Falcon4-Dec-17 4:34 
GeneralRe: Explaining JavaScript and this to people. Pin
Member 120616004-Dec-17 6:53
Member 120616004-Dec-17 6:53 
GeneralRe: Explaining JavaScript and this to people. Pin
Nathan Minier4-Dec-17 1:34
professionalNathan Minier4-Dec-17 1:34 
GeneralRe: Explaining JavaScript and this to people. Pin
Jeremy Falcon4-Dec-17 4:22
professionalJeremy Falcon4-Dec-17 4:22 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.