0
window.addEventListener('load, initialize()); 'use strict' console.log('Im working); var c = [ ["TEST!","TEST@"] ]; function initialize() { console.log(c[0].[1]); } 

I have tried for hours to make this code print out "TEST!", But the google console debugger, will no matter what I try, will say that the last set of square brackets is a unexpected Token. At this point, I just don't know what to do.

2
  • 2
    Error 1 : ner('load', initialize); Error 2 : c[0][1] Commented Mar 5, 2016 at 13:28
  • Eliminate that dot between brackets. c[0][1] Commented Mar 5, 2016 at 13:43

1 Answer 1

2

bracket notation does not use dots

var c = [ [1,2] ]; console.log(c[0][1]);

Another issue with your code is

window.addEventListener('load, initialize()); 

If initialize is returning a function it is correct. If it is not returning a function, than you are calling the method before the page load and assigning what it returns to the load event listener.

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

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.