Ever since joining a new company 9 months ago, I've been encountering this line of code in JavaScript. It seems to work fine and I've been incorporating it into my coding style to align with the previous developers. However, I'm not entirely sure what it does. I've attempted to search for more information online, but I'm not quite sure where to start.
!options && (options = {})
My intuition tells me that it could be some sort of ternary conditional, but I can't say for certain.
A clearer example of its usage would be:
function init(options) {
!options && (options = {});
}
init();