So I am trying to shuffle the input of a user
e.g
User inputs "123HDJ"
I extract/match the numbers from the string
and I return 213 123 321 132 ...
So far I have only been able to return the numbers that occur from user input i.e 123
Again I am a newbie so nothing too overcomplicated
This is currently what I have
solution () {
let input = document.getElementById("number").value;
if (input.length > 0 ){
const numbers = /[0-9]/g;
let newInput = input.match(numbers).join("");
let shuffled = newInput
console.log(typeof newInput)
alert(newInput)
}
else {
console.log("Error please try again");
}
}
I am not looking to change my any code above let shuffled
as I want my code to remain as organically mine as possible lol
please help if you can