Changing the value of a variable
- by neirpycc
I'm trying to build a simple scoring app but I'm running into a problem trying to keep it so I don't have to repeat a bunch of code to deal with each 'base' individually.
The basic idea is that when I click a button the script will; 
1) grab the ID of said button
2) split the ID into two parts - (a) the bases name and (b) the button type (plus/minus)
3) if it's plus - add to the bases score, if it's minus - subtract from the bases score
4) update the assigned div with the new value
The part I'm stuck at is adding and subtracting. I can't seem to get this to work.
Here is the code:
$('.base button').click(function() {
    var b1Score = 0;
    var b2Score = 0;
    var b3Score = 0;
    var b4Score = 0;
    var b5Score = 0;
    var clickedButton = $(this).attr('id');
    var buttonInfo = clickedButton.split('-');
    var baseClicked = buttonInfo[0];
    var baseDirection = buttonInfo[1];
    var baseDiv = ('#' + baseClicked);
    console.log('You clicked ' + clickedButton + '.');
    if (baseDirection.indexOf('plus') >= 0) {
        console.log('Increasing ' + baseClicked + '!');
        ++;
        $(baseDiv).val();
    } else {
        console.log('Decreasing ' + baseClicked + '!');
        --;
        $(baseDiv).val();
    }
});
++; and --; are placeholders for where the adding and subtracting needs to happen. I just can't figure out how to get it to add or subtract from the correct value.
Any help is appreciated.
Thanks.