HOTSPOT -
You are using JavaScript to write a safe root math utility that has the following requirements:
Given the function safeRoot(a, b):
If the radicand (a) is non-negative, return Math.pow (a, 1/b);
Otherwise,
If the index (b) is divisible by 2, then return text indicating the result is imaginary.
Otherwise return -Math.pow (-a, 1/b)
How should you complete the code? To answer, select the appropriate code segments in the answer area.
NOTE: Each correct selection is worth one point.
Hot Area:
becky_intelletive
Highly Voted 4 years, 3 months agodorkian
Most Recent 4 years, 2 months ago