Java Reference
In-Depth Information
ful if you want some code to run in both cases. We can use this to modify the imagin-
arySquareRoot() function so that it adds "+ or -" to the answer before returning it:
function imaginarySquareRoot(number) {
"use strict";
try {
var answer = String(squareRoot(number));
} catch(error) {
answer = squareRoot(-number)+"i";
} finally {
return "+ or -" + answer;
}
}
 
Search WWH ::




Custom Search