title: Leaflet: sort and edit geojson data in a table with if-statements
body: <p>I'm having trouble with displaying json data in a table. I am working on a map that shows data wich is directly exported as a geojson file from Openstreetmap via overpass-turbo.eu. This means that every point has different features. I want to show as much information in the popup as possible, but keep unessesary information out of the table, plus I want the links to be clickable. This is my code so far, that provides a basic table view of each point. Here is a demo: <a href="http://stefang.cepheus.uberspace.de/stackexample/" rel="nofollow noreferrer">http://stefang.cepheus.uberspace.de/stackexample/</a></p>
  
  <pre><code>function everyPoint (feature, layer){
   var popupcontent = [];
      for (var prop in feature.properties) {
          popupcontent.push("&lt;tr&gt;&lt;td&gt;" +prop + ": &lt;/td&gt;&lt;td&gt;" + feature.properties[prop].replace(";", ", ") + "&lt;/td&gt;&lt;/tr&gt;");
      }
  
      var innerTable = popupcontent.join("");
  
      layer.bindPopup(
          "&lt;h1&gt;" +feature.properties.name +"&lt;/h1&gt;"
          +"&lt;table&gt;" +innerTable + "&lt;/table&gt;"
          +"&lt;p&gt; Old or outdated data? Change it on &lt;a href='http://openstreetmap.org/" +feature.id  +"'&gt; on openstreetmap.org&lt;/a&gt;.&lt;/p&gt;"
      );
  };
  
  L.geoJson(karlsruhe, {
      onEachFeature: everyPoint
  }).addTo(map);
  </code></pre>
  
  <p>I want to do three things here:</p>
  
  <ol>
  <li>Hide unnessesary data, basically @ID, Shop:Farm</li>
  <li>Switch URLs to hyperlinks, mainly website and contact.website</li>
  <li>Show everything else as a text in the table</li>
  </ol>
  
  <p>I tried to solve this with a simple if-statement, but only the else block runs:</p>
  
  <pre><code>var popupcontent = [];
      for (var prop in feature.properties) {
        if (prop == "id" ){
          //do nothing
          }
        else if (prop == "website"){
            popupcontent.push("&lt;tr&gt;&lt;td&gt;" +prop + ": &lt;/td&gt;&lt;td&gt;" + "&lt;a link href='" + feature.properties[prop] + "'&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;");
          }
  
          else {
            popupcontent.push("&lt;tr&gt;&lt;td&gt;" +prop + ": &lt;/td&gt;&lt;td&gt;" + feature.properties[prop].replace(";", ", ") + "&lt;/td&gt;&lt;/tr&gt;");
          }
      }
  </code></pre>
  
  <p>I believe there is something wrong with the statement in the if function, but I can't figure it out. Thanks for any help :)</p>