Expected identifier, string or number

前端 未结 4 1839
粉色の甜心
粉色の甜心 2021-01-20 04:10

I have an object like;

var defaults = {
        id: \'ActionSlider\',
        element: \'\',
        closeBtnWidth: 55,
        panelWidth: 320,
        clas         


        
相关标签:
4条回答
  • 2021-01-20 04:52

    Usually class refers to the class attribute of any object like <div >, <input > etc. which shows displays class as <div class="someclass">

    0 讨论(0)
  • 2021-01-20 04:58

    class is reserved words in javascript

    0 讨论(0)
  • 2021-01-20 05:06

    Yep, class is a reserved word. MDN

    0 讨论(0)
  • 2021-01-20 05:08

    You need to add quotes round the class which is a reserved word. Please also note, that you should remove the last comma:

    var defaults = {
            id: 'ActionSlider',
            element: '',
            closeBtnWidth: 55,
            panelWidth: 320,
            "class": '',
            css: {},
            create: function() {}
        }
    
    0 讨论(0)
提交回复
热议问题