I want to repeat this process using for loop if I put many more numbers like
var string = ["+919999999999","+918888888888","+917777777777"];
here is my code:
var string = "+919999999999";
document.write(string.slice(-10));
I want to repeat this process using for loop if I put many more numbers like
var string = ["+919999999999","+918888888888","+917777777777"];
here is my code:
var string = "+919999999999";
document.write(string.slice(-10));
 
    
     
    
    Is this what you are trying to achieve?
let strings = ["+919999999999","+918888888888","+917777777777"];
strings.forEach(str => {
  return document.write(str.slice(-10) + "<br/>");
}) 
    
    var items = ["+919999999999","+918888888888","+917777777777"];
items.forEach(item => document.write(item.slice(-10)))
 
    
     
    
    here you have 3 different ways
var numbers = ["+919999999999","+918888888888","+917777777777"];
console.log("------ 1 ");
for(let number of numbers){
  console.log(number.slice(-10))
}
console.log("------ 2");
for(var i = 0; i < numbers.length; i++){
  console.log(numbers[i].slice(-10));
}
console.log("------ 3");
numbers.forEach(n => console.log(n.slice(-10))) 
    
    this is a solution as far as i understand the problem
 var string = "+919999999999";
    
    let numToMinus='1',
    str2=string.slice(-10)
    
    for (let i=0;i<str2.length-1;i++){
        numToMinus=numToMinus+'1'
    }
    
    let list=["+919999999999"]
    for(let i=0;i<numToMinus.length-1;i++){
        str2= parseFloat(str2)-parseFloat(numToMinus)
    
        list.push("+91"+str2)
    }
    
    console.log(list)
;
