js function with optional inputs code example
Example: javascript optional parameters
const myFunction = (str, id=0) => {
console.log(str, id)
}
myFunction("Hello Grepper")
// OUTPUT : "Hello Grepper 0"
myFunction("HG", 10)
// OUTPUT : "HG 10"
const myFunction = (str, id=0) => {
console.log(str, id)
}
myFunction("Hello Grepper")
// OUTPUT : "Hello Grepper 0"
myFunction("HG", 10)
// OUTPUT : "HG 10"