I am having a global variable and I want to concatenate some value to this variable in a for loop and want the value outside of a for loop. But the problem is whenever the for loop starts it's next iteration value of variable is lost.
my code
function hello() {
  StringBuffer Id = new StringBuffer(20);
  Id.append("");
  for (i = 1; i < 10; i++) {
    Id.append(i);
  }
  System.out.println(Id);
}
 
     
     
     
    