Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
phoneHome = '+7(43243)2-34-43'.split('');
var num, num1, flag ;
for(var i = 0; i < phoneHome.length + 1; i++) {
console.log(phoneHome.length );
if(i === 7) {
flag = true;
num = phoneHome[i];
phoneHome[i] = ')';
continue;
}
if(flag) {
num1 = phoneHome[i];
phoneHome[i] = num;
num = num1;
}
}
console.log(phoneHome);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment