Tuesday 15 January 2019

Javascript Asynchronous Calls

We can do this with the help of async await which is more easier and clear way to write async code.async function getUserStatus() { var status; db.transaction(function (tx) { try { var result = await tx.executeSql('SELECT id FROM calculator ORDER by id ASC LIMIT 1'); var len = results.rows.length; var row = results.rows.item(0); console.log(row['id']); status = { question: row['id'] }; } catch (error) { console.log(err); } } }); }
I hope this will help.

No comments:

Post a Comment