I am new in Javascript. I want to create a function which will take a hexadecimal color code and it will convert it to rgb(xx,xx,xx). My code is found below
function my(a){
var first = a[1] + a[2];
var second = a[3] + [4];
var third = a[5] + a[6];
var res = [first,second,third];
for(var i = 0; i <res.length; i++){
res[i] = parseInt(res[i],16);
}
return res;
}
First and third array element is converting correctly except second array element. I don't why, can anyone tell me why?