First of all, you should try giving your variables more meaningful names.
Secondly, the slice method returns a string. If you want to perform mathematical operations you have to first convert that string into a Number object, for example like this:
var ram = Number(p_name.slice(1,2));