Fixing error – SCRIPT1028: Expected identifier, string or number

There are 2 common ways to trigger the SCRIPT1028: Expected identifier, string or number JavaScript error in earlier versions of Internet Explorer. The first way is to include a trailing comma after your last property in a JavaScript object. The other common trigger is using a JavaScript reserved word as a property name. I’ll show you examples of both, and how to work around some of these limitations.

Example #1: Trailing Comma

You’ll notice in this example, we leave a comma after the 'Login Successful' value. This will trigger the SCRIPT1028: Expected identifier, string or number error in Internet Explorer 7 and below.

var message = {
    title: 'Login Unsuccessful',

Example #2: Using a JavaScript Reserved Word

In this example, we assign a property named class to our JavaScript object. Class is a reserved word, and cannot be used as an identifier.

var message = {
    class: 'error'

The Solution

The solution is to pass the class property value as a string. You will need to use bracket notation, however, to call the property in your script.

var message = {
    title: 'Login Unsuccessful',
    text: 'Please check your username or password',
    'class': 'error'


Related Links

MDN | Reserved Words – JavaScript
  • onder

    Thanks you :)

  • Prahlad Yadav

    Thanks a lot…. i will stuck in IE 7 for isotope module….but your help resolve my issue….thank you…

  • adam

    Thank you very much!

  • Touch.


  • nishit vadhwana

    SCRIPT3: Member not found.
    can any body help me??
    i got this error in IE7 and IE8

  • Name

    Thank you very worked for me

  • Ravishankar

    expecting more videos in javascript and Grunt