Start with some valid Javascript. What you have above is not.
Arrays don't have keys. And objects MUST have keys.
What do you really have? Is this just a copy/paste error? Did you put { where you meant [ and [ where you meant {?
As well, your values have to be quoted, unless you actually have VARIABLES named math and science.
Open up your browser's console window and always check for errors.
And normally you should declare variables with var (or let or const if you use ES6). Did you actually mean test to be a global variable, or did you forget to declare it? It's best to be explicit about globals, and if you meant it to be global write window.test = (globals in browser Javascript are really just properties of the window object.)