I am writing a Javascript function where I need to count the number of unique entry in a certain column in my SQLite Database. So far, what I have tried to do is to just simply count the number of entries present as I need that as a parameter when I populate entries. My function goes as such:
MasterTreeDB.transaction(function(transaction) {
    transaction.executeSql("SELECT COUNT(*) FROM MasterTreeTable", [],
        function(transaction, result) {
            //console.log(result.rows);
            console.log(result.rows.item(0));
        },
        function(transaction, error){
            // error occured
            console.log("Error occured");
        }
    );
});
However, this is what the console shows: Object {COUNT(*): 4}
I have also looked around and I saw a solution that involved changing results.row.item(0) to results.row.item(0)["count(*)"]. However, when I did that, the log showed undefined
I feel like I'm really close to getting the result I want and I'm missing something rather basic. Any help/input is very much appreciated, thank you in advance.
 
    