Skip to content

Instantly share code, notes, and snippets.

@kylelong
Last active March 21, 2019 17:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kylelong/c6c4d317bb768a40793f998940d23ab6 to your computer and use it in GitHub Desktop.
Save kylelong/c6c4d317bb768a40793f998940d23ab6 to your computer and use it in GitHub Desktop.
Cassido's newsletter interview question of the week 3/18
let nums = []
function squareCubeNums(num){
for(var i = 1; i <= num; i++){nums[i] = i;}
//Check for perfect square && check for perfect cube
nums = nums.filter(number => Math.floor(Math.sqrt(number)) - Math.sqrt(number) == 0 && Math.pow(Math.round(Math.pow(number, 1/3)), 3) == number);
console.log(nums);
}
squareCubeNums(64);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment