title: Uncaught TypeError: Cannot convert undefined or null to object
body: <p>I am facing a problem with using one of my function.In which line there is the error: <code>Uncaught TypeError: Cannot convert undefined or null to object</code> .</p>
  
  <h2>My function is:</h2>
  
  <pre><code>function hexConvert(colorval) {
      var parts = colorval.match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/);
      delete(parts[0]);   //The error is in this line
      for (var i = 1; i &lt;= 3; ++i) {
          parts[i] = parseInt(parts[i]).toString(16);
          if (parts[i].length == 1) parts[i] = '0' + parts[i];
      }
      color = '#' + parts.join('');
  }
  </code></pre>
  
  <h2>And The code when i am using that the error is consoling:-</h2>
  
  <pre><code>var btn = $(".btn-3d");
  btn.each(function(index, elem) {
  
      var bgColor = $(this).css('backgroundColor');
      hexConvert(bgColor);
      $(this).css({
          'box-shadow': '0px 4px 0px 0px' + ColorLuminocity(color, -0.1)
      });
  });
  </code></pre>
  
  <p>Can any one help me to understant it?And get the solve</p>