Assignment of an array in node.js to process.env variable results in String
When I assign an array variable to say process.env.deviceData
, it changes to String.
Example:
$ node
Welcome to Node.js v14.15.5.
Type ".help" for more information.
> result=['1','2','3']
[ '1', '2', '3' ]
> process.env.deviceData=result
[ '1', '2', '3' ]
> console.log(process.env.deviceData)
1,2,3
undefined
> console.log(result)
[ '1', '2', '3' ]
undefined
> typeof process.env.deviceData
'string'
> typeof result
'object'
Is above expected? If yes, how can I assign array variable to process.env.deviceData
?
from Recent Questions - Stack Overflow https://ift.tt/3sA914m
https://ift.tt/eA8V8J
Comments
Post a Comment