title: Uncaught TypeError: Cannot read property 'r' of undefined
body: <p>I basically want to get individual r,g,b value of a color and store it in an object so that I can access individual values. The split function splits the rgb value of variable colorVar and want to call the varHolder in other function which I have provided it below. But when I want to display the value in console.log, it flags up with undefined error. </p>
  
  <p>I tried making the lineObj global variable but it didnt work. </p>
  
  <pre><code>function comparision(){
      split(colorL,lineObj);
      console.log('---------get-------');
  //This log doesn't work
      console.log(lineObj.r);
  }
  
  function split(colorVar,varHolder){
      colorRgb = colorVar.slice(colorVar.indexOf('(') + 1, colorVar.indexOf(')'));
      var colorArr = colorRgb.split(','),
      i = colorArr.length;
  
      while (i--)
      {
      colorArr[i] = parseInt(colorArr[i], 10);
      }
  
      varHolder = {
      r: colorArr[0],
      g: colorArr[1],
      b: colorArr[2],
      a: colorArr[3]
      }
  //The below log works.
      console.log('-----------Split-------')
      console.log(varHolder.r);
  }
  </code></pre>