To take into account the "steel wheel" (straight 5432A) you need to add an imaginary face value of 1:
const order = "123456789TJQKA"
And if the input contains 2, 3, 4, 5 and A, then make the replacement of A by 1:
function SteelWheel(str) { if((str.indexOf('2') + 1) && (str.indexOf('3') + 1) && (str.indexOf('4') + 1) && str.indexOf('5') + 1) && (str.indexOf('A') + 1)) { return str.replace('A', '1') } else { return str } }
As mentioned in my comment above, the initial challenge had no straight from the ace. My version in the comment above supports the "steel wheel"
Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink.
Hide child comments as well
Confirm
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
To take into account the "steel wheel" (straight 5432A) you need to add an imaginary face value of 1:
const order = "123456789TJQKA"
And if the input contains 2, 3, 4, 5 and A, then make the replacement of A by 1:
function SteelWheel(str) { if((str.indexOf('2') + 1) && (str.indexOf('3') + 1) && (str.indexOf('4') + 1) && str.indexOf('5') + 1) && (str.indexOf('A') + 1)) { return str.replace('A', '1') } else { return str } }
As mentioned in my comment above, the initial challenge had no straight from the ace. My version in the comment above supports the "steel wheel"