I have string "513". I need array ["5", "1", "3"]. My solution:
function nextBigger(num){
let numStr = '' + num;
let numArr = [];
for(let i = 0; i < numStr.length; ++i) {
numArr.push(numStr[i]);
}
console.log(numArr);
}
nextBigger(513);
But this solution is large and redundant. I need shorter solution.