Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Javascript with blockchain development, address.trans returns [] when theres no transactions pend

address.trans returns [] when theres no transactions pend
if(txs === []){
returns a transaction still

Any solutions? Basically registering a "depo" when I never depo’d to the generated wallet.enter image description here

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

This should be happening because an array is an object. And two objects even with the same value are not equal in JS because they have different reference.

You can see that below:

let trans = [];
console.log(trans === []);
console.log([] === []);
console.log(trans.length === 0);

Array.prototype.length can be one way to check it:

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading