We're a place where coders share, stay up-to-date and grow their careers.
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.
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.