Given a 4-digit integer to the function, calculate the number of attempts until it reaches kaprekar's constant i.e. 6174
Few Examples
KaprekarsConstant(8) // 6
KaprekarsConstant(1324) // 3
KaprekarsConstant(3322) // 4
A simple javascript implmentation of promise object. It isn't the best solution but does solve the given problem statement. The probable todo items/improvements would be to refer MDN doc for Promise
Listing a few here:
.all(iterable)
.reject(promiseInstance)
.resolve(promiseInstance)
.finally(callback)