Is this better?
I just fixed Code 2
Added: defaults.playerVars = playerVars;
Now the playerVars are working.
https://jsfiddle.net/xs9gL24c/
function createPlayerOptions(settings) {
const defaultOptions = defaults.playerVars;
const defaultPlayerVars = defaultOptions.playerVars;
const playerVars = Object.assign({}, defaultPlayerVars, settings);
defaults.playerVars = playerVars;
return defaults;
}
Which is now inline with Code 1
https://jsfiddle.net/c0a7kdws/
function createPlayerOptions(settings) {
const defaultOptions = defaults.playerOptions;
const playerOptions = defaultOptions.playerVars;
const playerVars = Object.assign({}, playerOptions, settings);
playerOptions.playerVars = playerVars;
return playerOptions;
}
.playa & .playc
have
start: 45;
Which allows me to test the settings after I make changes in the code.
If those don’t work, it means I messed up somewhere.
It’s hard for me to figure these out because, I only go by, if I place one thing somewhere and everything works, I think there is nothing wrong.
The only way I can tell if something is wrong, is if the code stops working.