我的语法错误,请建议JavaScript的适当语法&;JQuery?

我的语法错误,请建议JavaScript的适当语法&;JQuery?,javascript,jquery,rendering,Javascript,Jquery,Rendering,我对JavaScript和jQuery非常陌生,在我的VisualStudio代码中,它的语句表达式应该在var se附近,并且它还说'}'应该在{“URL”:window.location.href,}附近,对此有什么合适的修复方法 请告知 这是我的密码: <script type = "text/javascript"> function renderSurvey(URL){ var se = new SurveyEmbed("FM9wg_ghhg

我对JavaScript和jQuery非常陌生,在我的VisualStudio代码中,它的语句表达式应该在
var se
附近,并且它还说
'}'
应该在
{“URL”:window.location.href,}
附近,对此有什么合适的修复方法

请告知

这是我的密码:

<script type = "text/javascript">
        function renderSurvey(URL){
        var se = new SurveyEmbed("FM9wg_ghhgvjh","https://formsss.tester.com/","https://jhbjh.kjbkjedge.net/mfpembedconkhtweu/");
        var context = {"URL":window.location.href,};se.renderButton( context);
        }
    </script>

函数renderSurvey(URL){
var se=新的调查项目(“FM9wg_ghhgvjh”https://formsss.tester.com/","https://jhbjh.kjbkjedge.net/mfpembedconkhtweu/");
var context={“URL”:window.location.href,};se.renderButton(context);
}

您的语法没有问题,Visual Studio代码是错误的(后面的逗号由Taplar标注)。尝试在web浏览器中运行代码——它是否按预期工作?如果没有,请打开浏览器的调试控制台,告诉我们您看到的错误。

您的代码实际上没有问题,我的Visual Studio代码也没有给出任何错误

不过,您可以提高可读性,我认为这样更简洁(其他人可能不同意):


删除.hrefIn后面的尾随逗号关于尾随逗号不是无效的,用户可能看到VSCode提供jslist反馈,这可能会在尾随逗号周围出现警告。我得到以下未捕获引用错误:未定义html这告诉我们有一个名为“html”的javascript变量正在使用但未定义的。您提供的代码不包含“html”变量,因此此错误来自其他地方。控制台应该告诉您错误来自哪个文件和行。
function renderSurvey(URL) {
  let se = new SurveyEmbed(
    "FM9wg_ghhgvjh",
    "https://formsss.tester.com/",
    "https://jhbjh.kjbkjedge.net/mfpembedconkhtweu/"
  );
  let context = { URL: window.location.href };

  se.renderButton(context);
}