admin管理员组文章数量:1435859
I have problem in my jquery code . Can any one help me regarding this error:
Uncaught SyntaxError: Invalid destructuring assignment target
$(function() {
$('#Events').on("slides", function({
generateNextPrev: true,
play: 5000,
pause: 2500,
hoverPause: true,
preload: true,
preloadImage: '/images/loading.gif'
});
// $('#slides_container').css("display", "inline");
);
});
This error is ing in this line generateNextPrev: true,
. Kindly guide me, what's the issue.
I have problem in my jquery code . Can any one help me regarding this error:
Uncaught SyntaxError: Invalid destructuring assignment target
$(function() {
$('#Events').on("slides", function({
generateNextPrev: true,
play: 5000,
pause: 2500,
hoverPause: true,
preload: true,
preloadImage: '/images/loading.gif'
});
// $('#slides_container').css("display", "inline");
);
});
This error is ing in this line generateNextPrev: true,
. Kindly guide me, what's the issue.
- Your syntax is incorrect. You cannot define an object in the arguments of a function. Exactly what are you expecting this code to do? – Rory McCrossan Commented May 31, 2019 at 16:13
-
Also note that you have an extra
)
in there, but I assume this is a typo when writing the question – Rory McCrossan Commented May 31, 2019 at 16:14 - 1 @Rory - please clarify: You cannot define an object in the arguments of a function – Randy Casburn Commented May 31, 2019 at 16:16
- See MDN, or @Ian's answer below: stackoverflow./a/56398576/519413. – Rory McCrossan Commented May 31, 2019 at 16:19
- Thanks, for the reply I solved the issue, the issue came because of javascript version. – Anuj Burnwal Commented Jun 3, 2019 at 7:55
1 Answer
Reset to default 4This is invalid syntax - take a look at the function declaration on line 1 vs line 2. I don't know what you're trying to acplish, but you must have a function body. You have this: .on("slides", function({...});
which has an unclosed parenthesis and no function body. .on("slides", function(parameters) {/*do stuff here*/});
is the syntax you need; I'm not really sure where the object is intended to go.
本文标签: javascriptUncaught SyntaxError Invalid destructuring assignment targetStack Overflow
版权声明:本文标题:javascript - Uncaught SyntaxError: Invalid destructuring assignment target - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745673122a2669692.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论