Why doesn't JavaScript require semicolons after function declarations? -


this question has answer here:

a student asked me why javascript requires semicolons after variable declarations not after function declarations , didn't have answer.

for example, these variable declarations (including 1 holding function) followed semicolons...

var x = 5; var test = function() { return null; }; 

but function declaration has no semicolon afterwards nor should it. why? logic behind differentiation? why variable assignment require semicolon function declaration not?

function test {     return null; } 

semicolons serve separate statements each other, , functiondeclaration not statement.


Comments

Popular posts from this blog

resizing Telegram inline keyboard -

command line - How can a Python program background itself? -

php - "cURL error 28: Resolving timed out" on Wordpress on Azure App Service on Linux -