// add() takes in two arguments, both of which should be finite numbers, and returns their sum
functionadd(a,b){
// Verify whether either of the two parameters are missing.
if(a===undefined||b===undefined)
throwError("One or more parameters are missing from add()");// Throw error
// Verify whether parameters are finite numbers by using Number.isFinite()
elseif(Number.isFinite(a)&&Number.isFinite(b))
returna+b;// Return sum
// Throw an error if both parameters are not numeric
else
throwError("One or more parameters are not numeric");// Throw error
}
add(23,47);
Purpose-built for displays of data
Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.