Expected identifier, string or number

I have an object like;

var defaults = {
        id: 'ActionSlider',
        element: '',
        closeBtnWidth: 55,
        panelWidth: 320,
        class: '',
        css: {},
        create: function() {},
    },

and when i run my page in IE8 standards its giving me the following error;

SCRIPT1028: Expected identifier, string or number

and points to the line : class:' ',

can anyone please tell me why i cant use this for IE? is it a reserved word or something?

Answers:

Answer

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() {}
    }
Answer

Yep, class is a reserved word. MDN

Answer

class is reserved words in javascript

Answer

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

Answer

You must remove comma from this line:

height: $.webcam._height,

Answer

Try removing the trailing comma:

$.webcam._flash.flash(
    {
        src: 'jquerywebcamhelper.swf',
        width: $.webcam._width,
        height: $.webcam._height
    },
    {
        version: 8
    }
);

IE doesn't like the extraneous comma in object declarations.

Tags

Recent Questions

Top Questions

Home Tags Terms of Service Privacy Policy DMCA Contact Us

©2020 All rights reserved.