title: Make condition to set the colour of polyline on google maps API
body: <p>I've been make polyline on google Maps. But I wanna set the polyline into 3 colours. I have conditions to set it, but don't know how to place it. this is the code</p>
  
  <pre><code>    var polylinePlanCoordinates  = [];
       var polyline_data = &lt;?php echo json_encode($data); ?&gt;;
       for (var i=0;i&lt; polyline_data.length;i++ ){
        polylinePlanCoordinates.push(new google.maps.LatLng(polyline_data[i]['latitude'], polyline_data[i]['longitude']));
      }
  
      var path= new google.maps.Polyline({
        path: polylinePlanCoordinates,
       geodesic: true,
      strokeColor: '#000000',
      strokeOpacity: 1.0,
      strokeWeight: 5
       });
  
       path.setMap(map);
  }
  
  
  
  google.maps.event.addDomListener(window, 'load', initialize);
  </code></pre>
  
  <p>and the condition is</p>
  
  <pre><code>if(polyline_data[i]['kon_jem']&gt;0 &amp;&amp; polyline_data[i]['kon_jem']&lt;3){
  strokeColor: '#ffffff';
  }
  else if (polyline_data[i]['kon_jem']&gt;3 &amp;&amp; polyline_data[i]['kon_jem']&lt;9){
  strokeColor: '#000000';
  }
  else if (polyline_data[i]['kon_jem']&gt;9){
  strokeColor: '#fff000';
  }
  </code></pre>