JSOM required Libraries:
MicrosoftAjax.js - Loaded via ScriptResource.axd
SP.runtime.js - Loaded directly from layouts folder
SP.js - Loaded from Layouts folder
Only in the context of a Site Collection and not beyond it. Can only run in the context of current user.
Also use _context = new SP.ClientContext("subsite url");
Also use _context = new SP.ClientContext.get_current()
ERROR HANDLING in JSOM

On Success call back of the Server - Do this to see if there really is a error from the code above - Just for informational purpose.
Interesting Program that creates a list in the catch block if it does not exist yet. Also see the use of Javascript Parser
MicrosoftAjax.js - Loaded via ScriptResource.axd
SP.runtime.js - Loaded directly from layouts folder
SP.js - Loaded from Layouts folder
Only in the context of a Site Collection and not beyond it. Can only run in the context of current user.
Also use _context = new SP.ClientContext("subsite url");
Also use _context = new SP.ClientContext.get_current()
ERROR HANDLING in JSOM
On Success call back of the Server - Do this to see if there really is a error from the code above - Just for informational purpose.
Interesting Program that creates a list in the catch block if it does not exist yet. Also see the use of Javascript Parser