0

I'm using a CodeHS javascript Console sandbox for this. I have two variables, I'm trying to use a function that has a parameter. the parameter uses test++ (test is what I called my parameter) to add 1 to the parameter. What I want is for my variables to have one added by using a parameter.

here is what I've tried:

var num = 1;
var two = 3;
println(num);//the variables before
println(two);
update(num);//the function
update(two);
println(num);//the new variables
println(two);
function update(test){
    test++;
    println(test);
}

the output:

1 
3
2
4
1
3

I'm trying to get:

1
3
2
4
2
4
Douglas
  • 1
  • 1

0 Answers0