[英]VSCode Syntax Error ; expected
Not really sure if this is actually an issue, as I've noticed in the past VSCode gives warnings about things that only apply to TypeScript. 正如我在过去注意到的,VSCode不确定是否确实是一个问题,它会警告仅适用于TypeScript的内容。 I'm creating an object constructor in vanilla JS, like this:
我正在香草JS中创建对象构造函数,如下所示:
"use strict";
function Imaging(outputAttr) {
var output = document.getElementById(outputAttr);
var svgAttributes = {
namespace: ['http://www.w3.org/2000/svg', 'svg'],
attributes: { // colon here
style: "border: 1px solid black", //d in border, b in black
width: "200", height: "300" }, //t in width
attributeNamespace : ['http://www.w3.org/2000/xmlns/', 'xmlns:xlink', 'http://www.w3.org/1999/xlink']
};
}
Under var svgAttributes
, I am getting a red squiggly with the error "; expected"
. 在
var svgAttributes
,我被错误地用红色表示"; expected"
。 Everything works as it should, far as I can tell, but I'm not sure why I'm getting this error in the editor. 据我所知,一切都可以正常工作,但是我不确定为什么在编辑器中出现此错误。 Am I missing something?
我想念什么吗?
I've noted the exact locations in comments. 我已经在评论中指出了确切的位置。
I think this is beacuse you have to add a ;
我认为这是因为您必须添加
;
at the end of the function Imaging
like this : 在
function Imaging
的末尾,如下所示:
"use strict";
function Imaging(outputAttr) {
var output = document.getElementById(outputAttr);
var svgAttributes = {
namespace: ['http://www.w3.org/2000/svg', 'svg'],
attributes: { // colon here
style: "border: 1px solid black", //d in border, b in black
width: "200", height: "300" }, //t in width
attributeNamespace : ['http://www.w3.org/2000/xmlns/', 'xmlns:xlink', 'http://www.w3.org/1999/xlink']
};
}; // <----- just here
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.