Perry
Perry

Reputation: 1337

How can I do a string comparison in a while loop in JavaScript

I am populating an HTML control using a JavaScript while loop. I need to exclude a string value from the population. I am trying this code but it is not working. What am I doing wrong here?

function getWebPropertiesSucceeded()
{
    var user = groupOwnerUsers.getEnumerator();

    while (user.moveNext())
    {
        if (user.get_current().get_title() != 'gps\ims sharepoint site collectors')
        {
            AddRowToTable(user.get_current().get_title());
        }
    } 
}

the gps\ims sharepoint site collectors value is still being added to my control. How can I fix this problem?

Upvotes: 1

Views: 358

Answers (1)

Nik Shenoy
Nik Shenoy

Reputation: 701

\ starts an escape sequence, replace with \\.

Upvotes: 5

Related Questions