Closed Bug 1440605 Opened 7 years ago Closed 7 years ago

Issue in javascript compilation

Categories

(Firefox :: Untriaged, defect)

52 Branch
defect
Not set
normal

Tracking

()

RESOLVED INVALID

People

(Reporter: loic.bried, Unassigned)

Details

User Agent: Mozilla/5.0 (Windows NT 5.1; rv:52.0) Gecko/20100101 Firefox/52.0 Build ID: 20180118122319 Steps to reproduce: var myObj = (function() { return { something : 'some value' }; })(); console.log(myObj); Actual results: console.log says "undefined" Expected results: console.log should log a well formed object. But it works if "return" and "{" are on the same line. Is it a compilation issue ?
you shouldn't put newline after `return`, if you want to return a value, otherwise semicolon is inserted there. https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/return#Automatic_Semicolon_Insertion
Status: UNCONFIRMED → RESOLVED
Closed: 7 years ago
Resolution: --- → INVALID
You need to log in before you can comment on or make changes to this bug.