Primary Objective Code golf-ished:
const isCubic = number => ( number < 1000 && ('' + number).split('').map( n => parseInt(n) ).reduce( (a, c) => a + c ** 3, 0 ) === number )? 1 : null;
P.S. @thepracticaldev , I think the secondary objective example 1 output is incorrect:
s = “aqdf& 0 1 xyz 153 777.777" should return “0 1 153 154”
The 154 shouldn't be there, right?
Seems like it was supposed to be in the input, not expected output.
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.
Primary Objective Code golf-ished:
P.S. @thepracticaldev , I think the secondary objective example 1 output is incorrect:
The 154 shouldn't be there, right?
Seems like it was supposed to be in the input, not expected output.