I'm trying to simplify many if then statements into just one if statement with 2 arrays.
So if I have this:
if (city == 'Atlanta'){
jQuery('#cit').HTML('Atlanta');
jQuery('#pho').HTML('555-555-5555');
}
else if (city == 'Portland'){
jQuery('#cit').HTML('Portland');
jQuery('#pho').HTML('666-666-6666');
}
else if (city == 'StLouis'){
jQuery('#cit').HTML('St Louis');
jQuery('#pho').HTML('777-777-7777');
}
I'm trying to simplify it so that it's just in two or three arrays with only one if statement. Such as [Atlanta, Portland, StLouis], [Atlanta, Portland, St Louis], [555-555-5555, 666-666-6666, 777-777-7777] that way it's easier to edit in the future, plus it would be editable by someone without good knowledge of JS.
Any ideas how to achieve such a thing?