I've got very basic function
defineSpeciality() {
for (var i=0; i<this.readyOffer.speciality.length; i++) {
output = output + this.readyOffer.speciality[i].name + ', '
}
return output
},
I want to be able to pass the parameter inside my function and change this.readyOffer.speciality.length
into for example this.readyOffer.experience.length
so my function should be something like this:
defineSpeciality(parameter) {
for (var i=0; i<this.readyOffer.[parameter].length; i++) {
output = output + this.readyOffer.[parameter][i].name + ', '
}
return output
},
but this of course does not work. How to do it?