Created
January 20, 2021 19:26
-
-
Save bobdobbalina/b9ea2d970ba8dd33346abc332847cc0a to your computer and use it in GitHub Desktop.
Javascript: Get the native type of any value
This file contains hidden or 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
const nativeType = v => | |
v === undefined ? 'undefined' : v === null ? 'null' : v.constructor.name.toLowerCase(); | |
nativeType(new Set([1, 2, 3])); // set |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment