mirror of
https://github.com/documentationjs/documentation.git
synced 2026-01-18 14:17:30 +00:00
16 lines
327 B
JavaScript
16 lines
327 B
JavaScript
/**
|
|
* This function returns the number plus two.
|
|
*
|
|
* @param {Number} a the number
|
|
* @returns {Number} numbertwo
|
|
* @throws {Error} if number is 3
|
|
* @example
|
|
* var result = returnTwo(4);
|
|
* // result is 6
|
|
*/
|
|
function returnTwo(a) {
|
|
if (a === 3) throw new Error('cannot be 3');
|
|
// this returns a + 2
|
|
return a + 2;
|
|
}
|