How can I get a handle to "[[PromiseValue]]"?
I tried "a[[PromiseValue]]"
This is nothing to do with arrays. [[PromiseValue]]
is the name of the property.
It's an internal property of the promise object you shouldn't access directly (if you even can, which I doubt). If you could, it would be with brackets notation and a string:
a["[[PromiseValue]]"]
...but again, you shouldn't do that (if you even can I checked, and you can't). Instead, use then
to get notification when the promise has been settled, and to receive its value:
a.then(function(value) {
// ...
});
Example:
var a = new Promise(function(resolve) {
resolve("Hi"); // <== Settles the promise and sets its value
});
a.then(function(value) {
snippet.log(value); // Using the value
});
<!-- Script provides the `snippet` object, see http://meta.stackexchange.com/a/242144/134069 -->
<script src="http://tjcrowder.github.io/simple-snippets-console/snippet.js"></script>