javascript - Swap position of number in a 4 digit number without array -


in 4 digit number how swap 1 number 3 , 2 4 number need solve 1 problem in javascript.thank you

try this:

x = '1234'  x.replace(/(.)(.)(.)(.)/,'$3$4$1$2')  result: "3412" 

Comments

Popular posts from this blog

how to insert data php javascript mysql with multiple array session 2 -

c++ - How to test/verify that zero-initialization takes place -

node.js - Webpack/TypeScript Raising Errors When node_modules is Excluded -