type of an object #1320
Unanswered
espruino-discuss
asked this question in
JavaScript
Replies: 2 comments
-
Posted at 2019-05-10 by AkosLukacs If you know what type you expect, you can use
|
Beta Was this translation helpful? Give feedback.
0 replies
-
Posted at 2019-05-13 by @gfwilliams As far as I know there's nothing built-in, since the name of the object isn't actually stored in the object itself in Espruino. However if the class is something that's defined in the global scope, like SPI, then you can do:
But if you know what you're looking for, you're far better off going with @AkosLukacs's suggestion as it's far faster and neater! |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Posted at 2019-05-10 by JumJum
How do I detect type of an object ?
For example var x = new SPI()
X returns SPI: { }, so in web IDE(only in web IDE) I see its an SPI object
typeof x returns ="object"
Is there any JS command, something like objectType, which returns "SPI"
Beta Was this translation helpful? Give feedback.
All reactions