title: Javascript - locating a specific index in an array
body: <p>I am very new to javascript and your help would be much appreciated.</p>
  
  <pre><code>germany
  france
  uk
  italy
  spain
  poland
  romania
  netherlands
  belgium
  greece
  
  
  clickData.points[0].label
  //germany [console: tells what country was clicked on - as shown in the image]
  
  var iExpandPos = clickData.points[0].fullData.labels.indexOf(clickData.points[0].label)
  //2 [console: tells the index position of the country]
  
  var len = clickData.points[0].fullData.labels.length;
  //10 [console: gives the total number of countries listed]
  </code></pre>
  
  <p><strong>What i want to do is:</strong></p>
  
  <p>If a country is clicked [example germany] make the <code>pull = 0.2</code> and the
  pull for the rest of the countries should be <code>pull = 0.1</code> but i am unsure how to write this code as my below code keeps breaking. Your advise would be veryhelpful.</p>
  
  <pre><code>var myPlot = document.getElementById(chartDivID);
  console.log('myPlot:------------&gt;', myPlot.data[0])
  clickData = data;
  var iExpandPos = clickData.points[0].fullData.labels.indexOf(clickData.points[0].label)
  var len = clickData.points[0].fullData.labels.length;
  var pts = "";
  for (var i = 0; i &lt; data.points.length; i++) {
      pts = 'country= ' + clickData.points[0].label + '\nvalue = ' + clickData.points[0].value + '\nposition = ' + iExpandPos;
  
  
      int[] pull = new int[](len);
      for (i = 0; i = len) {
          if (i === iExpandPos) {
              pull[i] = 0.2
          }
          else {
              pull[i] = 0.1
          }
      }
  
      console.log('check:-------&gt;', pts)
  }
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/KlNUB.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/KlNUB.png" alt="enter image description here"></a></p>