Skip to content

Instantly share code, notes, and snippets.

@im7mortal
Created April 23, 2015 13:20
Show Gist options
  • Save im7mortal/d561f03316edf31de358 to your computer and use it in GitHub Desktop.
Save im7mortal/d561f03316edf31de358 to your computer and use it in GitHub Desktop.
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