Skip to content

How to check the type of a js value, such as whether it is undefined #513

Answered by ClearScriptLib
2A5F asked this question in Q&A
Discussion options

You must be logged in to vote

Hello @2A5F,

Can you provide an API that returns JsValue instead of just dynamic

ClearScript doesn't have such APIs because (a) scripts can return .NET values as well as script values, and (b) ClearScript's API is designed to support languages other than JavaScript.

You can use this summary to identify and interact with data returned from script code:

  • All .NET values are returned in their native .NET form.
  • Script numeric, Boolean, and string values are converted to their equivalent .NET types.
  • JavaScript undefined is converted to Undefined.Value.
  • All script objects implement IScriptObject.
  • [V8] JavaScript BigInt is converted to BigInteger.
  • [V8] All JavaScript objects implement IJavaScr…

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by 2A5F
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants