JS Object:
var saver = {
title: false,
preview: false,
body: false,
bottom: false,
locale: false
};
The question is how to check if all values is false?
I can use $.each() jQuery function and some flag variable, but there may be a better solution?
Short and handy one-liner, fully supported by browsers:
or
(careful tho, Object.values() is not supported by IE yet.)
This will do the trick...
You can iterate objects using a loop, either by index or key (as above).
If you're after tidy code, and not repeating that then simply put it in a function...
Then you can call it whenever you need, like this...
Here's a working sample...