How export a nested variable from a function?
Hey guys I wonder how can I export this nested variable or If there isn't, is there another way to handle this? Thanks!
7 Replies
Next time please don't put screenshots of code, use the codeblocks. (read the pinned post in this channel "How to ask good questions")
const data = svgToArr(text)
will call the function, but to receive the data back, you need to return arr
at the end of the functionYour declaring arr outside do you need to return it I guess it's just modifying the original arr outside your function
sorry about that and thanks for the help and actually I changed the code to this The problem now if it is possible to get the arrUrls after exporting my links to another js file if I call it there 😁 tbh I don't know what I'm doing
yes I want to return the array and be able to reuse it on another JS file
Oo like imports I get it now
yes exactly
So in the end, I just want to export this array of links that I get from the CSV and export it from one file to another and be able to reuse it to there🥲
export - JavaScript | MDN
The export declaration is used to export values from a JavaScript module. Exported values can then be imported into other programs with the import declaration or dynamic import. The value of an imported binding is subject to change in the module that exports it — when a module updates the value of a binding that it exports, the update will be vi...
I see, thanks man🙌🏼 OVA I need to change my code