extract wallet address from private key I am using bitcoin core library in node js.

const privateKey = new bitcore.PrivateKey('testnet');
const address = privateKey.toAddress('testnet);


When i console.log it, it get result as below. How can i extract the address part only? I try to use address.Address but it returns undefined

&lt;Address: mmNeqV9HWKUDRUAVdknRKDPHyKYGpBEDzm, type: pubkeyhash, network: testnet&gt;
it's better to get public key first then convert it to address

var publicKey = privateKey.toPublicKey();
var address = publicKey.toAddress(Networks.livenet);


address is an object, you can use it as a string. if you want to see it in console try

console.log("Address: ", address);