Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

javascript How can i do optional function

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());
Source by developer.mozilla.org #
 
PREVIOUS NEXT
Tagged: #javascript #How #optional #function
ADD COMMENT
Topic
Name
8+8 =