0

I have data.js file with content:

var table=[];
table.push('10','11');

I want to use it in the other script, which looks like this:

var script=document.createElement("script");
script.src="http://xxxx/data.js";
document.body.appendChild(script);

setTimeout(function(){alert(table);},5000);

When i paste this to Firebug and run it, at the first time i got

function () {
[native code]
}

When i run this again i get what i wanted which is:

10,11

How can i achive this result at the first time i run this script?

2
  • 3
    alert is not a debugging tool, you should be using the console Commented Dec 31, 2014 at 13:35
  • Someone wrote here to set array name to diffrent than 'table'. I don't understand why but this solved the problem. Thanks. Commented Dec 31, 2014 at 14:03

1 Answer 1

1

Firebug has a function called table, presents data in a tabular layout to easily inspect an object. Try going to firebug and doing

table("a");

And then

table({a:1,b:2});

That is why you are getting the native function

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.