Text Details
function calculateArea(width, height) {
try {
var area = width * height;
if (!isNaN(area)) {
return area;
} else {
throw new Error('calculateArea() received invalid number');
}
} catch(e) {
console.log(e.name + ' ' + e.message);
return 'We were unable to calculate the area.';
}
}
—
Throw
(other)
by http://www.javascriptbook.com
|
Language: | English |
This text has been typed
more than
1000 times:
Avg. speed: | 44 WPM |
---|---|
Avg. accuracy: | 95.1% |