Why doesn't my simple if-statement render false in javascript?
<p>I call a function like this:</p>

<pre><code>call_facebook(103138046395999, "samåkning.se", "http://www.facebook.com/samakning", "page");
call_facebook(16089699074, "Jag ska köra bil, vem vill åka med", "http://www.facebook.com/groups/16089699074/", "grupp")
</code></pre>

<p>The function looks like this:</p>

<pre><code>function call_facebook(id, name, link, type){
  //snip
  console.log(type)
  if (type = "grupp"){
    var postid=fbposts[fbpost].id.split("_");
    return "https://www.facebook.com/groups/"+postid[0]+"/permalink/"+postid[1]+'/'
  }
  else {
    return fbposts[fbpost].actions[0].link;
  }
}
//snip
};
</code></pre>

<p>I have confirmed that they have different type arguments, but still the first case <code>if (type = "grupp")</code> always ends up <code>true</code>. Why?</p>
