mirror of
https://github.com/alrayyes/wiki.git
synced 2024-12-01 15:26:23 +00:00
526 B
526 B
id | title |
---|---|
2b93c1c4-b0ed-4b03-846b-557ccc9d6080 | JavaScript declaration notation |
There is a shorter way to declare functions:
function square(x) {
return x * x
}
console.log(square(5))
Function declarations are not part of the regular top-to-bottom flow on control. They are conceptually moved to the top of their scope and can be used by all the code in that scope.
console.log("The future says:", future())
function future() {
return "Where are my flying cars?"
}