Q:

How to get the total number of lists present in a site using javascript?

I have used the below code to do the same bt it shows some error in the alert..
<script type="text/javascript">

var siteUrl = '/sites/MySiteCollection';
_spBodyOnLoadFunctionNames.push("retrieveAllListProperties");
function retrieveAllListProperties() {

    var clientContext = new SP.ClientContext(siteUrl);
    var oWebsite = clientContext.get_web();
    this.collList = oWebsite.get_lists();

    clientContext.load(collList);

    clientContext.executeQueryAsync(Function.createDelegate(this, this.onQuerySucceeded), Function.createDelegate(this, this.onQueryFailed));
}

function onQuerySucceeded() {

    var listInfo = '';

    var listEnumerator = collList.getEnumerator();

    while (listEnumerator.moveNext()) {
        var oList = listEnumerator.get_current();
        listInfo += 'Title: ' + oList.get_title() + ' Created: ' + oList.get_created().toString() + '\n';
    }
    alert(listInfo);
}

function onQueryFailed(sender, args) {
    alert('Request failed. ' + args.get_message() + '\n' + args.get_stackTrace());
}

</script>

A:

This javascript code works.....
<script type="text/javascript">
    ExecuteOrDelayUntilScriptLoaded(init,'sp.js');
    var clientcontext;
    var website;
    var Lists;
    function init(){
    clientcontext=SP.ClientContext.get_current();

    website=clientcontext.get_web();

    Lists=website.get_lists();
    clientcontext.load(Lists);
    clientcontext.executeQueryAsync(onRequestSucceeded, onRequestFailed);

    }
    function onRequestSucceeded(){

    var listInfo = '';

        var listEnumerator = Lists.getEnumerator();

        while (listEnumerator.moveNext()) {
            var List = listEnumerator.get_current();
        listInfo += 'Title: ' + List.get_title() + '<br>';
        var camlQuery = new SP.CamlQuery();
            var q = "<Where><Eq><FieldRef Name='StatusID' /><Value Type='Integer'>1</Value></Eq></Where>";
            camlQuery.set_viewXml(q);
            this.listItems = List.getItems(camlQuery);
            clientContext.load(listItems, 'Include(Id)');
        clientContext.executeQueryAsync(Function.createDelegate(this, this.onListItemsLoadSuccess), 
            Function.createDelegate(this, this.onQueryFailed));

        }

        document.getElementById('list').innerHTML=listInfo;

        }

        function onQueryFailed(sender, args) {
            alert('request failed ' + args.get_message() + '\n' + args.get_stackTrace());
        }

    }

    function onRequestFailed(sender, args) {
        alert('Error: ' + args.get_message());
    }
    </script>
    <div>
    <span id='list'></span>
    <span id='cnt'></span>
    </div>

