var Aplayer1Skills [10,10,10]
var Bplayer1Skills = [5,5,5]
var Cplayer1Skills [7,7,7]
var Dplayer1Skills = [2,2,2]
var traded = [0]
var Xtraded = [0]
var teamLetter = "A"
var XteamLetter = "B"
//This is the struggle
traded = teamLetter+"player"+1+"Skills"
Xtraded = XteamLetter+"player"+1+"Skills"
parseInt(traded)
parseInt(Xtraded)
Aplayer1Skills = Xtraded
Bplayer1Skills = traded
console.log('Aplayer1: '+traded)
console.log('Bplayer1: '+Bplayer1Skills)
I'm making a basketball simulation and there are many teams that I will need to trade players among. Trying to make it easier on myself by switching certain parts of the variable since I have all the players declared similarly. Problem is when I trade them instead of listing the numbers in Aplayer1Skills it displays Aplayer1Skills as a string and not the numbers I want. Any help is appreciated and will help me greatly in the future. Thank you