+ 12
Why "var" don't work in javascript using clearscript C#
I started using Clearscript in C# to make JavaScript extensions in my code, and i tested with that in a JavaScript file: Main = {} Main.OnLoad = function () { Console.WriteLine("Hello, World!"); } and run it in C# with that line: v8.Script.Main.OnLoad(); It works, but when i put "var" in the first line of JavaScript var Main = {}; in C# v8.Script.Main is undefined.
7 Réponses
+ 10
I wish I could answer your question, however, I had never heard of Clearscript until now.
I'm intrigued to learn more about the scenarios for Clearscript. I've bookmarked a few links for reviewing later.
+ 8
Nice! 👌Thanks for sharing this with me.
+ 6
David Carroll Don't worry, I hope you like Clearscript!
JBuster Re-read my question, I use javascript using Clearscript in C#, not in a web code
+ 6
InvBoy [ :: FEDE :: ] How are you using Createscript? Or rather, what's the scenario where this is useful?
+ 5
David Carroll Clearscript can be useful to allow users to create extensions or new functionality to your app, just like chrome with its extensions or just like modifications on servers in many games.
+ 2
Try using let instead of var. If your script is in the same document as your HTML, try changing the position of script