Hi Tobias,
>>> On 23.11.2017 at 13:31, Tobias Koeck wrote:
[...]
> just checked it out. It's possible to create a local variable with
>
> locals.temp = a * b
> instead of
> var temp = a * b.
great, that you shared your test-results. Thanks.
> The usage of the keywords locals, this and globals a
Hi Kai,
just checked it out. It's possible to create a local variable with
locals.temp = a * b
instead of
var temp = a * b.
The usage of the keywords locals, this and globals aren't necessary just
for readability. As far as I have read there is a priority from locals to
this to globals variabl
Hi Tobias,
AFAIK the usage of the keyword "locals" is more or less for readability. I'm
not sure, if you can create the variable using your second example, but you can
access it in your function using "locals.temp" afterwards. If you have already
created variables named "temp" in different scop
Hi Kai,
thanks for the answer.
I did read the 'manual / website documentation several times and I have
understood the scope of local variables.
It's possible to write the function either with
function multiply(a, b) {
var temp = a * b
return temp
}
or with
function multiply(a, b) {
RTFM ;)
The *local* scope contains variables which only exist during the
invocation of the current function, object or apply statement. *Local*
variables can be declared using the var keyword:
function multiply(a, b) {
var temp = a * b
return temp
}
Each time the multiply function is i
Hi,
what is the difference between
var varname = 1
and
locals.varname = 1
And when use one and the other?
Greetings
Tobias
___
icinga-users mailing list
icinga-users@lists.icinga.org
https://lists.icinga.org/mailman/listinfo/icinga-users