Click here to Skip to main content
15,893,588 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: Trick Javascript question of the day Pin
Chris Maunder10-Oct-16 0:20
cofounderChris Maunder10-Oct-16 0:20 
GeneralRe: Trick Javascript question of the day Pin
Nish Nishant10-Oct-16 4:05
sitebuilderNish Nishant10-Oct-16 4:05 
GeneralRe: Trick Javascript question of the day Pin
Vark11110-Oct-16 4:07
Vark11110-Oct-16 4:07 
GeneralRe: Trick Javascript question of the day Pin
Brady Kelly10-Oct-16 5:41
Brady Kelly10-Oct-16 5:41 
GeneralRe: Trick Javascript question of the day Pin
Chris Maunder10-Oct-16 12:52
cofounderChris Maunder10-Oct-16 12:52 
GeneralRe: Trick Javascript question of the day Pin
Roger Wright9-Oct-16 22:43
professionalRoger Wright9-Oct-16 22:43 
GeneralRe: Trick Javascript question of the day Pin
Vincent Maverick Durano10-Oct-16 4:10
professionalVincent Maverick Durano10-Oct-16 4:10 
GeneralRe: Trick Javascript question of the day Pin
Palash Mondal_9-Oct-16 19:45
professionalPalash Mondal_9-Oct-16 19:45 
The tricky bit is here:

https://jsfiddle.net/vzmh2eL6/1/[^]

Returns `undefined`

Same thing happens if you use any other expression like:

JavaScript
return [1,2];  // returns the array


vs
JavaScript
return
  [1,2];  // returns `undefined`


This happens since based on Standard ECMA-262 5.1 Edition section [^]:

JavaScript
return [no LineTerminator here] Expression ;


we can not have any line terminators or new line between the return and the expression. If Expression is omitted, the return value is undefined. Otherwise, the return value is the value of Expression.

Hope it helps!
Regards,
Palash


modified 10-Oct-16 2:07am.

GeneralRe: Trick Javascript question of the day Pin
Super Lloyd9-Oct-16 20:52
Super Lloyd9-Oct-16 20:52 
GeneralRe: Trick Javascript question of the day Pin
jsc429-Oct-16 21:41
professionaljsc429-Oct-16 21:41 
GeneralRe: Trick Javascript question of the day Pin
jsc429-Oct-16 21:48
professionaljsc429-Oct-16 21:48 
GeneralRe: Trick Javascript question of the day Pin
Roger Wright9-Oct-16 22:20
professionalRoger Wright9-Oct-16 22:20 
GeneralRe: Trick Javascript question of the day Pin
Member 764190710-Oct-16 2:00
Member 764190710-Oct-16 2:00 
GeneralRe: Trick Javascript question of the day Pin
Brady Kelly10-Oct-16 5:52
Brady Kelly10-Oct-16 5:52 
QuestionASP.Net Core Pin
Marco Bertschi9-Oct-16 11:15
protectorMarco Bertschi9-Oct-16 11:15 
AnswerRe: ASP.Net Core Pin
Chris Maunder9-Oct-16 11:55
cofounderChris Maunder9-Oct-16 11:55 
RantRe: ASP.Net Core Pin
Mycroft Holmes9-Oct-16 15:12
professionalMycroft Holmes9-Oct-16 15:12 
AnswerRe: ASP.Net Core Pin
User 101325469-Oct-16 22:28
User 101325469-Oct-16 22:28 
GeneralWow. Just wow. Pin
Brisingr Aerowing9-Oct-16 10:19
professionalBrisingr Aerowing9-Oct-16 10:19 
GeneralRe: Wow. Just wow. Pin
Marco Bertschi9-Oct-16 11:14
protectorMarco Bertschi9-Oct-16 11:14 
GeneralRe: Wow. Just wow. Pin
BillWoodruff9-Oct-16 20:26
professionalBillWoodruff9-Oct-16 20:26 
GeneralRe: Wow. Just wow. Pin
Brisingr Aerowing13-Oct-16 9:14
professionalBrisingr Aerowing13-Oct-16 9:14 
GeneralRe: Wow. Just wow. Pin
Johnny J.9-Oct-16 20:41
professionalJohnny J.9-Oct-16 20:41 
GeneralRe: Wow. Just wow. Pin
ZurdoDev10-Oct-16 0:51
professionalZurdoDev10-Oct-16 0:51 
GeneralRe: Wow. Just wow. Pin
GenJerDan12-Oct-16 6:19
GenJerDan12-Oct-16 6:19 

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.