Just to confirm, is this the correct way to call a function when a parameter is not needed?
function load_img(src, alt, el, other_src) {
// check if other_src exists, not null, defined, not empty, etc...
}
//call the function
load_img(src, alt, '#zoom-cover');
Is it better to write:
load_img(src, alt, '#zoom-cover', null);
or
load_img(src, alt, '#zoom-cover', '');
Is there a similar concept like in PHP where we can set a default value for the parameter?
load_img(src, alt, '#zoom-cover', other_src='default value');
Also, how can I ensure within the function that other_src exists, is defined, has a valid value, and is not null or an empty string?