What is a JS shorthand for the following:
if (typeof bfMax !== 'undefined') {
options.max = bfMax;
}
What is a JS shorthand for the following:
if (typeof bfMax !== 'undefined') {
options.max = bfMax;
}
The concise, readable, maintainable, shorthand for assigning a value conditionally is:
if (typeof bfMax !== 'undefined') {
options.max = bfMax;
}
and it appears that you're already using it.
If you want to minify the script to make it shorter, less readable, and unmaintainable, you can use:
typeof bfMax!=='undefined'&&(options.max=bfMax)
Of course, you'll want to swap out your variable names to make things shorter:
typeof b!=='undefined'&&(o.max=b)