In JSOM, we can not access a property of an object before load and excecute. But I don't understand why code 1 works and code 2 doesn't:
Code 1: Here I am accessing the List property of web
var web= context.web; var lists=web.get_lists().getByTitle("myList"); //this works.
Code 2: Here I am accessing the Title property of web
var web=context.web; var title=web.get_title(); //this throw exception
Both the code accessing the web properties but one works and other doesn't. Am I missing something?
UPDATE: made code changes for JSOM.