javascript - Uncaught SyntaxError: Invalid destructuring assignment target - Stack Overflow

I have problem in my jquery code . Can any one help me regarding this error: Uncaught SyntaxError: Inva

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.

Share Improve this question edited May 31, 2019 at 16:14 Rory McCrossan 338k41 gold badges320 silver badges351 bronze badges asked May 31, 2019 at 16:10 Anuj BurnwalAnuj Burnwal 411 silver badge7 bronze badges 5
  • 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
Add a ment  | 

1 Answer 1

Reset to default 4

This 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.

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745673123a4639527.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信