After successfully retrieving all JavaScript variables using the instructions provided in this topic, I decided to take it a step further. However, I encountered a challenge when trying to extract strings that were not declared as variables. For instance, while iterating through the code snippet below, I noticed that only the value of the variable hello was outputted and not the string "Passing My Message", which was not declared as a variable.
Want to know how to get all Javascript Variables? Click here!
<script>
function MyFunction(msg){
alert('Message Passed : '+msg)
}
var hello = "AAA";
MyFunction("Passing My Message");
for (i in this){
console.log(i + " : " + eval(i));
}
</script>
Now, my query is whether there is a method or technique that would allow me to obtain the string Passing My Message in the output.