Concatenate string through a loop
Posted: Thursday 12 September 2019 14:15
Hi,
I'd like to loop my devices and collect the names of those that are active and concatenate them I to one string. Looping and getting names is working but I am having trouble to put them I to one string and print it to log.
I'd like to something like this:
d.devices().filter(Geräte).forEach(function(device)
if (device.state=='On') then
string==string .. device.name
end
end
d.log(string)
How can I achieve this?
Thx,
zavjah
I'd like to loop my devices and collect the names of those that are active and concatenate them I to one string. Looping and getting names is working but I am having trouble to put them I to one string and print it to log.
I'd like to something like this:
d.devices().filter(Geräte).forEach(function(device)
if (device.state=='On') then
string==string .. device.name
end
end
d.log(string)
How can I achieve this?
Thx,
zavjah