function check(a, b = 0) {
document.write("Value of a is: " + a +
" Value of b is: " + b +
"<br>");
}
check(9, 10);
check(1);
const myFunction = (str, id=0) => {
console.log(str, id)
}
myFunction("Hello Grepper")
// OUTPUT : "Hello Grepper 0"
myFunction("HG", 10)
// OUTPUT : "HG 10"
obj.val?.prop
obj.val?.[expr]
obj.arr?.[index]
obj.func?.(args)
const db = { input() { return { query() { return 'db.input(...).query(...)'; } } }, query() { return 'db.query(...)'; } };
console.log((true ? db.input() : db).query());
console.log((false ? db.input() : db).query());