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
Post a Comment