// Basic function with 3 parameters function argCheck(parameter1, parameter2, parameter3){ console.log(parameter1 + parameter2 + parameter3); }
//the parameter of the following formatDate function is userDate function formatDate(userDate) { // format from M/D/YYYY to YYYYMMDD }
function getRectArea(width, height) { if (width > 0 && height > 0) { return width * height; } return 0; } console.log(getRectArea(3, 4)); // expected output: 12 console.log(getRectArea(-3, 4)); // expected output: 0 //example from https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/return