JSFiddle - React, Tailwind, and code Playground
by moogs
JavaScript
function foo(a, b, opts) {
if (arguments.length === 1) {
console.log("one argument pass")
} else if (arguments.length === 2) {
console.log("two argument pass")
} else if (arguments.length === 3) {
console.log("three argument pass")
}
}
foo(1); // "one argument pass"
foo(1,2); // "two argument pass"
foo(1,2,3); // "three argument pass"