Last active
July 21, 2018 13:03
-
-
Save eouw0o83hf/7fc1d90af5fc19286278021954d62933 to your computer and use it in GitHub Desktop.
Javascript to list all fields of an object and types of their instances
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function listAllFields(target) { | |
var allFields = Object | |
.entries(targetObject) | |
.map(a => `${a[0]}: ${typeof(a[1])}`) | |
.join(', '); | |
console.log(allFields); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment