fai960820 Posted March 14, 2013 Share Posted March 14, 2013 (edited) <script>int[][] num = new int[4][5];num[1][1]={0,1,2,3,4};alert(num[1][2]);</script> This give my an error " Uncaught SyntaxError: Unexpected token ] " (shown by chrome) #for the "int[][] num = new int[4][5];" line Please help. Edited March 14, 2013 by fai960820 Link to comment Share on other sites More sharing options...
justsomeguy Posted March 14, 2013 Share Posted March 14, 2013 Javascript isn't C. You define an array like this: var num = new Array(); or var num = []; num[1][1]=[0,1,2,3,4]; You can create a for loop if you want to loop through and build the array. Link to comment Share on other sites More sharing options...
T1000Android Posted March 20, 2013 Share Posted March 20, 2013 In javascript, there are no types like in C. The browser automatically figures out the type of the variable based on its value so there is no need for int, float, or char. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now