0

In JS, what do programmers mean when they talk about statements being executable or not executable? In particular, why is a function declaration not executable but a function expression executable?

nezza
  • 1
  • 1
  • i've not heard that term much, so i wouldn't read too much into it, but it sounds like a matter of when code is evaluated; now or later. do you have a link to the unclear uage? – dandavis May 04 '22 at 21:53
  • yes! https://www.w3schools.com/js/js_function_definition.asp – nezza May 04 '22 at 21:56
  • that's some low-quality info right there. They mix up expressions and statements and draw confusing and rather meaningless distinctions. I've been writing JS daily for 15 years and I'm not sure what they are getting at. The main diff is more of a statement vs an expression; expressions result in a value (eg. x=6), statements don't (eg. var x=6). That means you can, eg alert() an expression (`alert(x=5)`), but not a statement (`alert(var x=4)`), and that seems to most closely match their ambiguous distinction. – dandavis May 04 '22 at 22:11

0 Answers0