Looking for more info? Follow our learning guides and get started!

Write a function if a number is Square or cube of another number


<script> var a=5; var b=25; //squareorcube(a,b); squareorcubeNew(a,b); function squareorcube(a,b) { if (b==a*a || b==a*a*a) { document.write("true"); } else {document.write("false");} } function squareorcubeNew(a,b) { if (b==a*a) { document.write("true"); } else if (b == a*a*a){ document.write("true"); } else {document.write("false");} } </script>

Loading Please Wait...