Javascript if condition fails
<pre><code>name =  u'pycon'
name_list = u'acxack', u'pycon', u'A_ForA', u'retweetstats',
            u'Bsdsad', u'dcxcxzc', u'ss'
</code></pre>

<p>I have to write if <code>name in name_list</code> return <code>true else false</code>. I have written:</p>

<pre><code>var x;

function is_following(name_list, name) {
    for(var f=0; f&lt;name_list.length; f++)  {
            if("u'"+name+"'" == name_lis[f]) {
            x= true;

        }
    }
    return x
</code></pre>

<p>But everytime it returns false. But It should be returning true, because the required condition is like:</p>

<pre><code>If name in name_list:
       return true 
else:
       return false
</code></pre>
