How to store execute javascript result in bas variable ?
-
I tried this code but bas variable didnt stored the result, i have checked this code by pasting it in console and the result is getting printed when entered on chrome console. But in bas the result is not getting stored in bas variable when using execute javascript action.
Link where i execute javascript code : https://www.hindigeetmala.net/singer/lata_mangeshkar.php
Code :var links = document.querySelectorAll("a"); var results = []; links.forEach(link => { if(link.href.includes("/song")){ results.push(link.href); } }) if(results.length > 0){ var uniqueSet = new Set(results); var resultsUnique = [...uniqueSet]; VAR_BASNEWVAR = resultsUnique; return resultsUnique; }
How can i store the result in bas variable ?
-
@niceusername said in How to store execute javascript result in bas variable ?:
How can i store the result in bas variable ?
No way
-
I should not use return keyword, my bad, thanks
-
@Fox said in How to store execute javascript result in bas variable ?:
@niceusername said in How to store execute javascript result in bas variable ?:
How can i store the result in bas variable ?
No way
Hey, I got the result in BAS variable but the result was an array but when it is passed to BAS variable it converts to string. I want to use that BAS variable as an array so i can loop through it, how can i achieve that please ?
-
@niceusername said in How to store execute javascript result in bas variable ?:
@Fox said in How to store execute javascript result in bas variable ?:
@niceusername said in How to store execute javascript result in bas variable ?:
How can i store the result in bas variable ?
No way
Hey, I got the result in BAS variable but the result was an array but when it is passed to BAS variable it converts to string. I want to use that BAS variable as an array so i can loop through it, how can i achieve that please ?
The result of executing the action will always be a string, use a delimiter, then the string to parse into an array