How to check the type of a js value, such as whether it is undefined #513
-
Now it can only be converted into a string to check var some = rt.Evaluate("");
some.ToString() == "[undefined]" Can you provide an API that returns JsValue instead of just dynamic |
Beta Was this translation helpful? Give feedback.
Answered by
ClearScriptLib
May 25, 2023
Replies: 2 comments
-
Well, I found that some == Undefined.Value, but other types seem to be unable to check |
Beta Was this translation helpful? Give feedback.
0 replies
-
Hello @2A5F,
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:
Good luck! |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
2A5F
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hello @2A5F,
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:
undefined
is converted toUndefined.Value
.IScriptObject
.BigInt
is converted toBigInteger
.IJavaScr…