Baby coder here, just getting into functions. I've created a function to calculate the area of a rectangle, and it works as long as two arguments are provided. I want my code to assume the shape is a square (so length and width are equal), if only one argument is provided. I've been trying to come up with a conditional, but don't know how to say "if there is only one argument, then length === width". Any pointers appreciated!
function area(length, width) {
let rectangleArea = Number(length) * Number(width);
return rectangleArea;
}
console.log(area(10, 5));