How to get property value


i have a Promise which i used to get the stored data of in an Ionic storage

return new Promise(resolve => resolve(this._storage
.then(value => value)));

and it prints out {“user-profile”:“user”,“acct_no”:“1234567890”}

how do u get the value of acct_no?


The question sounds backwards, because it looks to me like value has a property acct_no, not the other way around.


i have corrected it, how do i get the value of acct_no? which will be in this case 1234567890


I really hate property names like “value” and “data” that convey no meaningful information, but {{value.acct_no}}.


just correct your code to this

return new Promise(resolve => resolve(this._storage
.then(value => value.acct_no)));


There is absolutely no need to instantiate a new Promise here. Storage gives you a perfectly good one.