I have a code js;
<script type="text/javascript">
init_test(500,100);
document.write(init_test[0]);
</script>
but output is wrong, it is not result is 500. How to fix ?
I have a code js;
<script type="text/javascript">
init_test(500,100);
document.write(init_test[0]);
</script>
but output is wrong, it is not result is 500. How to fix ?
It looks like you intended init_test to be an array. Currently you are attempting to call a function named init_test with two arguments. What you wanted was this:
var init_test = [500, 100]; //init_test is an array with 2 elements
document.write(init_test[0]); //Write the element at index 0
If that's not what you intended, and init_test is a function that you haven't shown in your question, and that function returns an array or an object, you need to assign the return value to a variable and then access the index of that:
var returned = init_test(500, 100);
document.write(returned[0]);