Reading through Invoking a function without parentheses it is stated multiple times in the comments and answers to not use such code in production. Why please?
I am a beginner at JavaScript as you can guess from the question. If someone could phrase their answer in layman's terms that would be great, though please also counter for the experienced JS folks among you that might need a more detailed and technically detailed reply.
Examples of what could or does go wrong with using functions without parentheses in production would be a great addition to an answer.
Here is example code of invoking functions without parentheses taken from the answers to that question.
var h = {
get ello () {
alert("World");
}
}
Run this script just with:
h.ello // Fires up alert "world"
or
var h = {
set ello (what) {
alert("Hello " + what);
}
}
h.ello = "world" // Fires up alert "Hello world"